public void ChangeZone(IZone destination, Action <Card> add) { var source = _zone.Value; Asrt.False(destination == source, "Cannot change zones, when source zone and destination zone are the same."); source.Remove(this); _zone.Value = destination; add(this); if (destination.Name != source.Name) { if (destination.Name == Zone.Battlefield) { HasSummoningSickness = true; JoinedBattlefield.Raise(); } // if card goes to library and it is not hidden, change its default zone visibility if (destination.Name == Zone.Library && !_isHidden) { if (source.Name == Zone.Hand) { Peek(true); } else if (source.Name == Zone.Battlefield || source.Name == Zone.Graveyard || source.Name == Zone.Exile) { Reveal(true); } } if (destination.Name == Zone.Hand && !_isHidden) { if (source.Name == Zone.Battlefield || source.Name == Zone.Graveyard || source.Name == Zone.Exile) { Reveal(true); } } Publish(new ZoneChangedEvent(this, source.Name, destination.Name)); if (source.Name == Zone.Battlefield) { Combat.Remove(this); DetachAttachments(); Detach(); Untap(); ClearDamage(); HasSummoningSickness = false; LeftBattlefield.Raise(); } } }
public void OnCardLeftBattlefield() { Combat.Remove(this); DetachAttachments(); Detach(); Untap(); ClearDamage(); HasSummoningSickness = false; LeftBattlefield.Raise(); }
private void UpdateValue() { var oldValue = _currentValue.Value; var newValue = _baseValue.Value; foreach (var modifier in _modifiers.OrderBy(x => x.Priority)) { newValue = modifier.Apply(newValue); } if (!oldValue.Equals(newValue)) { Value = newValue; Changed.Raise(new CharacteristicChangedParams <T>(oldValue, newValue)); OnCharacteristicChanged(oldValue, newValue); } }
protected void NotifyModifierHasChanged() { Changed.Raise(); }
protected void End() { Ended.Raise(); }
private void OnParametersChanged(CharacteristicChangedParams <CardParameters> p) { Changed.Raise(); }
public void OnCardJoinedBattlefield() { HasSummoningSickness = true; JoinedBattlefield.Raise(); }