@Override public UUID getSourceId() { if (sourceObject != null) { return sourceObject.getId(); } return null; }
public UUID getSourceId() { if (sourceObject != null) { return sourceObject.getId(); } return null; }
@Override public UUID getSourceId() { if (sourceObject != null) { return sourceObject.getId(); } return null; }
@Override public boolean apply(MageObject input, Game game) { for (UUID uuid : cardsId) { if (uuid.equals(input.getId())) { return true; } } return false; }
@Override public boolean apply(MageObject input, Game game) { return input.getId().equals(cardId); }
public MageObjectReference(MageObject mageObject, Game game) { if (mageObject == null) { this.sourceId = null; this.zoneChangeCounter = -1; return; } this.sourceId = mageObject.getId(); this.zoneChangeCounter = mageObject.getZoneChangeCounter(game); }
private String getKey(TriggeredAbility ability, MageObject target) { String key = ability.getId() + "_"; if (target != null) { key += target.getId(); } return key; }
public boolean refersTo(MageObject mageObject, Game game) { if (mageObject != null) { if (mageObject instanceof Spell) { return ((Spell) mageObject).getSourceId().equals(sourceId) && this.zoneChangeCounter == mageObject.getZoneChangeCounter(game); } return mageObject.getId().equals(sourceId) && this.zoneChangeCounter == mageObject.getZoneChangeCounter(game); } return false; }
public ManaPoolItem(ConditionalMana conditionalMana, MageObject sourceObject, UUID originalId) { this.conditionalMana = conditionalMana; this.sourceObject = sourceObject; this.originalId = originalId; this.conditionalMana.setManaProducerId(sourceObject.getId()); this.conditionalMana.setManaProducerOriginalId(originalId); this.flag = conditionalMana.getFlag(); this.duration = Duration.EndOfStep; }
public static String getObjectZoneString(String text, MageObject mageObject, Game game) { int zoneChangeCounter = 0; if (mageObject instanceof Permanent) { zoneChangeCounter = mageObject.getZoneChangeCounter(game); } else if (mageObject instanceof Card) { zoneChangeCounter = mageObject.getZoneChangeCounter(game); } return getObjectZoneString(text, mageObject.getId(), game, zoneChangeCounter, false); }
@Override public boolean apply(Game game, Ability source) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null && game.getState().getValue(mageObject.getId() + "_toggle") != null) { return !((Boolean) game.getState().getValue(mageObject.getId() + "_toggle")); } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (!this.used && super.applies(event, source, game)) { MageObject mageObject = game.getObject(event.getSourceId()); if (mageObject instanceof Spell){ return this.getTargetPointer().getTargets(game, source).contains(mageObject.getId()); } } 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); }
@Override public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { return (Integer) game.getState().getValue(mageObject.getId() + "_arms") > 0; } return false; }
@Override public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { return (Integer) game.getState().getValue(mageObject.getId() + "_legs") > 0; } return false; }
@Override public void watch(GameEvent event, Game game) { if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (card != null && ((Card) card).isOwnedBy(this.controllerId) && card.isCreature()) { creatureIds.add(card.getId()); } } }
@Override public boolean apply(Game game, Ability source) { List<Permanent> controlledArtifacts = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), game); for (Permanent permanent : controlledArtifacts) { if (!permanent.getId().equals(game.getObject(source.getSourceId()).getId())) { return true; } } return false; } }
@Override public boolean apply(MageObject input, Game game) { // 708.3. Each split card that consists of two halves with different colored mana symbols in their mana costs // is a multicolored card while it's not a spell on the stack. While it's a spell on the stack, it's only the // color or colors of the half or halves being cast. # if (input instanceof SplitCardHalf && game.getState().getZone(input.getId()) != Zone.STACK) { return 1 < ((SplitCardHalf) input).getMainCard().getColor(game).getColorCount(); } else { return 1 < input.getColor(game).getColorCount(); } }
@Override public boolean apply(MageObject input, Game game) { Spell spell = game.getStack().getSpell(input.getId()); if (spell != null) { Player controller = game.getPlayer(spell.getControllerId()); if (controller != null) { if (spell.getConvertedManaCost() > controller.getCounters().getCount(CounterType.EXPERIENCE)) { return true; } } } return false; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { MageObject toCopyToObject = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null && toCopyToObject != null && sourcePermanent.getAttachedTo() != null) { Permanent toCopyFromPermanent = game.getPermanent(sourcePermanent.getAttachedTo()); if (toCopyFromPermanent != null) { game.copyPermanent(toCopyFromPermanent, toCopyToObject.getId(), source, new EmptyApplyToPermanent()); } } return false; }