spell-table.component.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <div class="spell-box">
  2. <div class="heading-list">
  3. <div>{{ "spells.header.cost" | translate }}</div>
  4. <div>{{ "spells.header.name" | translate }}</div>
  5. <div>{{ "spells.header.level" | translate }}</div>
  6. <div>{{ "spells.header.bonus" | translate }}</div>
  7. <div>{{ "spells.header.effect" | translate }}</div>
  8. <div>{{ "spells.header.range" | translate }}</div>
  9. </div>
  10. <div
  11. id="spells-table"
  12. cdkDropList
  13. class="item-list table-content"
  14. (cdkDropListDropped)="dropSpells($event)"
  15. >
  16. @for (spell of spells; let index = $index; track spell) {
  17. <div class="item" cdkDrag (click)="showFullSpellcard(index)">
  18. <!-- Range Icon -->
  19. <ng-container
  20. [ngTemplateOutlet]="costTemplate"
  21. [ngTemplateOutletContext]="{ spell: spell }"
  22. ></ng-container>
  23. <div class="vertical-line"></div>
  24. <!-- Name -->
  25. <ng-container
  26. [ngTemplateOutlet]="spellNameTemplate"
  27. [ngTemplateOutletContext]="{ spell: spell }"
  28. ></ng-container>
  29. <div class="vertical-line"></div>
  30. <!-- Level -->
  31. <ng-container
  32. [ngTemplateOutlet]="spellLevelTemplate"
  33. [ngTemplateOutletContext]="{ spell: spell }"
  34. ></ng-container>
  35. <div class="vertical-line"></div>
  36. <!-- Attack -->
  37. <ng-container
  38. [ngTemplateOutlet]="spellAttackTemplate"
  39. [ngTemplateOutletContext]="{ spell: spell }"
  40. ></ng-container>
  41. <div class="vertical-line"></div>
  42. <!-- Damage/Heal -->
  43. <ng-container
  44. [ngTemplateOutlet]="spellDamageTemplate"
  45. [ngTemplateOutletContext]="{ spell: spell }"
  46. ></ng-container>
  47. <div class="vertical-line"></div>
  48. <!-- Range -->
  49. <ng-container
  50. [ngTemplateOutlet]="spellRangeTemplate"
  51. [ngTemplateOutletContext]="{ spell: spell }"
  52. ></ng-container>
  53. </div>
  54. } @empty {
  55. <div
  56. style="
  57. text-align: center;
  58. margin-top: 3rem;
  59. font-size: 1.25rem;
  60. font-weight: 500;
  61. "
  62. >
  63. {{ "spells.empty" | translate }}
  64. </div>
  65. }
  66. </div>
  67. <div class="footer">
  68. <ui-button
  69. [color]="'green'"
  70. [type]="'edit'"
  71. style="width: 80%"
  72. (click)="openModal()"
  73. >
  74. </ui-button>
  75. </div>
  76. <!-- Templates -->
  77. <!-- COST -->
  78. <ng-template #costTemplate let-spell="spell">
  79. <div class="bold">
  80. <span *ngIf="spell.cost === 'action'">A</span>
  81. <span *ngIf="spell.cost === 'bonus'">B</span>
  82. <span *ngIf="spell.cost === 'reaction'">R</span>
  83. </div>
  84. </ng-template>
  85. <!-- NAME -->
  86. <ng-template #spellNameTemplate let-spell="spell">
  87. <div>
  88. <div class="bold">
  89. @if (translate.getDefaultLang() == "de") {
  90. {{ spell.german }}
  91. } @else {
  92. {{ spell.english }}
  93. }
  94. </div>
  95. <div class="bold small">
  96. <span *ngIf="spell.needsConcentration"
  97. >{{ "spells.concentrationAbbr" | translate }} |
  98. </span>
  99. <span *ngIf="spell.needsVerbal"
  100. >{{ "spells.components.verbal" | translate }}
  101. </span>
  102. <span *ngIf="spell.needsSomatic"
  103. >{{ "spells.components.somatic" | translate }}
  104. </span>
  105. <span *ngIf="spell.needsMaterial"
  106. >{{ "spells.components.material" | translate }}
  107. </span>
  108. <div></div>
  109. </div>
  110. </div>
  111. </ng-template>
  112. <!-- Level -->
  113. <ng-template #spellLevelTemplate let-spell="spell">
  114. <div *ngIf="spell.level !== 0" class="bold">{{ spell.level }}</div>
  115. <div *ngIf="spell.level === 0" class="bold">
  116. {{ "spells.cantrip" | translate }}
  117. </div>
  118. </ng-template>
  119. <!-- Attack -->
  120. <ng-template #spellAttackTemplate let-spell="spell">
  121. <div>
  122. <div *ngIf="spell.needsSavingThrow">
  123. <div>
  124. {{
  125. "attributesAbbreviations." + spell.savingThrowAttribute | translate
  126. }}
  127. </div>
  128. <div>{{ spellSaveDC }}</div>
  129. </div>
  130. <div *ngIf="spell.needsAttackRoll">
  131. <div>{{ spellAttackBonus }}</div>
  132. </div>
  133. <div *ngIf="!spell.needsSavingThrow && !spell.needsAttackRoll">-</div>
  134. </div>
  135. </ng-template>
  136. <!-- Damage/Heal -->
  137. <ng-template #spellDamageTemplate let-spell="spell">
  138. <div>
  139. @if (spell.doesDamage) {
  140. <div *ngFor="let damage of spell.damage; let index = index">
  141. <span>
  142. {{ damage.diceNumber }}
  143. {{ "general.dice" | translate }}{{ damage.diceType }}
  144. </span>
  145. <span>
  146. <icon
  147. [size]="'m'"
  148. [type]="'damage'"
  149. [icon]="damage.damageType"
  150. ></icon>
  151. </span>
  152. </div>
  153. }
  154. @if (spell.doesHeal) {
  155. <div class="heal">
  156. <span
  157. >{{ spell.heal.diceNumber }} {{ "general.dice" | translate
  158. }}{{ spell.heal.diceType }}
  159. </span>
  160. <span *ngIf="spell.heal.additionalHeal"
  161. >+{{ spell.heal.additionalHeal }}
  162. </span>
  163. <span>
  164. <icon [size]="'xs'" [type]="'damage'" [icon]="'heal'"></icon>
  165. </span>
  166. </div>
  167. }
  168. </div>
  169. </ng-template>
  170. <!-- Range -->
  171. <ng-template #spellRangeTemplate let-spell="spell">
  172. <div class="spell-range">
  173. <div *ngIf="spell.isRanged">{{ spell.range }} ft.</div>
  174. <div *ngIf="!spell.isRanged">{{ "spells.touch" | translate }}</div>
  175. <div *ngIf="spell.hasAreaOfEffect">
  176. <span
  177. >{{ spell.radius }} ft.
  178. {{ "areaTypes." + spell.areaOfEffectType | translate }}</span
  179. >
  180. </div>
  181. </div>
  182. </ng-template>
  183. </div>