@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; return sacrificeCost.getPermanents().stream().mapToInt(p -> p.getToughness().getValue()).sum(); } } return 0; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent target = game.getPermanent(sourceAbility.getFirstTarget()); if (target != null) { return target.getToughness().getValue() - 1; } return 0; }
public static boolean isPowerOrThoughnessGreater(Permanent sourceCreature, Permanent newCreature) { if (newCreature.getPower().getValue() > sourceCreature.getPower().getValue()) { return true; } return newCreature.getToughness().getValue() > sourceCreature.getToughness().getValue(); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = (Permanent) getValue("attachedTo"); if (controller != null && creature != null) { controller.gainLife(creature.getToughness().getValue(), game, source); controller.drawCards(creature.getToughness().getValue(), game); return true; } return false; }
@Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { permanent.removePTCDA(); permanent.getPower().modifyBaseValue(7); permanent.getToughness().modifyBaseValue(7); return true; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent == null) { this.discard(); return false; } permanent.getToughness().setValue(1); return true; } }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { boolean result = super.pay(ability, game, sourceId, controllerId, noMana, costToPay); if (paid && !getPermanents().isEmpty()) { Permanent sacrificedPermanen = getPermanents().get(0); Permanent sourcePermanent = game.getPermanent(sourceId); if (sourcePermanent != null && sacrificedPermanen != null) { game.getState().setValue(RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX + sourceId + sourcePermanent.getZoneChangeCounter(game), sacrificedPermanen.getToughness().getValue()); } } return result; }
@Override public boolean apply(Game game, Ability source) { Permanent creature = (Permanent) getValue("attachedTo"); if(creature != null){ Player player = game.getPlayer(creature.getOwnerId()); if (player != null) { player.loseLife(creature.getToughness().getValue(), game, false); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null) { int toughness = targetCreature.getToughness().getBaseValueModified(); game.addEffect(new SetPowerToughnessTargetEffect(0, toughness, Duration.EndOfTurn), source); return true; } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent != null) { return sourcePermanent.getToughness().getValue(); } return 0; }
@Override public int calculate(Game game, Ability source, Effect effect) { Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); return enchanted.getToughness().getValue(); }
@Override public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); if (creature == null) { return false; } return new GainLifeEffect(creature.getToughness().getValue()).apply(game, source); } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { you.discard(permanent.getToughness().getValue(), false, source, 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(source.getControllerId()); if (player != null) { player.gainLife(permanent.getToughness().getValue(), game, source); } } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getFirstTarget()); if (sourcePermanent != null) { return CardUtil.addWithOverflowCheck(sourcePermanent.getPower().getValue(), sourcePermanent.getToughness().getValue()); } return 0; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (permanent != null) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(permanent.getToughness().getValue(), game, source); } } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent target = game.getPermanentOrLKIBattlefield(this.getTargetPointer().getFirst(game, source)); if (player != null && target != null) { player.loseLife(target.getToughness().getValue(), game, false); return true; } 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, source); return true; } return false; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceObject != null) { Permanent permanentReset = sourceObject.copy(); permanentReset.getCounters(game).clear(); permanentReset.getPower().resetToBaseValue(); permanentReset.getToughness().resetToBaseValue(); game.addEffect(new CopyEffect(Duration.Custom, permanentReset, event.getTargetId()), source); } return false; }
public CreatureSimulator(Permanent permanent) { this.id = permanent.getId(); this.damage = permanent.getDamage(); this.power = permanent.getPower().getValue(); this.toughness = permanent.getToughness().getValue(); this.hasDoubleStrike = permanent.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId()); this.hasFirstStrike = permanent.getAbilities().containsKey(FirstStrikeAbility.getInstance().getId()); this.hasTrample = permanent.getAbilities().containsKey(TrampleAbility.getInstance().getId()); }