From 78e744853e0e2aabc3ec0204797cb68afdfb1169 Mon Sep 17 00:00:00 2001 From: melvin Date: Thu, 1 Sep 2011 21:58:00 +0800 Subject: [PATCH] changed to more specific version of executeTrigger --- src/magic/card/Ajani_s_Mantra.java | 2 +- src/magic/card/Ajani_s_Pridemate.java | 4 ++-- src/magic/card/Angel_s_Feather.java | 4 ++-- src/magic/card/Arc_Runner.java | 2 +- src/magic/card/Archon_of_Justice.java | 6 ++++-- src/magic/card/Armadillo_Cloak.java | 3 +-- src/magic/card/Aven_Mimeomancer.java | 3 ++- src/magic/card/Awakening_Zone.java | 2 +- src/magic/card/Balefire_Liege.java | 4 ++-- src/magic/card/Belltower_Sphinx.java | 3 +-- src/magic/card/Bitterblossom.java | 2 +- src/magic/card/Blood_Seeker.java | 3 +-- src/magic/card/Butcher_of_Malakir.java | 3 +-- src/magic/card/Call_to_the_Grave.java | 3 +-- src/magic/card/Chandra_s_Spitfire.java | 3 +-- src/magic/card/Creakwood_Liege.java | 2 +- src/magic/card/Deathbringer_Liege.java | 4 ++-- 17 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/magic/card/Ajani_s_Mantra.java b/src/magic/card/Ajani_s_Mantra.java index ed932077a3..3013c81691 100644 --- a/src/magic/card/Ajani_s_Mantra.java +++ b/src/magic/card/Ajani_s_Mantra.java @@ -11,7 +11,7 @@ import magic.model.trigger.MagicTriggerType; public class Ajani_s_Mantra { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) { @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(); if (player==data) { return new MagicEvent( diff --git a/src/magic/card/Ajani_s_Pridemate.java b/src/magic/card/Ajani_s_Pridemate.java index 8f90e9240c..6fa206f473 100644 --- a/src/magic/card/Ajani_s_Pridemate.java +++ b/src/magic/card/Ajani_s_Pridemate.java @@ -12,9 +12,9 @@ import magic.model.trigger.MagicTriggerType; public class Ajani_s_Pridemate { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenLifeIsGained) { @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(); - if (player == (MagicPlayer)data) { + if (player == data) { return new MagicEvent( permanent, permanent.getController(), diff --git a/src/magic/card/Angel_s_Feather.java b/src/magic/card/Angel_s_Feather.java index 0d195ec7b4..42ccc420c8 100644 --- a/src/magic/card/Angel_s_Feather.java +++ b/src/magic/card/Angel_s_Feather.java @@ -15,9 +15,9 @@ import magic.model.trigger.MagicTriggerType; public class Angel_s_Feather { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) { @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 MagicCard card = ((MagicCardOnStack)data).getCard(); + final MagicCard card = data.getCard(); return (MagicColor.White.hasColor(card.getColorFlags())) ? new MagicEvent( permanent, diff --git a/src/magic/card/Arc_Runner.java b/src/magic/card/Arc_Runner.java index 20d8888ba3..96bf73a9f6 100644 --- a/src/magic/card/Arc_Runner.java +++ b/src/magic/card/Arc_Runner.java @@ -11,7 +11,7 @@ import magic.model.trigger.MagicTriggerType; public class Arc_Runner { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtEndOfTurn) { @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(); if (player == data) { return new MagicEvent( diff --git a/src/magic/card/Archon_of_Justice.java b/src/magic/card/Archon_of_Justice.java index 7c683f451e..93aa42e746 100644 --- a/src/magic/card/Archon_of_Justice.java +++ b/src/magic/card/Archon_of_Justice.java @@ -15,8 +15,10 @@ import magic.model.trigger.MagicTriggerType; public class Archon_of_Justice { public static final MagicTrigger T =new MagicTrigger(MagicTriggerType.WhenPutIntoGraveyard) { @Override - public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) { - final MagicGraveyardTriggerData triggerData=(MagicGraveyardTriggerData)data; + public MagicEvent executeTrigger( + final MagicGame game, + final MagicPermanent permanent, + final MagicGraveyardTriggerData triggerData) { return (MagicLocationType.Play==triggerData.fromLocation) ? new MagicEvent( permanent, diff --git a/src/magic/card/Armadillo_Cloak.java b/src/magic/card/Armadillo_Cloak.java index c3e53a3f27..355509652e 100644 --- a/src/magic/card/Armadillo_Cloak.java +++ b/src/magic/card/Armadillo_Cloak.java @@ -20,8 +20,7 @@ public class Armadillo_Cloak { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) { @Override - public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) { - final MagicDamage damage=(MagicDamage)data; + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) { if (permanent.getEnchantedCreature()==damage.getSource()) { final MagicPlayer player=permanent.getController(); final int amount=damage.getDealtAmount(); diff --git a/src/magic/card/Aven_Mimeomancer.java b/src/magic/card/Aven_Mimeomancer.java index 3a8e68baf5..ab911f6f2e 100644 --- a/src/magic/card/Aven_Mimeomancer.java +++ b/src/magic/card/Aven_Mimeomancer.java @@ -2,6 +2,7 @@ package magic.card; import magic.model.MagicCounterType; import magic.model.MagicGame; +import magic.model.MagicPlayer; import magic.model.MagicPermanent; import magic.model.action.MagicChangeCountersAction; import magic.model.action.MagicPermanentAction; @@ -15,7 +16,7 @@ import magic.model.trigger.MagicTriggerType; public class Aven_Mimeomancer { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) { @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) ? new MagicEvent( permanent, diff --git a/src/magic/card/Awakening_Zone.java b/src/magic/card/Awakening_Zone.java index 8b29c2289d..1e91bd365a 100644 --- a/src/magic/card/Awakening_Zone.java +++ b/src/magic/card/Awakening_Zone.java @@ -12,7 +12,7 @@ import magic.model.trigger.MagicTriggerType; public class Awakening_Zone { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) { @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(); return (player==data) ? new MagicEvent( diff --git a/src/magic/card/Balefire_Liege.java b/src/magic/card/Balefire_Liege.java index 72b80ed381..a3d5442bad 100644 --- a/src/magic/card/Balefire_Liege.java +++ b/src/magic/card/Balefire_Liege.java @@ -18,9 +18,9 @@ import magic.model.trigger.MagicTriggerType; public class Balefire_Liege { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) { @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 MagicCard card=((MagicCardOnStack)data).getCard(); + final MagicCard card=data.getCard(); return (card.getOwner()==player&&MagicColor.Red.hasColor(card.getColorFlags())) ? new MagicEvent( permanent, diff --git a/src/magic/card/Belltower_Sphinx.java b/src/magic/card/Belltower_Sphinx.java index df53034c72..e3d1f63efb 100644 --- a/src/magic/card/Belltower_Sphinx.java +++ b/src/magic/card/Belltower_Sphinx.java @@ -11,8 +11,7 @@ import magic.model.trigger.MagicTriggerType; public class Belltower_Sphinx { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) { @Override - public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) { - final MagicDamage damage = (MagicDamage)data; + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) { final int amount = damage.getDealtAmount(); if (damage.getTarget() == permanent) { game.doAction(new MagicMillLibraryAction(damage.getSource().getController(),amount)); diff --git a/src/magic/card/Bitterblossom.java b/src/magic/card/Bitterblossom.java index e89e74e5f9..4cf4b0e136 100644 --- a/src/magic/card/Bitterblossom.java +++ b/src/magic/card/Bitterblossom.java @@ -13,7 +13,7 @@ import magic.model.trigger.MagicTriggerType; public class Bitterblossom { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) { @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(); if (player==data) { return new MagicEvent( diff --git a/src/magic/card/Blood_Seeker.java b/src/magic/card/Blood_Seeker.java index f5c8260741..467f166bb3 100644 --- a/src/magic/card/Blood_Seeker.java +++ b/src/magic/card/Blood_Seeker.java @@ -11,8 +11,7 @@ import magic.model.trigger.MagicTriggerType; public class Blood_Seeker { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenOtherComesIntoPlay) { @Override - public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) { - final MagicPermanent otherPermanent=(MagicPermanent)data; + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent otherPermanent) { final MagicPlayer player=permanent.getController(); final MagicPlayer controller=otherPermanent.getController(); return (otherPermanent!=permanent&&otherPermanent.isCreature()&&controller!=player) ? diff --git a/src/magic/card/Butcher_of_Malakir.java b/src/magic/card/Butcher_of_Malakir.java index 873a3ab19a..43f749f311 100644 --- a/src/magic/card/Butcher_of_Malakir.java +++ b/src/magic/card/Butcher_of_Malakir.java @@ -16,8 +16,7 @@ public class Butcher_of_Malakir { public static final MagicTrigger T1 = new MagicTrigger(MagicTriggerType.WhenPutIntoGraveyard) { @Override - public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) { - final MagicGraveyardTriggerData triggerData=(MagicGraveyardTriggerData)data; + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicGraveyardTriggerData triggerData) { final MagicPlayer controller = (permanent != null) ? permanent.getController() : null; return (MagicLocationType.Play==triggerData.fromLocation) ? new MagicEvent( diff --git a/src/magic/card/Call_to_the_Grave.java b/src/magic/card/Call_to_the_Grave.java index dd58a537bf..28bd8120a1 100644 --- a/src/magic/card/Call_to_the_Grave.java +++ b/src/magic/card/Call_to_the_Grave.java @@ -18,8 +18,7 @@ import java.util.Collection; public class Call_to_the_Grave { public static final MagicTrigger T1 = new MagicTrigger(MagicTriggerType.AtUpkeep) { @Override - public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) { - final MagicPlayer player = (MagicPlayer)data; + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer player) { return new MagicEvent( permanent, player, diff --git a/src/magic/card/Chandra_s_Spitfire.java b/src/magic/card/Chandra_s_Spitfire.java index 2d9aa22d91..cd5dec27cf 100644 --- a/src/magic/card/Chandra_s_Spitfire.java +++ b/src/magic/card/Chandra_s_Spitfire.java @@ -13,9 +13,8 @@ import magic.model.trigger.MagicTriggerType; public class Chandra_s_Spitfire { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenDamageIsDealt) { @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 MagicDamage damage=(MagicDamage)data; final MagicTarget target=damage.getTarget(); return (!damage.isCombat()&&target.isPlayer()&&target!=player) ? new MagicEvent( diff --git a/src/magic/card/Creakwood_Liege.java b/src/magic/card/Creakwood_Liege.java index 30a88c1a32..98189bc33c 100644 --- a/src/magic/card/Creakwood_Liege.java +++ b/src/magic/card/Creakwood_Liege.java @@ -12,7 +12,7 @@ import magic.model.trigger.MagicTriggerType; public class Creakwood_Liege { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.AtUpkeep) { @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(); return (player==data) ? new MagicEvent( diff --git a/src/magic/card/Deathbringer_Liege.java b/src/magic/card/Deathbringer_Liege.java index 1a662c1841..dc19c85703 100644 --- a/src/magic/card/Deathbringer_Liege.java +++ b/src/magic/card/Deathbringer_Liege.java @@ -20,9 +20,9 @@ import magic.model.trigger.MagicTriggerType; public class Deathbringer_Liege { public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenSpellIsPlayed) { @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 MagicCard card=((MagicCardOnStack)data).getCard(); + final MagicCard card=data.getCard(); return (card.getOwner()==player&&MagicColor.Black.hasColor(card.getColorFlags())) ? new MagicEvent( permanent,