spell-table.component.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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 style="width: 60%" (click)="openModal()"
  69. >{{ "buttons.edit" | translate }}
  70. </ui-button>
  71. </div>
  72. <!-- Templates -->
  73. <!-- COST -->
  74. <ng-template #costTemplate let-spell="spell">
  75. <div class="bold">
  76. @if (spell.cost === "action") {
  77. <span>A</span>
  78. } @else if (spell.cost === "bonus") {
  79. <span>B</span>
  80. } @else if (spell.cost === "reaction") {
  81. <span>R</span>
  82. } @else {
  83. <img src="assets/icons/UIIcons/time.svg" alt="time" />
  84. }
  85. </div>
  86. </ng-template>
  87. <!-- NAME -->
  88. <ng-template #spellNameTemplate let-spell="spell">
  89. <div>
  90. <div class="bold">
  91. @if (translate.getDefaultLang() == "de") {
  92. {{ spell.german }}
  93. } @else {
  94. {{ spell.english }}
  95. }
  96. </div>
  97. <div class="bold small">
  98. @if (spell.needsConcentration) {
  99. <span>{{ "spells.concentrationAbbr" | translate }} | </span>
  100. }
  101. @if (spell.needsVerbal) {
  102. <span>{{ "spells.components.verbal" | translate }} </span>
  103. }
  104. @if (spell.needsSomatic) {
  105. <span>{{ "spells.components.somatic" | translate }} </span>
  106. }
  107. @if (spell.needsMaterial) {
  108. <span>{{ "spells.components.material" | translate }} </span>
  109. }
  110. <div></div>
  111. </div>
  112. </div>
  113. </ng-template>
  114. <!-- Level -->
  115. <ng-template #spellLevelTemplate let-spell="spell">
  116. @if (spell.level !== 0) {
  117. <div class="bold">{{ spell.level }}</div>
  118. }
  119. @if (spell.level === 0) {
  120. <div class="bold">
  121. {{ "spells.cantrip" | translate }}
  122. </div>
  123. }
  124. </ng-template>
  125. <!-- Attack -->
  126. <ng-template #spellAttackTemplate let-spell="spell">
  127. <div>
  128. @if (spell.needsSavingThrow) {
  129. <div>
  130. <div>
  131. {{
  132. "attributesAbbreviations." + spell.savingThrowAttribute
  133. | translate
  134. }}
  135. </div>
  136. <div>{{ utils.spellSaveDC }}</div>
  137. </div>
  138. } @else if (spell.needsAttackRoll) {
  139. <div>
  140. <div>{{ utils.spellAttackModifier }}</div>
  141. </div>
  142. } @else {
  143. <div>-</div>
  144. }
  145. </div>
  146. </ng-template>
  147. <!-- Damage/Heal -->
  148. <ng-template #spellDamageTemplate let-spell="spell">
  149. <div>
  150. @if (spell.doesDamage) {
  151. @for (damage of spell.damage; track damage; let index = $index) {
  152. <div>
  153. <span>
  154. {{ damage.diceNumber }}
  155. {{ "general.dice" | translate }}{{ damage.diceType }}
  156. </span>
  157. <span>
  158. <icon
  159. [size]="'xs'"
  160. [type]="'damage'"
  161. [icon]="damage.damageType"
  162. ></icon>
  163. </span>
  164. </div>
  165. }
  166. } @else if (spell.doesHeal) {
  167. <div class="heal">
  168. <span
  169. >{{ spell.heal.diceNumber }} {{ "general.dice" | translate
  170. }}{{ spell.heal.diceType }}
  171. </span>
  172. @if (spell.heal.additionalHeal) {
  173. <span>+{{ spell.heal.additionalHeal }} </span>
  174. }
  175. <span>
  176. <icon [size]="'xs'" [type]="'damage'" [icon]="'heal'"></icon>
  177. </span>
  178. </div>
  179. } @else {
  180. <div>-</div>
  181. }
  182. </div>
  183. </ng-template>
  184. <!-- Range -->
  185. <ng-template #spellRangeTemplate let-spell="spell">
  186. <div class="spell-range">
  187. @if (spell.isRanged) {
  188. <div>{{ spell.range }} ft.</div>
  189. } @else if (spell.range === 0) {
  190. <div>
  191. {{ "spells.self" | translate }}
  192. </div>
  193. } @else if (spell.range === 5) {
  194. <div>
  195. {{ "spells.touch" | translate }}
  196. </div>
  197. }
  198. @if (spell.hasAreaOfEffect) {
  199. <div>
  200. <span
  201. >{{ spell.length }} ft.
  202. <img
  203. style="width: 1rem; height: 1rem; margin-left: 0.125rem"
  204. [src]="
  205. 'assets/icons/spellIcons/' + spell.areaOfEffectType + '.svg'
  206. "
  207. />
  208. </span>
  209. </div>
  210. }
  211. </div>
  212. </ng-template>
  213. </div>