@Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost revealCost = null; for (Cost cost : source.getCosts()) { if (cost instanceof RevealTargetFromHandCost) { revealCost = (RevealTargetFromHandCost) cost; } } Player controller = game.getPlayer(source.getControllerId()); Card sourceCard = game.getCard(source.getSourceId()); if (controller != null && sourceCard != null && revealCost != null) { int live = revealCost.getNumberRevealedCards() * 3; if (live > 0) { controller.gainLife(live, game); } game.informPlayers( new StringBuilder(sourceCard.getName()) .append(": ") .append(controller.getName()) .append(" revealed ") .append(revealCost.getNumberRevealedCards()) .append(revealCost.getNumberRevealedCards() == 1 ? "white card" : "white cards") .append(" and gained ") .append(live) .append(" live") .toString()); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { boolean lessCreatures = false; boolean lessLife = false; FilterPermanent filter = new FilterCreaturePermanent(); int count = game.getBattlefield().countAll(filter, controller.getId(), game); for (UUID uuid : game.getOpponents(controller.getId())) { Player opponent = game.getPlayer(uuid); if (opponent != null) { if (opponent.getLife() > controller.getLife()) { lessLife = true; } if (game.getBattlefield().countAll(filter, uuid, game) > count) { lessCreatures = true; } } if (lessLife && lessCreatures) { // no need to search further break; } } if (lessLife) { controller.gainLife(6, game); } if (lessCreatures) { Effect effect = new CreateTokenEffect(new SoldierToken(), 3); effect.apply(game, source); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source)); if (spell != null) { ObjectColor color1 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color1")); ObjectColor color2 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color2")); int amount = 0; if (spell.getColor(game).contains(color1)) { ++amount; } if (spell.getColor(game).contains(color2)) { ++amount; } if (amount > 0) { you.gainLife(amount, game); return true; } } } return false; }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player controllerPlayer = game.getPlayer(source.getControllerId()); if (targetPlayer != null && controllerPlayer != null) { targetPlayer.damage(1, source.getSourceId(), game, false, true); controllerPlayer.gainLife(1, game); } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (controller != null && permanent != null) { controller.gainLife(permanent.getToughness().getValue(), game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { int amount = (Integer) getValue("damage"); if (amount > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.gainLife(amount, game); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); int life = 2 * game.getBattlefield() .count(filter, source.getSourceId(), source.getControllerId(), game); if (player != null) { player.gainLife(life, game); } return true; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { PreventionEffectData preventEffectData = preventDamageAction(event, source, game); if (preventEffectData.getPreventedDamage() > 0) { used = true; Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(preventEffectData.getPreventedDamage(), game); } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD); if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { player.gainLife(permanent.getToughness().getValue(), game); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost) { int amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue(); if (amount > 0) { controller.gainLife(amount, game); } } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player controller = game.getPlayer(source.getControllerId()); if (targetPlayer != null && controller != null) { TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(); target.setRequired(true); if (targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { targetPlayer.getGraveyard().remove(card); card.moveToExile(null, "", source.getId(), game); if (card.getCardType().contains(CardType.CREATURE)) { controller.gainLife(2, game); } } return true; } } return false; }