- Removed the unnecessary code from the matchesValid function.

This commit is contained in:
Sloth
2012-01-19 09:58:23 +00:00
parent aa624ddeab
commit c2b871b668
6 changed files with 40 additions and 84 deletions

View File

@@ -3,8 +3,8 @@ ManaCost:3 B
Types:Enchantment Aura Curse Types:Enchantment Aura Curse
Text:Enchant player Text:Enchant player
A:SP$ Attach | Cost$ 3 B | ValidTgts$ Player | AILogic$ Curse A:SP$ Attach | Cost$ 3 B | ValidTgts$ Player | AILogic$ Curse
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ EnchantedPlayer | TriggerZones$ Battlefield | Execute$ TrigExile | TriggerDescription$ At the beginning of enchanted player's upkeep, that player exiles two cards from his or her graveyard. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.EnchantedBy | TriggerZones$ Battlefield | Execute$ TrigExile | TriggerDescription$ At the beginning of enchanted player's upkeep, that player exiles two cards from his or her graveyard.
SVar:TrigExile:AB$ ChangeZone | Cost$ 0 | DefinedPlayer$ EnchantedPlayer | Origin$ Graveyard | Destination$ Exile | ChangeType$ Card | ChangeNum$ 2 | Hidden$ True | Mandatory$ True SVar:TrigExile:AB$ ChangeZone | Cost$ 0 | DefinedPlayer$ Player.EnchantedBy | Origin$ Graveyard | Destination$ Exile | ChangeType$ Card | ChangeNum$ 2 | Hidden$ True | Mandatory$ True
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_oblivion.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_oblivion.jpg
SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/95.jpg SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/95.jpg

View File

@@ -1,12 +1,12 @@
Name:Curse of Stalked Prey Name:Curse of Stalked Prey
ManaCost:1 R ManaCost:1 R
Types:Enchantment Aura Curse Types:Enchantment Aura Curse
Text:Enchant player Text:Enchant player
A:SP$ Attach | Cost$ 1 R| ValidTgts$ Player | AILogic$ Curse A:SP$ Attach | Cost$ 1 R| ValidTgts$ Player | AILogic$ Curse
T:Mode$ DamageDone | ValidSource$ Creature | ValidTarget$ EnchantedPlayer | TriggerZones$ Battlefield | CombatDamage$ True | Execute$ TrigPutCounter | TriggerDescription$ Whenever a creature deals combat damage to enchanted player, put a +1/+1 counter on that creature. T:Mode$ DamageDone | ValidSource$ Creature | ValidTarget$ Player.EnchantedBy | TriggerZones$ Battlefield | CombatDamage$ True | Execute$ TrigPutCounter | TriggerDescription$ Whenever a creature deals combat damage to enchanted player, put a +1/+1 counter on that creature.
SVar:TrigPutCounter:AB$ PutCounter | Cost$ 0 | Defined$ TriggeredSource | CounterType$ P1P1 | CounterNum$ 1 SVar:TrigPutCounter:AB$ PutCounter | Cost$ 0 | Defined$ TriggeredSource | CounterType$ P1P1 | CounterNum$ 1
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_stalked_prey.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_stalked_prey.jpg
SetInfo:ISD|Rare|http://magiccards.info/scans/en/isd/136.jpg SetInfo:ISD|Rare|http://magiccards.info/scans/en/isd/136.jpg
Oracle:Enchant player\nWhenever a creature deals combat damage to enchanted player, put a +1/+1 counter on that creature. Oracle:Enchant player\nWhenever a creature deals combat damage to enchanted player, put a +1/+1 counter on that creature.
End End

View File

@@ -1,12 +1,12 @@
Name:Curse of the Bloody Tome Name:Curse of the Bloody Tome
ManaCost:2 U ManaCost:2 U
Types:Enchantment Aura Curse Types:Enchantment Aura Curse
Text:Enchant player Text:Enchant player
A:SP$ Attach | Cost$ 2 U| ValidTgts$ Player | AILogic$ Curse A:SP$ Attach | Cost$ 2 U| ValidTgts$ Player | AILogic$ Curse
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ EnchantedPlayer | TriggerZones$ Battlefield | Execute$ TrigMill | TriggerDescription$ At the beginning of enchanted player's upkeep, that player puts the top two cards of his or her library into his or her graveyard. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.EnchantedBy | TriggerZones$ Battlefield | Execute$ TrigMill | TriggerDescription$ At the beginning of enchanted player's upkeep, that player puts the top two cards of his or her library into his or her graveyard.
SVar:TrigMill:AB$ Mill | Cost$ 0 | Defined$ EnchantedPlayer | NumCards$ 2 SVar:TrigMill:AB$ Mill | Cost$ 0 | Defined$ Player.EnchantedBy | NumCards$ 2
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_the_bloody_tome.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_the_bloody_tome.jpg
SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/50.jpg SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/50.jpg
Oracle:Enchant player\nAt the beginning of enchanted player's upkeep, that player puts the top two cards of his or her library into his or her graveyard. Oracle:Enchant player\nAt the beginning of enchanted player's upkeep, that player puts the top two cards of his or her library into his or her graveyard.
End End

View File

@@ -1,12 +1,12 @@
Name:Curse of the Pierced Heart Name:Curse of the Pierced Heart
ManaCost:1 R ManaCost:1 R
Types:Enchantment Aura Curse Types:Enchantment Aura Curse
Text:Enchant player Text:Enchant player
A:SP$ Attach | Cost$ 1 R | ValidTgts$ Player | AILogic$ Curse A:SP$ Attach | Cost$ 1 R | ValidTgts$ Player | AILogic$ Curse
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ EnchantedPlayer | TriggerZones$ Battlefield | Execute$ TrigDamage | TriggerDescription$ At the beginning of enchanted player's upkeep, CARDNAME deals 1 damage to that player. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.EnchantedBy | TriggerZones$ Battlefield | Execute$ TrigDamage | TriggerDescription$ At the beginning of enchanted player's upkeep, CARDNAME deals 1 damage to that player.
SVar:TrigDamage:AB$ DealDamage | Cost$ 0 | Defined$ EnchantedPlayer | NumDmg$ 1 SVar:TrigDamage:AB$ DealDamage | Cost$ 0 | Defined$ Player.EnchantedBy | NumDmg$ 1
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_the_pierced_heart.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_the_pierced_heart.jpg
SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/138.jpg SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/138.jpg
Oracle:Enchant player\nAt the beginning of enchanted player's upkeep, Curse of the Pierced Heart deals 1 damage to that player. Oracle:Enchant player\nAt the beginning of enchanted player's upkeep, Curse of the Pierced Heart deals 1 damage to that player.
End End

View File

@@ -412,33 +412,11 @@ public abstract class AllZoneUtil {
* @return a boolean. * @return a boolean.
*/ */
public static boolean matchesValid(final Object o, final String[] valids, final Card srcCard) { public static boolean matchesValid(final Object o, final String[] valids, final Card srcCard) {
if (o instanceof Card) { if (o instanceof GameEntity) {
final Card c = (Card) o; final GameEntity c = (GameEntity) o;
return c.isValid(valids, srcCard.getController(), srcCard); return c.isValid(valids, srcCard.getController(), srcCard);
} }
if (o instanceof Player) {
for (final String v : valids) {
if (v.equalsIgnoreCase("Player") || v.equalsIgnoreCase("Each")) {
return true;
}
if (v.equalsIgnoreCase("Opponent")) {
if (o.equals(srcCard.getController().getOpponent())) {
return true;
}
}
if (v.equalsIgnoreCase("You")) {
return o.equals(srcCard.getController());
}
if (v.equalsIgnoreCase("EnchantedController")) {
return ((Player) o).isPlayer(srcCard.getEnchantingCard().getController());
}
if (v.equalsIgnoreCase("EnchantedPlayer")) {
return o.equals(srcCard.getEnchanting());
}
}
}
return false; return false;
} }

View File

@@ -1,7 +1,7 @@
package forge.card; package forge.card;
import forge.Card; import forge.Card;
import forge.Player; import forge.GameEntity;
/** /**
* Base class for Triggers and ReplacementEffects. * Base class for Triggers and ReplacementEffects.
@@ -23,33 +23,11 @@ public abstract class TriggerReplacementBase {
* @return a boolean. * @return a boolean.
*/ */
public static boolean matchesValid(final Object o, final String[] valids, final Card srcCard) { public static boolean matchesValid(final Object o, final String[] valids, final Card srcCard) {
if (o instanceof Card) { if (o instanceof GameEntity) {
final Card c = (Card) o; final GameEntity c = (GameEntity) o;
return c.isValid(valids, srcCard.getController(), srcCard); return c.isValid(valids, srcCard.getController(), srcCard);
} }
if (o instanceof Player) {
for (final String v : valids) {
if (v.equalsIgnoreCase("Player") || v.equalsIgnoreCase("Each")) {
return true;
}
if (v.equalsIgnoreCase("Opponent")) {
if (o.equals(srcCard.getController().getOpponent())) {
return true;
}
}
if (v.equalsIgnoreCase("You")) {
return o.equals(srcCard.getController());
}
if (v.equalsIgnoreCase("EnchantedController")) {
return ((Player) o).isPlayer(srcCard.getEnchantingCard().getController());
}
if (v.equalsIgnoreCase("EnchantedPlayer")) {
return o.equals(srcCard.getEnchanting());
}
}
}
return false; return false;
} }