Feast 2.0!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

77 lines
1.6 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.user.executeAction(this.action, 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: 100%;
  44. padding: 4pt;
  45. flex: 0 1;
  46. background: #333;
  47. border-color: #666;
  48. border-style: outset;
  49. user-select: none;
  50. }
  51. .action-button:hover {
  52. background: #555;
  53. }
  54. .action-title {
  55. font-size: 125%;
  56. color: #eee;
  57. }
  58. .action-desc {
  59. color: #ccc;
  60. }
  61. </style>