@Override public void setPower(int power) { this.power.setValue(power); }
@Override public void setToughness(int toughness) { this.toughness.setValue(toughness); }
@Override public boolean apply(Game game, Ability source) { Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); if (enchanted != null) { enchanted.getPower().setValue(power); enchanted.getToughness().setValue(toughness); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { int value = amount.calculate(game, source, this); mageObject.getPower().setValue(value); return true; } return false; }
@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 apply(Game game, Ability source) { Permanent token = game.getPermanent(source.getSourceId()); if (token != null) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { token.getPower().setValue(controller.getLife()); token.getToughness().setValue(controller.getLife()); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent token = game.getPermanent(source.getSourceId()); if (token != null) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { token.getPower().setValue(controller.getLife()); token.getToughness().setValue(controller.getLife()); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { boolean result = false; for (UUID targetId: this.getTargetPointer().getTargets(game, source)) { Permanent target = game.getPermanent(targetId); if (target != null) { if (power != null) { target.getPower().setValue(power.calculate(game, source, this)); } if (toughness != null) { target.getToughness().setValue(toughness.calculate(game, source, this)); } result = true; } } return result; }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (target != null) { int power = target.getPower().getValue(); target.getPower().setValue(target.getToughness().getValue()); target.getToughness().setValue(power); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); if (sourcePermanent != null) { int power = sourcePermanent.getPower().getValue(); sourcePermanent.getPower().setValue(sourcePermanent.getToughness().getValue()); sourcePermanent.getToughness().setValue(power); return true; } else { if (duration.isOnlyValidIfNoZoneChange()) { discard(); } } return false; }
@Override public boolean apply(Game game, Ability source) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { int value = amount.calculate(game, source, this); mageObject.getToughness().setValue(value); return true; } else { if (duration == Duration.Custom) { discard(); } } return false; }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (!permanent.isCreature()) { permanent.addCardType(CardType.CREATURE); } } break; case PTChangingEffects_7: if (sublayer == SubLayer.SetPT_7b) { int manaCost = permanent.getConvertedManaCost(); permanent.getPower().setValue(manaCost); permanent.getToughness().setValue(manaCost); } } } return true; }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { if (!permanent.isCreature()) { permanent.addCardType(CardType.CREATURE); } } break; case PTChangingEffects_7: if (sublayer == SubLayer.SetPT_7b) { int manaCost = permanent.getConvertedManaCost(); permanent.getPower().setValue(manaCost); permanent.getToughness().setValue(manaCost); } } } return true; }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { // Not sure, if this is layerwise handled absolutely correctly Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null) { Permanent permanent = game.getPermanent(enchantment.getAttachedTo()); if (permanent != null && !permanent.isCreature()) { if (sublayer == SubLayer.NA) { permanent.addCardType(CardType.CREATURE); permanent.getPower().setValue(permanent.getConvertedManaCost()); permanent.getToughness().setValue(permanent.getConvertedManaCost()); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { MageObject target = game.getObject(source.getSourceId()); if (target != null) { UUID playerId = (UUID) game.getState().getValue(source.getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY); FilterLandPermanent filter = FilterLandPermanent.nonbasicLand(); filter.add(new ControllerIdPredicate(playerId)); int number = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this); target.getPower().setValue(number); target.getToughness().setValue(number); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && new MageObjectReference(source.getSourceObject(game), game).refersTo(permanent, game)) { int amount = permanent.getCounters(game).getCount(CounterType.LORE); permanent.getPower().setValue(amount); permanent.getToughness().setValue(amount); return true; } else { discard(); } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && new MageObjectReference(source.getSourceObject(game), game).refersTo(permanent, game)) { int amount = controller.getCounters().getCount(CounterType.EXPERIENCE); permanent.getPower().setValue(amount); permanent.getToughness().setValue(amount); return true; } else { discard(); } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { int number = 0; for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { number += player.getGraveyard().count(new FilterCreatureCard(), game); } } mageObject.getPower().setValue(number); mageObject.getToughness().setValue(number + 1); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures"); filter.add(new ColorPredicate(ObjectColor.GREEN)); int number = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); mageObject.getToughness().setValue(number + 1); return true; } } return false; } }