Hypnotic Specter, Shadowmage Infiltrator, etc.

I finally managed to do this the right way, with a stacktrace. We can add tons and tons of new cards now
in Combat.java add the line "GameActionUtil.executePlayerCombatDamageEffects(att.get(i));", after the if, like so:

in Combat.java add the line "GameActionUtil.executePlayerCombatDamageEffects(att.get(i));", after the if, like so:
- Code: Select all
public void setDefendingDamage()
{
defendingDamage = 0;
CardList att = new CardList(getAttackers());
//sum unblocked attackers' power
for(int i = 0; i < att.size(); i++)
if(! isBlocked(att.get(i))) {
defendingDamage += att.get(i).getAttack();
GameActionUtil.executePlayerCombatDamageEffects(att.get(i));
}
}
- Code: Select all
public static void executePlayerCombatDamageEffects(Card c)
{
if (c.getName().equals("Hypnotic Specter"))
playerCombatDamage_Hypnotic_Specter(c);
else if (c.getName().equals("Shadowmage Infiltrator") || c.getName().equals("Thieving Magpie"))
playerCombatDamage_Shadowmage_Infiltrator(c);
//etc. etc. etc. ... add more cards here .....
}
// ....
private static void playerCombatDamage_Shadowmage_Infiltrator(Card c)
{
final String player = c.getController();
Ability ability2 = new Ability(c, "0")
{
public void resolve()
{
//System.out.println("hello");
AllZone.GameAction.drawCard(player);
}
};//ability2
ability2.setStackDescription(c.getName() + " - " + player + " draws a card.");
AllZone.Stack.add(ability2);
}
private static void playerCombatDamage_Hypnotic_Specter(Card c)
{
final String player = c.getController();
final String opponent = AllZone.GameAction.getOpponent(player);
Ability ability = new Ability(c, "0")
{
public void resolve()
{
AllZone.GameAction.discardRandom(opponent);
}
};//ability
ability.setStackDescription("Hypnotic Specter - " +opponent +" discards one card at random");
AllZone.Stack.add(ability);
}