/// <summary> /// What happens at the start of the phase cycle /// </summary> public virtual void OnPhaseCycleStart() { TurnsUsed = 0; MaxTurns = BaseTurns; StatusEffect[] statuses = EntityProperties.GetStatuses(); for (int i = 0; i < statuses.Length; i++) { statuses[i].PhaseCycleStart(); } //Invoke the event PhaseCycleStartEvent?.Invoke(); }
/// <summary> /// What happens at the start of the phase cycle /// </summary> public virtual void OnPhaseCycleStart() { TurnsUsed = 0; MaxTurns = BaseTurns; //If the BattleEntity dies before the last Status Effect and clears all statuses, the ones that follow will have a null entity reference //Status Effects that alter turn count are unaffected, so if the BattleEntity gets revived with a Life Shroom it will still move this turn //This is how it works in TTYD. For our purposes, simply break when encountering a null reference to replicate this behavior StatusEffect[] statuses = EntityProperties.GetStatuses(); for (int i = 0; i < statuses.Length; i++) { //Break on null; this indicates the BattleEntity died and all Status Effects on it were removed partway into this loop if (statuses[i].EntityAfflicted == null) { break; } statuses[i].PhaseCycleStart(); } //Invoke the event PhaseCycleStartEvent?.Invoke(); }