mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Acklay of the Arena - Fixed triggered ability (fixes #5416).
This commit is contained in:
parent
dbbe92ff0a
commit
43ee5e9c43
2 changed files with 41 additions and 20 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -16,7 +15,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterBasicLandCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -30,7 +28,7 @@ import mage.target.common.TargetLandPermanent;
|
|||
public final class GhostQuarter extends CardImpl {
|
||||
|
||||
public GhostQuarter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
|
||||
// {T}: Add {C}.
|
||||
this.addAbility(new ColorlessManaAbility());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -32,35 +32,58 @@ public class FightTargetsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null) {
|
||||
// only if both targets are legal the effect will be applied
|
||||
if (source.getTargets().get(0).isLegal(source, game) && source.getTargets().get(1).isLegal(source, game)) {
|
||||
Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget());
|
||||
Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
// 20110930 - 701.10
|
||||
if (creature1 != null && creature2 != null) {
|
||||
if (creature1.isCreature() && creature2.isCreature()) {
|
||||
return creature1.fight(creature2, source, game);
|
||||
}
|
||||
UUID target1Id = null;
|
||||
UUID target2Id = null;
|
||||
// first target is in target pointer, second target is a normal target
|
||||
if (source.getTargets().size() < 2) {
|
||||
if (!source.getTargets().get(0).isLegal(source, game)) {
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FightTargetsEffect copy() {
|
||||
public FightTargetsEffect
|
||||
copy() {
|
||||
return new FightTargetsEffect(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
public String
|
||||
getText(Mode mode
|
||||
) {
|
||||
if (staticText
|
||||
!= null && !staticText
|
||||
.isEmpty()) {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue