internal static IEffect Attack_N(int n) { return(ATK.Effect(EffectOperator.ADD, n)); }
internal static IEffect SetAttack(int n) { return(ATK.Effect(EffectOperator.SET, n)); }
public void Update() { if (_on) { int value; if (_isSwitching) { value = _condition.Eval(_owner) ? 1 : 0; if (value == _lastValue) { return; } if (_tag == GameTag.ATK) { ATK.Effect(_operator, _lastValue).RemoveFrom(_owner); ATK.Effect(_operator, value).ApplyTo(_owner); } else { new Effect(_tag, _operator, _lastValue).RemoveFrom(_owner); new Effect(_tag, _operator, value).ApplyTo(_owner); } } else { value = _valueFunction(_owner); if (_tag == GameTag.ATK) { if (!(_owner is Character c)) { if (_owner is Weapon) { c = _owner.Controller.Hero; } else { throw new Exception($"Can't apply ATK aura {this} to entity {_owner}"); } } if (_operator == EffectOperator.SET) { c._modifiedATK = 0; ATK.Effect(EffectOperator.ADD, _lastValue).RemoveAuraFrom(c); value = value - (c.AuraEffects?.ATK ?? 0); ATK.Effect(EffectOperator.ADD, value).ApplyAuraTo(c); } else { ATK.Effect(_operator, _lastValue).RemoveAuraFrom(c); ATK.Effect(_operator, value).ApplyAuraTo(c); } } else { new Effect(_tag, _operator, _lastValue).RemoveAuraFrom(_owner); new Effect(_tag, _operator, value).ApplyAuraTo(_owner); } } _lastValue = value; } else { if (_isSwitching) { if (_tag == GameTag.ATK) { ATK.Effect(_operator, _lastValue).RemoveFrom(_owner); } else { new Effect(_tag, _operator, _lastValue).RemoveFrom(_owner); } } else { if (_tag == GameTag.ATK) { ATK.Effect(_operator, _lastValue).RemoveAuraFrom(_owner is Weapon ? _owner.Controller.Hero : _owner); } else { new Effect(_tag, _operator, _lastValue).RemoveAuraFrom(_owner); } } _owner.Game.Auras.Remove(this); } }