mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09:00
* Some updated to Psychic Battle handling.
This commit is contained in:
parent
ec96f8a18e
commit
dc91d6ff81
4 changed files with 17 additions and 26 deletions
|
@ -37,16 +37,13 @@ import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
|
||||||
import mage.filter.predicate.mageobject.NamePredicate;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
@ -76,11 +73,6 @@ public class PsychicBattle extends CardImpl {
|
||||||
|
|
||||||
class PsychicBattleTriggeredAbility extends TriggeredAbilityImpl {
|
class PsychicBattleTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private static final FilterPermanent filter = new FilterPermanent();
|
|
||||||
static {
|
|
||||||
filter.add(new NamePredicate("Psychic Battle"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PsychicBattleTriggeredAbility() {
|
public PsychicBattleTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new PsychicBattleEffect(), false);
|
super(Zone.BATTLEFIELD, new PsychicBattleEffect(), false);
|
||||||
}
|
}
|
||||||
|
@ -103,8 +95,7 @@ class PsychicBattleTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||||
if (stackObject != null) {
|
if (stackObject != null) {
|
||||||
Permanent psychicBattle = game.getPermanentOrLKIBattlefield(getSourceId());
|
if (!stackObject.isTargetChanged() && !stackObject.getName().equals("Psychic Battle")) {
|
||||||
if (psychicBattle != null && !(stackObject.isTargetChanged() && filter.match(psychicBattle, game))) {
|
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||||
stackObject.setTargetChanged(false); // resets the targetChanged flag
|
stackObject.setTargetChanged(false); // resets the targetChanged flag
|
||||||
return true;
|
return true;
|
||||||
|
@ -122,7 +113,7 @@ class PsychicBattleTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
class PsychicBattleEffect extends OneShotEffect {
|
class PsychicBattleEffect extends OneShotEffect {
|
||||||
|
|
||||||
public PsychicBattleEffect() {
|
public PsychicBattleEffect() {
|
||||||
super(Outcome.Neutral);
|
super(Outcome.Benefit);
|
||||||
this.staticText = "each player reveals the top card of his or her library. The player who reveals the card with the highest converted mana cost may change the target or targets. If two or more cards are tied for highest cost, the target or targets remain unchanged";
|
this.staticText = "each player reveals the top card of his or her library. The player who reveals the card with the highest converted mana cost may change the target or targets. If two or more cards are tied for highest cost, the target or targets remain unchanged";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
this.resolving = spell.resolving;
|
this.resolving = spell.resolving;
|
||||||
|
|
||||||
this.doneActivatingManaAbilities = spell.doneActivatingManaAbilities;
|
this.doneActivatingManaAbilities = spell.doneActivatingManaAbilities;
|
||||||
|
this.targetChanged = spell.targetChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean activate(Game game, boolean noMana) {
|
public boolean activate(Game game, boolean noMana) {
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class StackAbility extends StackObjImpl implements Ability {
|
||||||
this.name = stackAbility.name;
|
this.name = stackAbility.name;
|
||||||
this.expansionSetCode = stackAbility.expansionSetCode;
|
this.expansionSetCode = stackAbility.expansionSetCode;
|
||||||
this.targetAdjustment = stackAbility.targetAdjustment;
|
this.targetAdjustment = stackAbility.targetAdjustment;
|
||||||
|
this.targetChanged = stackAbility.targetChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.stack;
|
package mage.game.stack;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Abilities;
|
import mage.abilities.Abilities;
|
||||||
import mage.abilities.AbilitiesImpl;
|
import mage.abilities.AbilitiesImpl;
|
||||||
|
@ -19,16 +21,13 @@ import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetAmount;
|
import mage.target.TargetAmount;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public abstract class StackObjImpl implements StackObject {
|
public abstract class StackObjImpl implements StackObject {
|
||||||
|
|
||||||
private boolean targetChanged; // for Psychic Battle
|
protected boolean targetChanged; // for Psychic Battle
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Choose new targets for a stack Object
|
* Choose new targets for a stack Object
|
||||||
|
@ -74,12 +73,11 @@ public abstract class StackObjImpl implements StackObject {
|
||||||
* the change is legal.
|
* the change is legal.
|
||||||
*
|
*
|
||||||
* Example: Arc Trail is a sorcery that reads "Arc Trail deals 2 damage to
|
* Example: Arc Trail is a sorcery that reads "Arc Trail deals 2 damage to
|
||||||
* any target and 1 damage to another target creature or
|
* any target and 1 damage to another target creature or player." The
|
||||||
* player." The current targets of Arc Trail are Runeclaw Bear and Llanowar
|
* current targets of Arc Trail are Runeclaw Bear and Llanowar Elves, in
|
||||||
* Elves, in that order. You cast Redirect, an instant that reads "You may
|
* that order. You cast Redirect, an instant that reads "You may choose new
|
||||||
* choose new targets for target spell," targeting Arc Trail. You can change
|
* targets for target spell," targeting Arc Trail. You can change the first
|
||||||
* the first target to Llanowar Elves and change the second target to
|
* target to Llanowar Elves and change the second target to Runeclaw Bear.
|
||||||
* Runeclaw Bear.
|
|
||||||
*
|
*
|
||||||
* 114.7. Modal spells and abilities may have different targeting
|
* 114.7. Modal spells and abilities may have different targeting
|
||||||
* requirements for each mode. An effect that allows a player to change the
|
* requirements for each mode. An effect that allows a player to change the
|
||||||
|
|
Loading…
Add table
Reference in a new issue