@Override public void removeAllAbilities(UUID sourceId, Game game) { getAbilities().clear(); }
@Override public boolean hasProtectionFrom(MageObject source, Game game) { for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) { if (!ability.canTarget(source, game)) { return true; } } return false; }
@Override public boolean checkControlChanged(Game game) { if (!controllerId.equals(beforeResetControllerId)) { this.removeFromCombat(game); this.controlledFromStartOfControllerTurn = false; this.getAbilities(game).setControllerId(controllerId); game.getContinuousEffects().setController(objectId, controllerId); // the controller of triggered abilites is always set/checked before the abilities triggers so not needed here game.fireEvent(new GameEvent(EventType.LOST_CONTROL, objectId, objectId, beforeResetControllerId)); game.fireEvent(new GameEvent(EventType.GAINED_CONTROL, objectId, objectId, controllerId)); return true; } else if (isCopy()) {// Because the previous copied abilities can be from another controller chnage controller in any case for abilities this.getAbilities(game).setControllerId(controllerId); game.getContinuousEffects().setController(objectId, controllerId); } return false; }
@Override public boolean cantBeAttachedBy(MageObject source, Game game) { for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) { if (!(source.hasSubtype(SubType.AURA, game) && !ability.removesAuras()) && !source.getId().equals(ability.getAuraIdNotToBeRemoved()) && !ability.canTarget(source, game)) { return true; } } return game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(EventType.STAY_ATTACHED, objectId, source.getId(), null), null, game, false); }
for (Ability ability : this.getAbilities()) { for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext(); ) { ContinuousEffect effect = (ContinuousEffect) ite.next();