Feast 2.0!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

108 lines
2.7 KiB

  1. <template>
  2. <div class="statblock">
  3. <h2 v-if="subject.perspective === firstperson">You</h2>
  4. <h2 v-if="subject.perspective !== firstperson">{{subject.name.all.capital}}</h2>
  5. <div class="stat-line">
  6. <div class="stat-entry" :data-tooltip="vigor" v-for="vigor in Object.keys(subject.vigors)" v-bind:key="vigor"><i :class="vigorIcons[vigor]" /><div>{{subject.vigors[vigor]}}</div></div>
  7. </div>
  8. <br>
  9. <div class="stat-line">
  10. <div class="stat-entry" :data-tooltip="stat" v-for="stat in Object.keys(subject.stats)" v-bind:key="stat"><i :class="statIcons[stat]" /> {{subject.stats[stat]}}</div>
  11. </div>
  12. <br>
  13. <div class="stat-line">
  14. <div class="stat-entry" data-tooltip="Bulk"><i class="fas fa-weight-hanging" /> {{subject.bulk}}</div>
  15. <div class="stat-entry" data-tooltip="Prey Count"><i class="fas fa-utensils" /> {{ subject.containers.reduce((total, container) => total + container.contents.length, 0) }} </div>
  16. </div>
  17. <br>
  18. <div>Status: {{subject.status}}</div>
  19. <ContainerView v-for="container in subject.containers" :key="container.name.toString()" :container="container" />
  20. </div>
  21. </template>
  22. <script lang="ts">
  23. import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator'
  24. import { Creature, POV } from '@/game/entity'
  25. import { Stats, Stat, StatIcons, Vigor, VigorIcons } from '@/game/combat'
  26. import ContainerView from './ContainerView.vue'
  27. @Component({
  28. components: {
  29. ContainerView
  30. }
  31. })
  32. export default class Statblock extends Vue {
  33. @Prop({ type: Creature, required: true })
  34. subject!: Creature
  35. private vigorIcons = VigorIcons
  36. private statIcons = StatIcons
  37. private vigor = Vigor
  38. firstperson: POV = POV.First
  39. constructor () {
  40. super()
  41. }
  42. }
  43. </script>
  44. <!-- Add "scoped" attribute to limit CSS to this component only -->
  45. <style scoped>
  46. h2 {
  47. margin-bottom: 16pt;
  48. font-size: 200%;
  49. }
  50. ul {
  51. list-style-type: none;
  52. padding: 0;
  53. }
  54. li {
  55. display: inline-block;
  56. margin: 0 10px;
  57. }
  58. a {
  59. color: #42b983;
  60. }
  61. .statblock {
  62. margin: 16px;
  63. }
  64. .stat-line {
  65. width: 100%;
  66. display: flex;
  67. justify-content: space-around;
  68. flex-wrap: wrap;
  69. }
  70. .stat-entry {
  71. position: relative;
  72. font-size: 2vh;
  73. padding-top: 4pt;
  74. padding-bottom: 4pt;
  75. display: flex;
  76. flex-direction: column;
  77. justify-content: space-evenly;
  78. user-select: none;
  79. }
  80. .stat-entry::after {
  81. opacity: 0;
  82. position: absolute;
  83. color: #eee;
  84. font-size: 0pt;
  85. content: attr(data-tooltip);
  86. transition: 0.1s;
  87. pointer-events: none;
  88. left: 0pt;
  89. top: 0pt;
  90. transform: translate(calc(-50% + 16pt), -100%);
  91. background: #555;
  92. padding: 8pt;
  93. border-radius: 8pt;
  94. }
  95. .stat-entry:hover::after {
  96. font-size: 18pt;
  97. opacity: 1;
  98. }
  99. </style>