@Override public void init(Ability source, Game game) { super.init(source, game); for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { permanent.addInfo("kioraPrevention" + getId(), CardUtil.addToolTipMarkTags("All damage that would be dealt to and dealt by this permanent is prevented."), game); } } }
@Override public void init(Ability source, Game game) { super.init(source, game); for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { permanent.addInfo("detain" + getId(), CardUtil.addToolTipMarkTags("Detained"), game); } } }
@Override public boolean apply(Game game, Ability source) { MageObject mageObject = game.getPermanentEntering(source.getSourceId()); if (mageObject == null) { mageObject = game.getObject(source.getSourceId()); } if (mageObject != null) { boolean toggled = true; game.getState().setValue(mageObject.getId() + "_toggle", toggled); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("toggle", CardUtil.addToolTipMarkTags("Switch: " + (toggled ? "ON" : "OFF")), game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent jeweledAmulet = game.getPermanent(source.getSourceId()); if (controller != null && jeweledAmulet != null) { game.getState().setValue("JeweledAmulet" + source.getSourceId().toString(), source.getManaCostsToPay().getUsedManaToPay()); //store the mana used to pay manaUsedString = source.getManaCostsToPay().getUsedManaToPay().toString(); jeweledAmulet.addInfo("MANA USED", CardUtil.addToolTipMarkTags("Mana used last: " + manaUsedString), game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent iceCauldron = game.getPermanent(source.getSourceId()); if (controller != null && iceCauldron != null) { game.getState().setValue("IceCauldronMana" + source.getSourceId().toString(), source.getManaCostsToPay().getUsedManaToPay()); //store the mana used to pay manaUsedString = source.getManaCostsToPay().getUsedManaToPay().toString(); iceCauldron.addInfo("MANA USED", CardUtil.addToolTipMarkTags("Mana used last: " + manaUsedString), game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { if (game.getState().getValue(mageObject.getId() + "_toggle") == null) { return false; } boolean toggled = (Boolean) game.getState().getValue(mageObject.getId() + "_toggle"); game.getState().setValue(mageObject.getId() + "_toggle", !toggled); ((Permanent) mageObject).addInfo("toggle", CardUtil.addToolTipMarkTags("Switch: " + (!toggled ? "ON" : "OFF")), game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { MageObject mageObject = game.getPermanentEntering(source.getSourceId()); if (mageObject == null) { mageObject = game.getObject(source.getSourceId()); } if (mageObject != null) { game.getState().setValue(mageObject.getId() + "_arms", 2); game.getState().setValue(mageObject.getId() + "_legs", 2); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("armslegs", CardUtil.addToolTipMarkTags("Arms: 2, Legs: 2"), game); } return true; } return false; }
@Override public void init(Ability source, Game game) { target.setNotTarget(true); target.setRequired(false); Player controller = game.getPlayer(source.getControllerId()); Permanent protectiveSphere = game.getPermanent(source.getSourceId()); if (controller != null && protectiveSphere != null) { game.getState().setValue("ProtectiveSphere" + source.getSourceId().toString(), source.getManaCostsToPay().getUsedManaToPay()); //store the mana used to pay protectiveSphere.addInfo("MANA USED", CardUtil.addToolTipMarkTags("Last mana used for protective ability: " + source.getManaCostsToPay().getUsedManaToPay()), game); } this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game); super.init(source, game); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent extraplanarLens = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { Permanent targetLand = game.getPermanent(source.getFirstTarget()); if (targetLand != null) { targetLand.moveToExile(null, extraplanarLens.getName() + " (Imprint)", source.getSourceId(), game); extraplanarLens.imprint(targetLand.getId(), game); extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + ']'), game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getPermanentEntering(source.getSourceId()); if (mageObject == null) { mageObject = game.getObject(source.getSourceId()); } if (controller != null && mageObject != null) { ChoiceImpl choices = new ChoiceBasicLandType(); if (controller.choose(Outcome.Neutral, choices, game)) { game.informPlayers(mageObject.getName() + ": Chosen basic land type is " + choices.getChoice()); game.getState().setValue(mageObject.getId().toString() + VALUE_KEY, choices.getChoice()); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen basic land type: " + choices.getChoice()), game); } return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent mageObject = game.getPermanentEntering(source.getSourceId()); if (controller != null && mageObject != null) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, filter, true); if (controller.choose(this.outcome, target, source.getSourceId(), game)) { Permanent chosenCreature = game.getPermanent(target.getFirstTarget()); if (chosenCreature != null) { game.getState().setValue(mageObject.getId() + "_chosenCreature", new MageObjectReference(chosenCreature, game)); mageObject.addInfo("chosen creature", CardUtil.addToolTipMarkTags("Chosen creature: " + chosenCreature.getIdName()), game); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null && targetPlayer.canLose(game)) { game.informPlayers(targetPlayer.getLogName() + " was destroyed"); targetPlayer.lost(game); // double checks canLose, but seems more future-proof than lostForced } Permanent sourcePermanent = game.getPermanent(source.getSourceId()); MageObject mageObject = game.getObject(source.getSourceId()); if (sourcePermanent != null && mageObject != null) { if (game.getState().getValue(mageObject.getId() + "_doom") == null) { return false; } Integer doomNumber = 5; game.getState().setValue(mageObject.getId() + "_doom", doomNumber); ((Permanent) mageObject).addInfo("doom counter", CardUtil.addToolTipMarkTags("Doom counter at: " + doomNumber), game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getPermanentEntering(source.getSourceId()); if (mageObject == null) { mageObject = game.getObject(source.getSourceId()); } ChoiceColor choice = new ChoiceColor(); if (controller != null && mageObject != null && controller.choose(outcome, choice, game)) { if (!game.isSimulation()) { game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice()); } game.getState().setValue(mageObject.getId() + "_color", choice.getColor()); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (controller == null || permanent == null) { return false; } int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game); Cost cost = new PayLifeCost(payAmount); if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { return false; } Card sourceCard = game.getCard(source.getSourceId()); game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() + " pays " + payAmount + " life"); game.addEffect(new SetPowerToughnessSourceEffect( payAmount, payAmount, Duration.Custom, SubLayer.CharacteristicDefining_7a ), source); permanent.addInfo("life paid", CardUtil.addToolTipMarkTags("Life paid: " + payAmount), game); return true; } }
@Override public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && sourcePermanent != null) { if (target != null && controller.getId().equals(sourcePermanent.getControllerId())) { SourceHasRemainedInSameZoneCondition condition = new SourceHasRemainedInSameZoneCondition(sourcePermanent.getId()); game.addEffect(new ConditionalContinuousEffect( new GainControlTargetEffect(Duration.Custom), new CompoundCondition(new SourceOnBattlefieldControlUnchangedCondition(), condition), null), source); if (!game.isSimulation()) { game.informPlayers(sourcePermanent.getLogName() + ": " + controller.getLogName() + " gained control of " + target.getLogName()); } sourcePermanent.addInfo("gained control of", CardUtil.addToolTipMarkTags("Gained control of: " + GameLog.getColoredObjectIdNameForTooltip(target)), game); } return true; } return false; } }
@Override public void init(Ability source, Game game) { super.init(source, game); Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); Permanent mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (player != null && mageObject != null) { ChoiceColor choice = new ChoiceColor(); if (!player.choose(outcome, choice, game)) { discard(); return; } if (!game.isSimulation()) { game.informPlayers(mageObject.getLogName() + ": " + player.getLogName() + " has chosen " + choice.getChoice()); } game.getState().setValue(mageObject.getId() + "_color", choice.getColor()); mageObject.addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game); } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (controller == null || permanent == null) { return false; } int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game); Cost cost = new PayLifeCost(payAmount); if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { return false; } Card sourceCard = game.getCard(source.getSourceId()); game.informPlayers((sourceCard != null ? sourceCard.getName() : "") + ": " + controller.getLogName() + " pays " + payAmount + " life."); String key = CardUtil.getCardZoneString("lifePaid", source.getSourceId(), game); game.getState().setValue(key, payAmount); permanent.addInfo("life paid", CardUtil.addToolTipMarkTags("Life paid: " + payAmount), game); return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getPermanentEntering(source.getSourceId()); if (mageObject == null) { mageObject = game.getObject(source.getSourceId()); } if (controller != null && mageObject != null) { Choice typeChoice = new ChoiceCreatureType(mageObject); if (controller.choose(outcome, typeChoice, game)) { if (!game.isSimulation()) { game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice()); } game.getState().setValue(source.getSourceId() + "_type", SubType.byDescription(typeChoice.getChoice())); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game); } return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); MageObject mageObject = game.getObject(source.getSourceId()); if (controller != null && sourcePermanent != null && mageObject != null) { if (game.getState().getValue(mageObject.getId() + "_doom") == null) { return false; } Integer doomNumber = (Integer) game.getState().getValue(mageObject.getId() + "_doom"); if (doomNumber == 1) { // not completely sure if counter should be moving here or not (relevant in case the second trigger gets countered) game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CUSTOM_EVENT, source.getSourceId(), source.getSourceId(), controller.getId(), "DoomCounterReset", 1)); } if (doomNumber > 0) { doomNumber--; game.getState().setValue(mageObject.getId() + "_doom", doomNumber); ((Permanent) mageObject).addInfo("doom counter", CardUtil.addToolTipMarkTags("Doom counter at: " + doomNumber), game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getPermanentEntering(source.getSourceId()); if (mageObject == null) { mageObject = game.getObject(source.getSourceId()); } if (controller != null && mageObject != null) { TargetOpponent target = new TargetOpponent(true); if (controller.choose(this.outcome, target, source.getSourceId(), game)) { Player chosenPlayer = game.getPlayer(target.getFirstTarget()); if (chosenPlayer != null) { game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + chosenPlayer.getLogName()); game.getState().setValue(mageObject.getId() + VALUE_KEY, target.getFirstTarget()); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("chosen opponent", CardUtil.addToolTipMarkTags("Chosen player: " + chosenPlayer.getLogName()), game); } return true; } } } return false; } }