changed to more specific version of executeTrigger
parent
64b08dedd7
commit
78e744853e
|
@ -11,7 +11,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Ajani_s_Mantra {
|
public class Ajani_s_Mantra {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
if (player==data) {
|
if (player==data) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
|
|
|
@ -12,9 +12,9 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Ajani_s_Pridemate {
|
public class Ajani_s_Pridemate {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenLifeIsGained) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenLifeIsGained) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||||
final MagicPlayer player = permanent.getController();
|
final MagicPlayer player = permanent.getController();
|
||||||
if (player == (MagicPlayer)data) {
|
if (player == data) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
permanent.getController(),
|
||||||
|
|
|
@ -15,9 +15,9 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Angel_s_Feather {
|
public class Angel_s_Feather {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack data) {
|
||||||
final MagicPlayer player = permanent.getController();
|
final MagicPlayer player = permanent.getController();
|
||||||
final MagicCard card = ((MagicCardOnStack)data).getCard();
|
final MagicCard card = data.getCard();
|
||||||
return (MagicColor.White.hasColor(card.getColorFlags())) ?
|
return (MagicColor.White.hasColor(card.getColorFlags())) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Arc_Runner {
|
public class Arc_Runner {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtEndOfTurn) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtEndOfTurn) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||||
final MagicPlayer player = permanent.getController();
|
final MagicPlayer player = permanent.getController();
|
||||||
if (player == data) {
|
if (player == data) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
|
|
|
@ -15,8 +15,10 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Archon_of_Justice {
|
public class Archon_of_Justice {
|
||||||
public static final MagicTrigger T =new MagicTrigger(MagicTriggerType.WhenPutIntoGraveyard) {
|
public static final MagicTrigger T =new MagicTrigger(MagicTriggerType.WhenPutIntoGraveyard) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(
|
||||||
final MagicGraveyardTriggerData triggerData=(MagicGraveyardTriggerData)data;
|
final MagicGame game,
|
||||||
|
final MagicPermanent permanent,
|
||||||
|
final MagicGraveyardTriggerData triggerData) {
|
||||||
return (MagicLocationType.Play==triggerData.fromLocation) ?
|
return (MagicLocationType.Play==triggerData.fromLocation) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
|
|
|
@ -20,8 +20,7 @@ public class Armadillo_Cloak {
|
||||||
|
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
|
||||||
final MagicDamage damage=(MagicDamage)data;
|
|
||||||
if (permanent.getEnchantedCreature()==damage.getSource()) {
|
if (permanent.getEnchantedCreature()==damage.getSource()) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
final int amount=damage.getDealtAmount();
|
final int amount=damage.getDealtAmount();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package magic.card;
|
||||||
|
|
||||||
import magic.model.MagicCounterType;
|
import magic.model.MagicCounterType;
|
||||||
import magic.model.MagicGame;
|
import magic.model.MagicGame;
|
||||||
|
import magic.model.MagicPlayer;
|
||||||
import magic.model.MagicPermanent;
|
import magic.model.MagicPermanent;
|
||||||
import magic.model.action.MagicChangeCountersAction;
|
import magic.model.action.MagicChangeCountersAction;
|
||||||
import magic.model.action.MagicPermanentAction;
|
import magic.model.action.MagicPermanentAction;
|
||||||
|
@ -15,7 +16,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Aven_Mimeomancer {
|
public class Aven_Mimeomancer {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||||
return (permanent.getController()==data) ?
|
return (permanent.getController()==data) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Awakening_Zone {
|
public class Awakening_Zone {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
return (player==data) ?
|
return (player==data) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
|
|
|
@ -18,9 +18,9 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Balefire_Liege {
|
public class Balefire_Liege {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack data) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
final MagicCard card=((MagicCardOnStack)data).getCard();
|
final MagicCard card=data.getCard();
|
||||||
return (card.getOwner()==player&&MagicColor.Red.hasColor(card.getColorFlags())) ?
|
return (card.getOwner()==player&&MagicColor.Red.hasColor(card.getColorFlags())) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
|
|
|
@ -11,8 +11,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Belltower_Sphinx {
|
public class Belltower_Sphinx {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
|
||||||
final MagicDamage damage = (MagicDamage)data;
|
|
||||||
final int amount = damage.getDealtAmount();
|
final int amount = damage.getDealtAmount();
|
||||||
if (damage.getTarget() == permanent) {
|
if (damage.getTarget() == permanent) {
|
||||||
game.doAction(new MagicMillLibraryAction(damage.getSource().getController(),amount));
|
game.doAction(new MagicMillLibraryAction(damage.getSource().getController(),amount));
|
||||||
|
|
|
@ -13,7 +13,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Bitterblossom {
|
public class Bitterblossom {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
if (player==data) {
|
if (player==data) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
|
|
|
@ -11,8 +11,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Blood_Seeker {
|
public class Blood_Seeker {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenOtherComesIntoPlay) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenOtherComesIntoPlay) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent otherPermanent) {
|
||||||
final MagicPermanent otherPermanent=(MagicPermanent)data;
|
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
final MagicPlayer controller=otherPermanent.getController();
|
final MagicPlayer controller=otherPermanent.getController();
|
||||||
return (otherPermanent!=permanent&&otherPermanent.isCreature()&&controller!=player) ?
|
return (otherPermanent!=permanent&&otherPermanent.isCreature()&&controller!=player) ?
|
||||||
|
|
|
@ -16,8 +16,7 @@ public class Butcher_of_Malakir {
|
||||||
|
|
||||||
public static final MagicTrigger T1 = new MagicTrigger(MagicTriggerType.WhenPutIntoGraveyard) {
|
public static final MagicTrigger T1 = new MagicTrigger(MagicTriggerType.WhenPutIntoGraveyard) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicGraveyardTriggerData triggerData) {
|
||||||
final MagicGraveyardTriggerData triggerData=(MagicGraveyardTriggerData)data;
|
|
||||||
final MagicPlayer controller = (permanent != null) ? permanent.getController() : null;
|
final MagicPlayer controller = (permanent != null) ? permanent.getController() : null;
|
||||||
return (MagicLocationType.Play==triggerData.fromLocation) ?
|
return (MagicLocationType.Play==triggerData.fromLocation) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
|
|
|
@ -18,8 +18,7 @@ import java.util.Collection;
|
||||||
public class Call_to_the_Grave {
|
public class Call_to_the_Grave {
|
||||||
public static final MagicTrigger T1 = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
public static final MagicTrigger T1 = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer player) {
|
||||||
final MagicPlayer player = (MagicPlayer)data;
|
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
player,
|
||||||
|
|
|
@ -13,9 +13,8 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Chandra_s_Spitfire {
|
public class Chandra_s_Spitfire {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
final MagicDamage damage=(MagicDamage)data;
|
|
||||||
final MagicTarget target=damage.getTarget();
|
final MagicTarget target=damage.getTarget();
|
||||||
return (!damage.isCombat()&&target.isPlayer()&&target!=player) ?
|
return (!damage.isCombat()&&target.isPlayer()&&target!=player) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
|
|
|
@ -12,7 +12,7 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Creakwood_Liege {
|
public class Creakwood_Liege {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
return (player==data) ?
|
return (player==data) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
|
|
|
@ -20,9 +20,9 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
public class Deathbringer_Liege {
|
public class Deathbringer_Liege {
|
||||||
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) {
|
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack data) {
|
||||||
final MagicPlayer player=permanent.getController();
|
final MagicPlayer player=permanent.getController();
|
||||||
final MagicCard card=((MagicCardOnStack)data).getCard();
|
final MagicCard card=data.getCard();
|
||||||
return (card.getOwner()==player&&MagicColor.Black.hasColor(card.getColorFlags())) ?
|
return (card.getOwner()==player&&MagicColor.Black.hasColor(card.getColorFlags())) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
|
|
Loading…
Reference in New Issue