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; }
@Override public void addTarget(UUID id, Ability source, Game game, boolean skipEvent) { Spell spell = game.getStack().getSpell(id); if (spell != null) { // remember the original sourceID sourceIds.add(spell.getSourceId()); } super.addTarget(id, source, game, skipEvent); }
@Override public boolean checkTrigger(GameEvent event, Game game) { Spell spell = (Spell) game.getObject(event.getTargetId()); return this.getSourceId().equals(spell.getSourceId()); }
@Override public boolean checkTrigger(GameEvent event, Game game) { Spell spell = (Spell) game.getObject(event.getTargetId()); return this.getSourceId().equals(spell.getSourceId()); }
@Override public boolean applies(GameEvent event, Ability source, Game game) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null) { if (spell.getSourceId().equals(source.getSourceId())) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { Spell spell = game.getStack().getSpell(event.getTargetId()); return spell != null && spell.getSourceId().equals(this.getSourceId()); }
@Override public void init(Ability source, Game game) { super.init(source, game); Spell object = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (object != null) { zoneChangeCounter = game.getState().getZoneChangeCounter(object.getSourceId()) + 1; permanentId = object.getSourceId(); } }
@Override public boolean checkTrigger(GameEvent event, Game game) { Spell spell = game.getStack().getSpell(event.getTargetId()); return spell != null && spell.getSourceId().equals(this.getSourceId()); }
@Override public void watch(GameEvent event, Game game) { /** * This does still not handle if a spell is cast from hand and comes to * play from other zones during the same step. But at least the state is * reset if the game comes to a new step */ if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) { Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null) { Set<Integer> zcc = spellsCastFromGraveyard.computeIfAbsent(spell.getSourceId(), k -> new HashSet<>()); zcc.add(spell.getZoneChangeCounter(game)); } } }
@Override public void watch(GameEvent event, Game game) { if (condition == true) { //no need to check - condition has already occured return; } if (event.getType() == EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) { condition = true; } } }
@Override public void watch(GameEvent event, Game game) { if (condition == true) { //no need to check - condition has already occured return; } if (event.getType() == EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) { condition = true; } } }
@Override public void watch(GameEvent event, Game game) { if (condition == true) { //no need to check - condition has already occured return; } if (event.getType() == EventType.SPELL_CAST && controllerId.equals(event.getPlayerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (!spell.getSourceId().equals(cardId) && filter.match(spell, game)) { condition = true; } } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { Spell spell = game.getStack().getSpell(event.getTargetId()); return spell != null && !spell.getSourceId().equals(source.getSourceId()) && spell.isControlledBy(source.getControllerId()); } }
@Override public void watch(GameEvent event, Game game) { // Watcher saves all casts becaus of possible Clone cards that copy Jeleva if (event.getType() == GameEvent.EventType.SPELL_CAST) { if (!game.getStack().isEmpty()) { for (StackObject stackObject : game.getStack()) { if (stackObject instanceof Spell) { Spell spell = (Spell) stackObject; manaSpendToCast.putIfAbsent(spell.getSourceId().toString() + spell.getCard().getZoneChangeCounter(game), spell.getSpellAbility().getManaCostsToPay().convertedManaCost()); } } } } }
@Override public boolean checkTrigger(GameEvent event, Game game) { // The sacrifice occurs only if you cast it using its own ability. If you cast it using some other // effect (for instance, if it gained flash from Vedalken Orrery), then it won't be sacrificed. // CHECK Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.getSourceId().equals(getSourceId())) { return !(game.isMainPhase() && game.isActivePlayer(event.getPlayerId()) && game.getStack().size() == 1); } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.isCreature() && spell.hasSubtype(SubType.DINOSAUR, game)) { getEffects().setTargetPointer(new FixedTarget(spell.getSourceId())); return true; } } return false; }
@Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.HAND) { Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null && this.getSourceId().equals(spell.getSourceId())) { payment = spell.getSpellAbility().getManaCostsToPay().getPayment(); } } if (event.getType() == GameEvent.EventType.ZONE_CHANGE && this.getSourceId().equals(event.getSourceId())) { if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { payment = null; } } }
@Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) { Spell spell = (Spell) game.getObject(event.getTargetId()); if (event.getAdditionalReference() != null && event.getAdditionalReference().getSourceId() != null && spell.isInstant() || spell.isSorcery()) { allowingObjects.add(event.getAdditionalReference()); castSpells.put(new MageObjectReference(spell.getSourceId(), game), event.getAdditionalReference().getSourceId()); } } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && conspiredSpell != null) { Card card = game.getCard(conspiredSpell.getSourceId()); if (card != null) { StackObject newStackObject = conspiredSpell.createCopyOnStack(game, source, source.getControllerId(), true); if (newStackObject instanceof Spell && !game.isSimulation()) { game.informPlayers(controller.getLogName() + ((Spell) newStackObject).getActivatedMessage(game)); } return true; } } return false; }
@Override public void watch(GameEvent event, Game game) { if (event.getType() == EventType.MANA_PAID) { MageObject target = game.getObject(event.getTargetId()); if (event.getSourceId() != null && event.getSourceId().equals(this.getSourceId()) && target != null && target.isCreature() && target.getColor(game).isMulticolored() && event.getFlag()) { if (target instanceof Spell) { game.getState().addEffect(new GuildmagesForumEntersBattlefieldEffect( new MageObjectReference(((Spell) target).getSourceId(), target.getZoneChangeCounter(game), game)), source); } } } }