* Acklay of the Arena - Fixed triggered ability (fixes #5416).

This commit is contained in:
LevelX2 2018-11-23 12:30:44 +01:00
parent dbbe92ff0a
commit 43ee5e9c43
2 changed files with 41 additions and 20 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
@ -16,7 +15,6 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterBasicLandCard;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -30,7 +28,7 @@ import mage.target.common.TargetLandPermanent;
public final class GhostQuarter extends CardImpl { public final class GhostQuarter extends CardImpl {
public GhostQuarter(UUID ownerId, CardSetInfo setInfo) { public GhostQuarter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},""); super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {T}: Add {C}. // {T}: Add {C}.
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());

View file

@ -1,6 +1,6 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -32,35 +32,58 @@ public class FightTargetsEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId()); Card card = game.getCard(source.getSourceId());
if (card != null) { if (card != null) {
// only if both targets are legal the effect will be applied UUID target1Id = null;
if (source.getTargets().get(0).isLegal(source, game) && source.getTargets().get(1).isLegal(source, game)) { UUID target2Id = null;
Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget()); // first target is in target pointer, second target is a normal target
Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (source.getTargets().size() < 2) {
// 20110930 - 701.10 if (!source.getTargets().get(0).isLegal(source, game)) {
if (creature1 != null && creature2 != null) { return false;
if (creature1.isCreature() && creature2.isCreature()) { }
return creature1.fight(creature2, source, game); target1Id = getTargetPointer().getFirst(game, source);
} target2Id = source.getTargets().getFirstTarget();
if (target1Id == target2Id) {
return false;
}
// two normal targets available, only if both targets are legal the effect will be applied
} else if (source.getTargets().get(0).isLegal(source, game) && source.getTargets().get(1).isLegal(source, game)) {
target1Id = source.getTargets().get(0).getFirstTarget();
target2Id = source.getTargets().get(1).getFirstTarget();
}
Permanent creature1 = game.getPermanent(target1Id);
Permanent creature2 = game.getPermanent(target2Id);
// 20110930 - 701.10
if (creature1 != null && creature2 != null) {
if (creature1.isCreature() && creature2.isCreature()) {
return creature1.fight(creature2, source, game);
} }
} }
if (!game.isSimulation()) { }
game.informPlayers(card.getName() + " has been fizzled."); if (!game.isSimulation()) {
} game.informPlayers(card.getName() + " has been fizzled.");
} }
return false; return false;
} }
@Override @Override
public FightTargetsEffect copy() { public FightTargetsEffect
copy() {
return new FightTargetsEffect(this); return new FightTargetsEffect(this);
} }
@Override @Override
public String getText(Mode mode) { public String
if (staticText != null && !staticText.isEmpty()) { getText(Mode mode
) {
if (staticText
!= null && !staticText
.isEmpty()) {
return staticText; return staticText;
} }
return "Target " + mode.getTargets().get(0).getTargetName() + " fights another target " + mode.getTargets().get(1).getTargetName(); return "Target " + mode
.getTargets().get(0).getTargetName() + " fights another target " + mode
.getTargets().get(1).getTargetName();
} }
} }