@Override public void addWatcher(Watcher watcher) { if (watchers == null) { watchers = new ArrayList<>(); } watcher.setSourceId(this.sourceId); watcher.setControllerId(this.controllerId); watchers.add(watcher); }
@Override public boolean isAvailable(Game game, Ability source) { Watcher watcher = game.getState() .getWatchers() .get("noncreature permanent destroyed", source.getControllerId()); if (watcher != null && watcher.conditionMet()) { return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { Watcher watcher = game.getState().getWatchers().get("CastCreature", source.getSourceId()); if (watcher != null && !watcher.conditionMet()) { return true; } } return false; }
@Override public void setControllerId(UUID controllerId) { this.controllerId = controllerId; if (watchers != null) { for (Watcher watcher : watchers) { watcher.setControllerId(controllerId); } } if (subAbilities != null) { for (Ability subAbility : subAbilities) { subAbility.setControllerId(controllerId); } } }
public void addCard(Card card) { setZone(card.getId(), Zone.OUTSIDE); for (Watcher watcher : card.getWatchers()) { watcher.setControllerId(card.getOwnerId()); watcher.setSourceId(card.getId()); watchers.add(watcher); } for (Ability ability : card.getAbilities()) { addAbility(ability, card); } if (card.isSplitCard()) { addCard(((SplitCard) card).getLeftHalfCard()); addCard(((SplitCard) card).getRightHalfCard()); } }
@Override public void setSourceId(UUID sourceId) { if (this.sourceId == null) { this.sourceId = sourceId; } else if (!(this instanceof MageSingleton)) { this.sourceId = sourceId; } if (subAbilities != null) { for (Ability subAbility : subAbilities) { subAbility.setSourceId(sourceId); } } if (watchers != null) { for (Watcher watcher : watchers) { watcher.setSourceId(sourceId); } } }
public AbilityImpl(final AbilityImpl ability) { this.id = ability.id; this.originalId = ability.originalId; this.abilityType = ability.abilityType; this.controllerId = ability.controllerId; this.sourceId = ability.sourceId; this.zone = ability.zone; this.name = ability.name; this.usesStack = ability.usesStack; this.manaCosts = ability.manaCosts; this.manaCostsToPay = ability.manaCostsToPay.copy(); this.costs = ability.costs.copy(); this.optionalCosts = ability.optionalCosts.copy(); if (ability.watchers != null) { this.watchers = new ArrayList<>(); for (Watcher watcher : ability.watchers) { watchers.add(watcher.copy()); } } if (ability.subAbilities != null) { this.subAbilities = new ArrayList<>(); for (Ability subAbility : ability.subAbilities) { subAbilities.add(subAbility.copy()); } } this.modes = ability.getModes().copy(); this.ruleAtTheTop = ability.ruleAtTheTop; this.ruleVisible = ability.ruleVisible; this.ruleAdditionalCostsVisible = ability.ruleAdditionalCostsVisible; this.costModificationActive = ability.costModificationActive; this.worksFaceDown = ability.worksFaceDown; this.abilityWord = ability.abilityWord; this.sourceObject = ability.sourceObject; this.sourceObjectZoneChangeCounter = ability.sourceObjectZoneChangeCounter; this.canFizzle = ability.canFizzle; }
@Override public void reset() { super.reset(); spells.clear(); }
@Override public boolean isAvailable(Game game, Ability source) { Watcher watcher = game.getState().getWatchers().get("CreatureSpellCountered", source.getControllerId()); return watcher != null && watcher.conditionMet(); }
@Override public void reset() { super.reset(); damagingObjects.clear(); damagedObjects.clear(); }
@Override public void reset() { super.reset(); damageSources.clear(); }
@Override public void reset() { super.reset(); creaturesCount = 0; }