public SetCardValueModifier(CardEntity cardToSetValue, ICardBehavior behaviorFrom, int value) { this.CardToSetValue = cardToSetValue; this.BehaviorFrom = behaviorFrom; this.Value = value; }
//public void RemoveValueModifier(AEntity entityFrom, int valueModifier) //{ // if (this.entityToValueModifier.ContainsKey(entityFrom)) // { // this.entityToValueModifier[entityFrom] -= valueModifier; // int currentValue = this.entityToValueModifier[entityFrom]; // if (currentValue <= 0) // { // this.entityToValueModifier.Remove(entityFrom); // currentValue = 0; // } // this.ValueModifier = currentValue; // this.ValueModifier -= valueModifier; // } //} public void ClearValueModifier(ICardBehavior behaviorFrom) { if (this.BehaviorToValueModifier.TryGetValue(behaviorFrom, out int value)) { this.ValueModifier -= value; this.BehaviorToValueModifier.Remove(behaviorFrom); } }
public AddCardValueModifier(CardEntity cardToAddValue, ICardBehavior behaviorFrom, int value, bool mustDeleteIfNull = false) { this.CardToAddValue = cardToAddValue; this.BehaviorFrom = behaviorFrom; this.Value = value; this.MustDeleteIfNull = mustDeleteIfNull; }
public void SetValueModifier(ICardBehavior behaviorFrom, int valueModifier) { int previousValue = 0; if (this.BehaviorToValueModifier.ContainsKey(behaviorFrom)) { previousValue = this.BehaviorToValueModifier[behaviorFrom]; this.BehaviorToValueModifier[behaviorFrom] = valueModifier; } else { this.BehaviorToValueModifier.Add(behaviorFrom, valueModifier); } this.ValueModifier += (valueModifier - previousValue); }
public void AddValueModifier(ICardBehavior behaviorFrom, int valueModifier, bool mustDeleteIfNull) { if (this.BehaviorToValueModifier.TryGetValue(behaviorFrom, out int value)) { value += valueModifier; this.BehaviorToValueModifier[behaviorFrom] = value; if (mustDeleteIfNull && value == 0) { this.BehaviorToValueModifier.Remove(behaviorFrom); } } else { this.BehaviorToValueModifier.Add(behaviorFrom, valueModifier); } this.ValueModifier += valueModifier; }
public ClearCardValueModifier(CardEntity cardToRemoveValue, ICardBehavior behaviorFrom) { this.CardToRemoveValue = cardToRemoveValue; this.BehaviorFrom = behaviorFrom; }