Feast 2.0!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

72 lignes
1.5 KiB

  1. <template>
  2. <button @mouseover="describe" class="action-button" @click="execute">
  3. <div class="action-title">{{ action.name }}</div>
  4. <div class="action-desc">{{ action.desc }}</div>
  5. </button>
  6. </template>
  7. <script lang="ts">
  8. import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator'
  9. import { Action, GroupAction } from '@/game/combat'
  10. import { Creature } from '@/game/entity'
  11. @Component({})
  12. export default class ActionButton extends Vue {
  13. @Prop()
  14. action!: Action
  15. @Prop()
  16. user!: Creature
  17. @Prop()
  18. target!: Creature
  19. @Prop()
  20. combatants!: Array<Creature>
  21. @Emit("execute")
  22. execute () {
  23. if ((this.action as GroupAction).executeGroup !== undefined) {
  24. const action = (this.action as GroupAction)
  25. this.$emit('executed', (this.action as GroupAction).executeGroup(this.user, action.allowedGroup(this.user, this.combatants)))
  26. } else {
  27. this.$emit('executed', this.action.execute(this.user, this.target))
  28. }
  29. }
  30. @Emit("describe")
  31. describe () {
  32. if ((this.action as GroupAction).describeGroup !== undefined) {
  33. const action = (this.action as GroupAction)
  34. this.$emit('described', action.describeGroup(this.user, action.allowedGroup(this.user, this.combatants)))
  35. } else {
  36. this.$emit('described', this.action.describe(this.user, this.target))
  37. }
  38. }
  39. }
  40. </script>
  41. <style scoped>
  42. .action-button {
  43. width: 100pt;
  44. background: #333;
  45. }q
  46. .action-button:hover {
  47. background: #555;
  48. }
  49. .action-title {
  50. font-size: 125%;
  51. color: #eee;
  52. }
  53. .action-desc {
  54. color: #ccc;
  55. }
  56. </style>