updated targeting for cards that damage

This commit is contained in:
Evan Kranzler 2018-04-19 11:45:20 -04:00
parent 7212b02e53
commit 5fe607e852
548 changed files with 1127 additions and 1133 deletions

View file

@ -41,7 +41,7 @@ import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.command.Emblem;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetAnyTarget;
/**
*
@ -59,7 +59,7 @@ public class ArlinnEmbracedByTheMoonEmblem extends Emblem {
Effect effect2 = new DamageTargetEffect(new SourcePermanentPowerCount());
effect2.setText("This creature deals damage equal to its power to target creature or player");
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect2, new TapSourceCost());
ability2.addTarget(new TargetCreatureOrPlayer());
ability2.addTarget(new TargetAnyTarget());
effect = new GainAbilityControlledEffect(ability2, Duration.EndOfGame, filter);
effect.setText("and '{T}: This creature deals damage equal to its power to target creature or player");
ability.addEffect(effect);

View file

@ -34,7 +34,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.game.command.Emblem;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetAnyTarget;
/**
*
@ -48,7 +48,7 @@ public class ChandraTorchOfDefianceEmblem extends Emblem {
Effect effect = new DamageTargetEffect(5);
effect.setText("this emblem deals 5 damage to target creature or player");
Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, new FilterSpell("a spell"), false, false);
ability.addTarget(new TargetCreatureOrPlayer());
ability.addTarget(new TargetAnyTarget());
getAbilities().add(ability);
}
}

View file

@ -43,7 +43,7 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetAnyTarget;
/**
*
@ -83,7 +83,7 @@ class KothOfTheHammerThirdEffect extends ContinuousEffectImpl {
if (sublayer == SubLayer.NA) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(mountains, source.getControllerId(), source.getSourceId(), game)) {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());
ability.addTarget(new TargetAnyTarget());
permanent.addAbility(ability, source.getSourceId(), game);
}
}

View file

@ -36,7 +36,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetAnyTarget;
/**
*
@ -55,7 +55,7 @@ public class DevilToken extends TokenImpl {
Effect effect = new DamageTargetEffect(1);
effect.setText("it deals 1 damage to target creature or player");
Ability ability = new DiesTriggeredAbility(effect);
ability.addTarget(new TargetCreatureOrPlayer());
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
}

View file

@ -36,7 +36,7 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.Zone;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetAnyTarget;
/**
*
@ -54,7 +54,7 @@ public class TriskelaviteToken extends TokenImpl {
toughness = new MageInt(1);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new SacrificeSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
addAbility(FlyingAbility.getInstance());

View file

@ -15,8 +15,7 @@ import mage.players.Player;
import mage.target.TargetImpl;
/**
* @author JRHerlehy
* Created on 4/8/18.
* @author JRHerlehy Created on 4/8/18.
*/
public class TargetAnyTarget extends TargetImpl {
@ -165,14 +164,14 @@ public class TargetAnyTarget extends TargetImpl {
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
Player player = game.getPlayer(playerId);
if (player != null
&& player.canBeTargetedBy(targetSource, sourceControllerId, game)
&& filter.getPlayerFilter().match(player, sourceId, sourceControllerId, game)) {
&& player.canBeTargetedBy(targetSource, sourceControllerId, game)
&& filter.getPlayerFilter().match(player, sourceId, sourceControllerId, game)) {
possibleTargets.add(playerId);
}
}
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter.getCreatureFilter(), sourceControllerId, game)) {
if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
&& filter.getCreatureFilter().match(permanent, sourceId, sourceControllerId, game)) {
&& filter.getCreatureFilter().match(permanent, sourceId, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
}