|
@@ -1,6 +1,7 @@
|
|
|
import { Component, EventEmitter, Output } from '@angular/core';
|
|
|
import { NgxSmartModalService } from 'ngx-smart-modal';
|
|
|
import { Damage } from 'src/interfaces/damage';
|
|
|
+import { Heal } from 'src/interfaces/heal';
|
|
|
import { Spell } from 'src/interfaces/spell';
|
|
|
|
|
|
@Component({
|
|
@@ -27,22 +28,27 @@ export class SpellModalComponent {
|
|
|
public newSpellNeedsVerbal: boolean = false;
|
|
|
public newSpellNeedsSomatic: boolean = false;
|
|
|
public newSpellNeedsMaterial: boolean = false;
|
|
|
- public newSpellSchool: string | undefined;
|
|
|
- public newSpellDescription: string | undefined;
|
|
|
+ public newSpellSchool: string = '';
|
|
|
+ public newSpellDescription: string = '';
|
|
|
public newSpellDoesDamage: boolean = true;
|
|
|
public newSpellDoesHeal: boolean = false;
|
|
|
- public newSpellHasOtherEffect: boolean = false;
|
|
|
-
|
|
|
+ public newSpellNeedsAttackRoll: boolean = false;
|
|
|
public newSpellNeedsSavingThrow: boolean = false;
|
|
|
public newSpellSavingThrowAttribute: string | undefined;
|
|
|
+ public newSpellNeedsAttackThrow: boolean = false;
|
|
|
+ public newSpellHeal: Heal = {
|
|
|
+ diceNumber: '',
|
|
|
+ diceType: '',
|
|
|
+ additionalHeal: 0,
|
|
|
+ };
|
|
|
public newSpellAttackBonus: string = '';
|
|
|
public newSpellDamage: Damage[] = [
|
|
|
{ diceNumber: '', diceType: '', damageType: '' },
|
|
|
];
|
|
|
public newSpellIsRanged: boolean = false;
|
|
|
- public newSpellRange: string = '5ft';
|
|
|
+ public newSpellRange: number = 5;
|
|
|
public newSpellHasAreaOfEffect: boolean = false;
|
|
|
- public newSpellRadius: string | undefined;
|
|
|
+ public newSpellRadius: number | undefined;
|
|
|
public newSpellAreaOfEffectType: string | undefined;
|
|
|
|
|
|
public isUpdate: boolean = false;
|
|
@@ -126,13 +132,15 @@ export class SpellModalComponent {
|
|
|
needsVerbal: this.newSpellNeedsVerbal,
|
|
|
needsSomatic: this.newSpellNeedsSomatic,
|
|
|
needsMaterial: this.newSpellNeedsMaterial,
|
|
|
+ needsAttackRoll: this.newSpellNeedsAttackRoll,
|
|
|
needsSavingThrow: this.newSpellNeedsSavingThrow,
|
|
|
isRanged: this.newSpellIsRanged,
|
|
|
range: this.newSpellRange,
|
|
|
hasAreaOfEffect: this.newSpellHasAreaOfEffect,
|
|
|
doesDamage: this.newSpellDoesDamage,
|
|
|
doesHeal: this.newSpellDoesHeal,
|
|
|
- hasOtherEffect: this.newSpellHasOtherEffect,
|
|
|
+ description: this.newSpellDescription,
|
|
|
+ school: this.newSpellSchool,
|
|
|
};
|
|
|
if (this.newSpellDescription) {
|
|
|
newspell.description = this.newSpellDescription;
|
|
@@ -173,17 +181,18 @@ export class SpellModalComponent {
|
|
|
this.newSpellNeedsVerbal = false;
|
|
|
this.newSpellNeedsSomatic = false;
|
|
|
this.newSpellNeedsMaterial = false;
|
|
|
- this.newSpellSchool = undefined;
|
|
|
- this.newSpellDescription = undefined;
|
|
|
+ this.newSpellSchool = '';
|
|
|
+ this.newSpellDescription = '';
|
|
|
+ this.newSpellNeedsAttackRoll = false;
|
|
|
this.newSpellNeedsSavingThrow = false;
|
|
|
this.newSpellSavingThrowAttribute = undefined;
|
|
|
this.newSpellDoesDamage = false;
|
|
|
this.newSpellDoesHeal = false;
|
|
|
- this.newSpellHasOtherEffect = false;
|
|
|
+ this.newSpellHeal = { diceNumber: '', diceType: '' };
|
|
|
this.newSpellAttackBonus = '';
|
|
|
this.newSpellDamage = [{ diceNumber: '', diceType: '', damageType: '' }];
|
|
|
this.newSpellIsRanged = false;
|
|
|
- this.newSpellRange = '5ft';
|
|
|
+ this.newSpellRange = 5;
|
|
|
this.newSpellHasAreaOfEffect = false;
|
|
|
this.newSpellRadius = undefined;
|
|
|
this.newSpellAreaOfEffectType = undefined;
|
|
@@ -208,9 +217,9 @@ export class SpellModalComponent {
|
|
|
this.newSpellNeedsMaterial = spell.needsMaterial;
|
|
|
this.newSpellSchool = spell.school;
|
|
|
this.newSpellDescription = spell.description;
|
|
|
+ this.newSpellDoesDamage = spell.doesDamage;
|
|
|
this.newSpellNeedsSavingThrow = spell.needsSavingThrow;
|
|
|
this.newSpellSavingThrowAttribute = spell.savingThrowAttribute;
|
|
|
- this.newSpellAttackBonus = spell.attackBonus;
|
|
|
this.newSpellDamage = spell.damage;
|
|
|
this.newSpellIsRanged = spell.isRanged;
|
|
|
this.newSpellRange = spell.range;
|
|
@@ -222,6 +231,7 @@ export class SpellModalComponent {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // überarbeiten
|
|
|
public updateSpell(): void {
|
|
|
const newspell: Spell = {
|
|
|
name: this.newSpellName,
|
|
@@ -229,36 +239,30 @@ export class SpellModalComponent {
|
|
|
level: this.newSpellLevel,
|
|
|
cost: this.newSpellCost,
|
|
|
canRitual: this.newSpellCanRitual,
|
|
|
+ school: this.newSpellSchool,
|
|
|
+ description: this.newSpellDescription,
|
|
|
needsConcentration: this.newSpellNeedsConcentration,
|
|
|
needsVerbal: this.newSpellNeedsVerbal,
|
|
|
needsSomatic: this.newSpellNeedsSomatic,
|
|
|
needsMaterial: this.newSpellNeedsMaterial,
|
|
|
+ needsAttackRoll: this.newSpellNeedsAttackRoll,
|
|
|
needsSavingThrow: this.newSpellNeedsSavingThrow,
|
|
|
isRanged: this.newSpellIsRanged,
|
|
|
range: this.newSpellRange,
|
|
|
hasAreaOfEffect: this.newSpellHasAreaOfEffect,
|
|
|
doesDamage: this.newSpellDoesDamage,
|
|
|
doesHeal: this.newSpellDoesHeal,
|
|
|
- hasOtherEffect: this.newSpellHasOtherEffect,
|
|
|
};
|
|
|
- if (this.newSpellDescription) {
|
|
|
- newspell.description = this.newSpellDescription;
|
|
|
- }
|
|
|
- if (this.newSpellSchool) {
|
|
|
- newspell.school = this.newSpellSchool;
|
|
|
- }
|
|
|
- if (this.newSpellSavingThrowAttribute) {
|
|
|
+ if (this.newSpellNeedsSavingThrow) {
|
|
|
newspell.savingThrowAttribute = this.newSpellSavingThrowAttribute;
|
|
|
}
|
|
|
- if (this.newSpellAttackBonus) {
|
|
|
- newspell.attackBonus = this.newSpellAttackBonus;
|
|
|
- }
|
|
|
if (this.newSpellHasAreaOfEffect) {
|
|
|
newspell.radius = this.newSpellRadius;
|
|
|
- }
|
|
|
- if (this.newSpellHasAreaOfEffect) {
|
|
|
newspell.areaOfEffectType = this.newSpellAreaOfEffectType;
|
|
|
}
|
|
|
+ if (this.newSpellDoesHeal) {
|
|
|
+ newspell.healAmount = this.newSpellHeal;
|
|
|
+ }
|
|
|
this.spellUpdated.emit({ spell: newspell, index: this.indexForUpdate });
|
|
|
this.ngxSmartModalService.closeLatestModal();
|
|
|
this.removeData();
|