@Override public boolean applies(GameEvent event, Ability source, Game game) { return (super.applies(event, source, game) && event instanceof DamageEvent && event.getAmount() > 0 && game.getObject(source.getFirstTarget()) != null && game.getObject(event.getSourceId()) != null && game.getObject(source.getFirstTarget()).equals(game.getObject(event.getSourceId())) && game.getObject(source.getFirstTarget()).isInstantOrSorcery()); } }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ')'; } return null; }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (source.isControlledBy(affectedControllerId)) { MageObject mageObject = game.getObject(objectId); return mageObject != null && mageObject.isCreature(); } return false; }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { return "You can't activate abilities that aren't mana abilities or loyalty abilities (" + mageObject.getIdName() + ")."; } return null; }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { return "You can't play the land or cast the spell (" + mageObject.getLogName() + " in play)."; } return null; }
@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) { if (super.applies(event, source, game)) { if (game.getObject(event.getSourceId()).getCardType().contains(cardType)) { if (event.getTargetId().equals(source.getSourceId())) { return true; } } } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { MageObject mageObject = game.getObject(event.getSourceId()); if (mageObject != null && mageObjectReference.refersTo(mageObject, game)) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == EventType.CAST_SPELL) { MageObject object = game.getObject(event.getSourceId()); if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY))) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { MageObject sourceObject = game.getObject(event.getSourceId()); if (sourceObject != null && sourceObject.isCreature()) { if (event.getTargetId().equals(source.getSourceId())) { return true; } } } return false; }
public boolean spellCanBeActivatedRegularlyNow(UUID playerId, Game game) { MageObject object = game.getObject(sourceId); return timing == TimingRule.INSTANT || object.hasAbility(FlashAbility.getInstance().getId(), game) || game.canPlaySorcery(playerId); }
@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 String getInfoMessage(Ability source, GameEvent event, Game game) { CardType cardType = (CardType) game.getState().getValue(source.getSourceId().toString() + "_cardtype"); MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null && cardType != null) { return "You can't cast " + cardType.toString() + " spells (" + mageObject.getIdName() + ")."; } return null; }
@Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.SPELL_CAST) { Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null && spell.isCreature()) { playerCreatureSpells.put(event.getPlayerId(), creatureSpellsCastThisTurn(event.getPlayerId()) + 1); } } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { MageObject mageObject = game.getObject(event.getSourceId()); if (mageObject != null && mageObject.isLand()) { Permanent land = game.getPermanent(event.getSourceId()); return land != null && filter.match(land, game); } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { MageObject mageObject = game.getObject(event.getSourceId()); if (mageObject != null && mageObject.isLand()) { Permanent land = game.getPermanent(event.getSourceId()); return land != null && filter.match(land, game); } return false; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (player != null && sourceObject != null) { game.informPlayers(sourceObject.getLogName() + ": Extra turn of " + player.getLogName() + " skipped"); } return true; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { controller.revealCards(controller.getName(), controller.getHand(), game, false); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(source.getFirstTarget()); MageObject sourceObject = game.getObject(source.getSourceId()); if (you != null && targetPlayer != null) { you.lookAtCards(sourceObject != null ? sourceObject.getIdName() : null, targetPlayer.getHand(), game); return true; } return false; }
@Override public void adjustTargets(Ability ability, Game game) { Player controller = game.getPlayer(ability.getControllerId()); Choice typeChoice = new ChoiceCreatureType(game.getObject(ability.getSourceId())); if (controller != null && controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) { String chosenType = typeChoice.getChoice(); FilterCreatureCard filter = new FilterCreatureCard(chosenType + " cards"); filter.add(new SubtypePredicate(SubType.byDescription(chosenType))); ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter)); } } }