* Some minor chnages.

This commit is contained in:
LevelX2 2017-07-24 10:41:21 +02:00
parent 3f351d0def
commit d755e86fda
2 changed files with 8 additions and 33 deletions

View file

@ -48,7 +48,7 @@ import mage.target.TargetPermanent;
public class MangaraOfCorondor extends CardImpl { public class MangaraOfCorondor extends CardImpl {
public MangaraOfCorondor(UUID ownerId, CardSetInfo setInfo) { public MangaraOfCorondor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add("Human"); this.subtype.add("Human");
this.subtype.add("Wizard"); this.subtype.add("Wizard");
@ -56,7 +56,7 @@ public class MangaraOfCorondor extends CardImpl {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {tap}: Exile Mangara of Corondor and target permanent. // {T}: Exile Mangara of Corondor and target permanent.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileSourceEffect(), new TapSourceCost());
ability.addEffect(new ExileTargetEffect()); ability.addEffect(new ExileTargetEffect());
ability.addTarget(new TargetPermanent()); ability.addTarget(new TargetPermanent());

View file

@ -32,7 +32,6 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -40,24 +39,22 @@ import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterAttackingCreature; import mage.filter.common.FilterAttackingCreature;
import mage.game.Game; import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
/** /**
* *
* @author LoneFox * @author LoneFox
*
*/ */
public class SoulSnare extends CardImpl { public class SoulSnare extends CardImpl {
public SoulSnare(UUID ownerId, CardSetInfo setInfo) { public SoulSnare(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}");
// {W}, Sacrifice Soul Snare: Exile target creature that's attacking you or a planeswalker you control. // {W}, Sacrifice Soul Snare: Exile target creature that's attacking you or a planeswalker you control.
Effect effect = new ExileTargetEffect(); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
effect.setText("Exile target creature that's attacking you or a planeswalker you control."); new ExileTargetEffect(), new ManaCostsImpl("{W}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{W}"));
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetCreaturePermanent(new SoulSnareFilter())); ability.addTarget(new TargetCreaturePermanent(new SoulSnareFilter()));
this.addAbility(ability); this.addAbility(ability);
@ -79,7 +76,6 @@ class SoulSnareFilter extends FilterAttackingCreature {
super("creature that's attacking you or a planeswalker you control"); super("creature that's attacking you or a planeswalker you control");
} }
public SoulSnareFilter(final SoulSnareFilter filter) { public SoulSnareFilter(final SoulSnareFilter filter) {
super(filter); super(filter);
} }
@ -91,28 +87,7 @@ class SoulSnareFilter extends FilterAttackingCreature {
@Override @Override
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
if(!super.match(permanent, sourceId, playerId, game)) { return super.match(permanent, sourceId, playerId, game)
return false; && playerId.equals(game.getCombat().getDefendingPlayerId(permanent.getId(), game));
}
for(CombatGroup group : game.getCombat().getGroups()) {
for(UUID attacker : group.getAttackers()) {
if(attacker.equals(permanent.getId())) {
UUID defenderId = group.getDefenderId();
if(defenderId.equals(playerId)) {
return true;
}
else {
Permanent planeswalker = game.getPermanent(defenderId);
if(planeswalker != null && planeswalker.isPlaneswalker()
&& planeswalker.getControllerId().equals(playerId)) {
return true;
}
}
}
}
}
return false;
} }
} }