Skip to content

Commit

Permalink
support scaling spell effect durations in the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Sep 5, 2024
1 parent 066cfb7 commit 75eefa8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 11 deletions.
5 changes: 5 additions & 0 deletions src/app/helpers/schemas/stem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isDamageType,
isPartialStatObject,
isPartialStatObjectFailure,
isStat,
isStringOrBoolean,
} from './_helpers';

Expand Down Expand Up @@ -52,6 +53,8 @@ export const stemSchema: Schema = [
['spell.spellMeta.doesOvertime', false, isBoolean],
['spell.spellMeta.extraAttackTrait', false, isString],
['spell.spellMeta.linkedEffectName', false, isString],
['spell.spellMeta.linkedEffectScaleDuration', false, isNumber],
['spell.spellMeta.linkedEffectScaleState', false, isStat],
['spell.spellMeta.noHostileTarget', false, isBoolean],
['spell.spellMeta.casterMessage', false, isString],
['spell.spellMeta.casterAttackMessage', false, isString],
Expand Down Expand Up @@ -92,6 +95,8 @@ export const stemSchema: Schema = [
['effect.effect', false, isObject],
['effect.effect.type', false, isString],
['effect.effect.duration', false, isNumber],
['effect.effect.durationScaleValue', false, isNumber],
['effect.effect.durationScaleStat', false, isStat],

['effect.effect.extra', false, isObject],
['effect.effect.extra.potency', false, isNumber],
Expand Down
4 changes: 3 additions & 1 deletion src/app/helpers/stem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BuffType, MacroActivationType } from '../../interfaces';
import { BuffType, MacroActivationType, Stat } from '../../interfaces';
import { ISTEM } from '../../interfaces/stem';
import { id } from './id';

Expand Down Expand Up @@ -31,6 +31,8 @@ export const defaultSTEM: () => ISTEM = () => {
effect: {
type: undefined as unknown as BuffType,
duration: 0,
durationScaleStat: Stat.INT,
durationScaleValue: 100,
extra: {
potency: 0,
canRemove: false,
Expand Down
38 changes: 29 additions & 9 deletions src/app/tabs/stems/stems-editor/stems-editor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@
</div>

<div class="form-column">
<div class="form-row">
<app-input-effect floatUi="Only set this if your spell effect is simple and has no tick effects."
[defaultValue]="editingData.spell.spellMeta.linkedEffectName"
(change)="editingData.spell.spellMeta.linkedEffectName = $event" label="Linked Effect"></app-input-effect>
</div>

<div class="form-row split">
<div class="form-column">
Expand Down Expand Up @@ -395,11 +400,6 @@
</div>

<div class="form-column">
<div class="form-row">
<app-input-effect floatUi="Only set this if your spell effect is simple and has no tick effects."
[defaultValue]="editingData.spell.spellMeta.linkedEffectName"
(change)="editingData.spell.spellMeta.linkedEffectName = $event" label="Linked Effect"></app-input-effect>
</div>

<div class="form-row">
<app-input-floating-label>Caster Message</app-input-floating-label>
Expand Down Expand Up @@ -728,12 +728,32 @@
(buffTypeChange)="changeBuffType($event)"></app-input-bufftype>
</div>

<div class="form-row">
<app-input-floating-label>Duration</app-input-floating-label>
<input [(ngModel)]="editingData.effect.effect.duration" type="number" min="0"
placeholder="Enter duration (ticks)..." class="form-input" />
<div class="form-row split">
<div class="form-column">
<div class="form-row">
<app-input-floating-label>Default Duration</app-input-floating-label>
<input [(ngModel)]="editingData.effect.effect.duration" type="number" min="0"
placeholder="Enter duration (ticks)..." class="form-input" />
</div>
</div>

<div class="form-column">
<div class="form-row">
<app-input-floating-label>Scale Duration</app-input-floating-label>
<input [(ngModel)]="editingData.effect.effect.durationScaleValue" type="number" min="0"
placeholder="Enter duration (ticks)..." class="form-input" />
</div>
</div>

<div class="form-column">
<div class="form-row">
<app-input-stat [(stat)]="editingData.effect.effect.durationScaleStat" [allowCore]="false"
label="Scale Stat"></app-input-stat>
</div>
</div>
</div>


<div class="form-row split">
<div class="form-column">
<div class="form-row">
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export interface IEffectTooltip {
export interface IEffectEffect {
type: BuffType;
duration: number;
durationScaleValue: number;
durationScaleStat: StatType;
extra: IStatusEffectInfo;
}

Expand Down
5 changes: 4 additions & 1 deletion src/interfaces/spell.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DamageClassType } from './building-blocks';
import { DamageClassType, StatType } from './building-blocks';

export interface ISpell {
spellName: string; // the name of the spell
Expand Down Expand Up @@ -29,6 +29,9 @@ export interface ISpell {
doesOvertime?: boolean; // if the spell has an over-time component, it is applied automatically
extraAttackTrait?: string; // if the spell doesAttack and can get bonus attack procs, this trait is what specifies how many
linkedEffectName?: string; // if the spell casts a simple effect, it can be linked and looked up so no extra effect data needs to exist
linkedEffectDefaultDuration?: number; // if the spell casts a simple effect, this is the default duration if there is no caster
linkedEffectScaleDuration?: number; // if the spell casts a simple effect, this is the scaled duration based on this * scaleStat
linkedEffectScaleStat?: StatType; // if the spell casts a simple effect, this is the stat used to scale the duration
noHostileTarget?: boolean; // if the spell heals or buffs, this is set to true so it can't hit enemies
casterMessage?: string; // if the spell sends a message to the caster, it sends this if the caster is NOT the target
casterAttackMessage?: string; // if the spell does an attack, this is the unformatted message to send to the caster
Expand Down

0 comments on commit 75eefa8

Please sign in to comment.