/// <summary> /// Apply a addition to an actor /// </summary> /// <param name="actor">Actor which the addition should be applied to</param> /// <param name="addition">Addition to be applied</param> public static void ApplyAddition(Actor actor, Addition addition) { if (actor.BattleStatus.Additions.ContainsKey(addition.Name)) { Addition oldaddition = actor.BattleStatus.Additions[addition.Name]; if (oldaddition.Activated) { oldaddition.AdditionEnd(); } if (addition.IfActivate) { addition.AdditionStart(); addition.StartTime = DateTime.Now; addition.Activated = true; } actor.BattleStatus.Additions.Remove(addition.Name); actor.BattleStatus.Additions.Add(addition.Name, addition); } else { if (addition.IfActivate) { addition.AdditionStart(); addition.StartTime = DateTime.Now; addition.Activated = true; } actor.BattleStatus.Additions.Add(addition.Name, addition); } }
public static void RemoveAddition(Actor actor, Addition addition, bool removeOnly) { if (actor.BattleStatus.Additions.ContainsKey(addition.Name)) { actor.BattleStatus.Additions.Remove(addition.Name); if (addition.Activated && !removeOnly) { addition.AdditionEnd(); } addition.Activated = false; } }