mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Planar Chaos - Fixed that the flip of the second ability was always done from the Planar Chaos controller instead of the spell caster.
This commit is contained in:
parent
1af39d5659
commit
c0f02259ec
1 changed files with 19 additions and 8 deletions
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.p;
|
package mage.cards.p;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.common.SpellCastAllTriggeredAbility;
|
import mage.abilities.common.SpellCastAllTriggeredAbility;
|
||||||
|
@ -38,9 +39,11 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SetTargetPointer;
|
import mage.constants.SetTargetPointer;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterSpell;
|
import mage.filter.FilterSpell;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +53,7 @@ import mage.players.Player;
|
||||||
public class PlanarChaos extends CardImpl {
|
public class PlanarChaos extends CardImpl {
|
||||||
|
|
||||||
public PlanarChaos(UUID ownerId, CardSetInfo setInfo) {
|
public PlanarChaos(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
|
||||||
|
|
||||||
// At the beginning of your upkeep, flip a coin. If you lose the flip, sacrifice Planar Chaos.
|
// At the beginning of your upkeep, flip a coin. If you lose the flip, sacrifice Planar Chaos.
|
||||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PlanarChaosUpkeepEffect(), TargetController.YOU, false));
|
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PlanarChaosUpkeepEffect(), TargetController.YOU, false));
|
||||||
|
@ -119,12 +122,20 @@ class PlanarChaosCastAllEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null) {
|
if (spell == null) {
|
||||||
if (!controller.flipCoin(game)) {
|
spell = (Spell) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.STACK);
|
||||||
game.informPlayers("Planar Chaos: Spell countered");
|
|
||||||
return game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game);
|
|
||||||
}
|
}
|
||||||
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
|
if (sourceObject != null && spell != null) {
|
||||||
|
Player caster = game.getPlayer(spell.getControllerId());
|
||||||
|
if (caster != null) {
|
||||||
|
if (!caster.flipCoin(game)) {
|
||||||
|
game.informPlayers(sourceObject.getLogName() + ": " + spell.getLogName() + " countered");
|
||||||
|
game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue