private AdaptiveCostEffect(AdaptiveCostEffect prototype, IPlayable owner) { if (!(owner is Playable p)) { throw new Exception($"Can't activate {this} to non-playable {owner}"); } _owner = p; if (prototype._triggerType != TriggerType.NONE) { _value = prototype._value; _triggerType = prototype._triggerType; _triggerSource = prototype._triggerSource; _condition = prototype._condition; _updateHandler = Trigger; _removedHandler = RemoveAtEnd; _isTriggered = prototype._isTriggered; _isAppliedThisTurn = prototype._isAppliedThisTurn; } else { _costFunction = prototype._costFunction; } }
private AdaptiveCostEffectObsolete(AdaptiveCostEffectObsolete prototype, IPlayable owner) { if (!(owner is Playable p)) { throw new Exception($"Can't activate {this} to non-playable {owner}"); } _owner = p; _costFunction = prototype._costFunction; _value = prototype._value; _triggerType = prototype._triggerType; _triggerSource = prototype._triggerSource; _condition = prototype._condition; _updateHandler = Trigger; _removedHandler = RemoveAtEnd; _isTriggered = prototype._isTriggered; _isAppliedThisTurn = prototype._isAppliedThisTurn; if (prototype._initialisationFunction != null) { _initialisationFunction = prototype._initialisationFunction; _cachedValue = prototype._initialisationFunction.Invoke(p); } }
protected SwitchingAura(SwitchingAura prototype, IPlayable owner) : base(prototype, owner) { _initialisationCondtion = prototype._initialisationCondtion; _offTrigger = prototype._offTrigger; _offHandler = TurnOff; _onHandler = TurnOn; }
private AdaptiveCostEffect(AdaptiveCostEffect prototype, IPlayable owner) { if (!(owner is Playable p)) { throw new Exception($"Can't activate {this} to non-playable {owner}"); } _owner = p; _type = prototype._type; switch (_type) { case Type.Variable: _costFunction = prototype._costFunction; _operator = prototype._operator; _condition = prototype._condition; return; case Type.Triggered: _value = prototype._value; _triggerType = prototype._triggerType; _triggerSource = prototype._triggerSource; _condition = prototype._condition; break; case Type.TriggeredWithInitialisation: _initialisationFunction = prototype._initialisationFunction; _cachedValue = _initialisationFunction(p); _costFunction = prototype._costFunction; _triggerType = prototype._triggerType; _triggerSource = prototype._triggerSource; _condition = prototype._condition; break; default: throw new ArgumentOutOfRangeException(); } _updateHandler = Trigger; _removedHandler = RemoveAtEnd; _isTriggered = prototype._isTriggered; _isAppliedThisTurn = prototype._isAppliedThisTurn; }
protected Trigger(Trigger prototype, IEntity owner) { Game = owner.Game; _sourceId = owner.Id; _owner = (IPlayable)owner; _triggerType = prototype._triggerType; _sequenceType = prototype._sequenceType; TriggerSource = prototype.TriggerSource; Condition = prototype.Condition; SingleTask = prototype.SingleTask; if (SingleTask != null) { SingleTask.IsTrigger = true; } EitherTurn = prototype.EitherTurn; FastExecution = prototype.FastExecution; RemoveAfterTriggered = prototype.RemoveAfterTriggered; _isSecret = prototype.Game == null ? owner.Card.IsSecret : prototype._isSecret; IsAncillaryTrigger = prototype.IsAncillaryTrigger; _processHandler = Process; }