Exemplo n.º 1
0
 @Override
 public void addWatcher(Watcher watcher) {
   if (watchers == null) {
     watchers = new ArrayList<>();
   }
   watcher.setSourceId(this.sourceId);
   watcher.setControllerId(this.controllerId);
   watchers.add(watcher);
 }
Exemplo n.º 2
0
 @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;
 }
Exemplo n.º 3
0
 @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;
 }
Exemplo n.º 4
0
 @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);
     }
   }
 }
Exemplo n.º 5
0
 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());
   }
 }
Exemplo n.º 6
0
 @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);
     }
   }
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 @Override
 public void reset() {
   super.reset();
   spells.clear();
 }
Exemplo n.º 9
0
 @Override
 public boolean isAvailable(Game game, Ability source) {
   Watcher watcher =
       game.getState().getWatchers().get("CreatureSpellCountered", source.getControllerId());
   return watcher != null && watcher.conditionMet();
 }
Exemplo n.º 10
0
 @Override
 public void reset() {
   super.reset();
   damagingObjects.clear();
   damagedObjects.clear();
 }
Exemplo n.º 11
0
 @Override
 public void reset() {
   super.reset();
   damageSources.clear();
 }
Exemplo n.º 12
0
 @Override
 public void reset() {
   super.reset();
   creaturesCount = 0;
 }