- Conversion to StringBuilder. Still working on GameActionUtil.java.

This commit is contained in:
jendave
2011-08-06 09:49:53 +00:00
parent bf0129a7bd
commit 8dc320fa54

View File

@@ -206,7 +206,7 @@ public class GameActionUtil {
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
}//for }//for
} }//end Lifeblood
if(c.getType().contains("Forest")) { if(c.getType().contains("Forest")) {
final Player opponent = c.getController().getOpponent(); final Player opponent = c.getController().getOpponent();
@@ -227,7 +227,7 @@ public class GameActionUtil {
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
}//for }//for
} }//end Lifetap
/* /*
* Blight - When enchanted land becomes tapped, destroy it. * Blight - When enchanted land becomes tapped, destroy it.
@@ -375,10 +375,15 @@ public class GameActionUtil {
source.getController().addDamage(1, crd); source.getController().addDamage(1, crd);
} }
};//Ability };//Ability
ability.setStackDescription(decree.getName()+" - does 1 damage to "+c.getController()+". ("+c.getName()+" was tapped.)");
StringBuilder sb = new StringBuilder();
sb.append(decree.getName()).append(" - does 1 damage to ").append(c.getController());
sb.append(". (").append(c.getName()).append(" was tapped.)");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
}//for }//for
} }//end Royal Decree
}//end executeTapSideEffects() }//end executeTapSideEffects()
@@ -406,7 +411,12 @@ public class GameActionUtil {
} }
} }
};//Ability };//Ability
ability.setStackDescription(orb.getName()+" - "+c+" was untapped, "+controller+" puts top card of library into graveyard.");
StringBuilder sb = new StringBuilder();
sb.append(orb.getName()).append(" - ").append(c).append(" was untapped, ");
sb.append(controller).append(" puts top card of library into graveyard.");
ability.setStackDescription(sb.toString());
if(AllZoneUtil.getPlayerCardsInLibrary(controller).size() > 0) { if(AllZoneUtil.getPlayerCardsInLibrary(controller).size() > 0) {
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
@@ -439,7 +449,12 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
};//Ability };//Ability
ability.setStackDescription(crd.getName()+" - gets +1/+1 until end of turn. ("+c+" was untapped.)");
StringBuilder sb = new StringBuilder();
sb.append(crd.getName()).append(" - gets +1/+1 until end of turn. (");
sb.append(c).append(" was untapped.)");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
}//for }//for
}//end Wake Thrasher }//end Wake Thrasher
@@ -579,7 +594,11 @@ public class GameActionUtil {
AllZone.Phase.addExtraTurn(controller); AllZone.Phase.addExtraTurn(controller);
} }
}; };
ability.setStackDescription(c + " - When you cast Emrakul, take an extra turn after this one.");
StringBuilder sb = new StringBuilder();
sb.append(c).append(" - When you cast Emrakul, take an extra turn after this one.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
@@ -621,7 +640,10 @@ public class GameActionUtil {
} }
} }
}; };
ability.setStackDescription(c + " - you may return target creature card from your graveyard to the battlefield."); StringBuilder sb = new StringBuilder();
sb.append(c).append(" - you may return target creature card from your graveyard to the battlefield.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
@@ -727,7 +749,10 @@ public class GameActionUtil {
} }
} }
}; };
ability.setStackDescription(c + " - Cascade."); StringBuilder sb = new StringBuilder();
sb.append(c).append(" - Cascade.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
}; };
@@ -832,13 +857,16 @@ public class GameActionUtil {
} }
} }
}; };
ability.setStackDescription(c + " - Ripple."); StringBuilder sb = new StringBuilder();
sb.append(c).append(" - Ripple.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
} }
}; };
Ripple.execute(); Ripple.execute();
} }//playCard_Ripple()
public static void playCard_Storm(Card c) { public static void playCard_Storm(Card c) {
if(c.getKeyword().contains("Storm") && !c.isCopiedSpell()) if(c.getKeyword().contains("Storm") && !c.isCopiedSpell())
@@ -853,10 +881,13 @@ public class GameActionUtil {
}; // For }; // For
} }
}; };
Storm.setStackDescription(c + " - Storm."); StringBuilder sb = new StringBuilder();
sb.append(c).append(" - Storm.");
Storm.setStackDescription(sb.toString());
AllZone.Stack.add(Storm); AllZone.Stack.add(Storm);
} }
} }//playCard_Storm()
public static void playCard_Vengevine(Card c) { public static void playCard_Vengevine(Card c) {
if (c.isCreature() == true && (Phase.PlayerCreatureSpellCount == 2 || Phase.ComputerCreatureSpellCount == 2)) if (c.isCreature() == true && (Phase.PlayerCreatureSpellCount == 2 || Phase.ComputerCreatureSpellCount == 2))
@@ -890,13 +921,17 @@ public class GameActionUtil {
} }
} }
}; // ability }; // ability
ability.setStackDescription(card.getName() + " - " + "Whenever you cast a spell, if it's the second creature spell you cast this turn, you may return Vengevine from your graveyard to the battlefield."); StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" - ").append("Whenever you cast a spell, if it's the second creature ");
sb.append("spell you cast this turn, you may return Vengevine from your graveyard to the battlefield.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
}//if }//if
}
} }
} }//playCard_Vengevine()
}
public static void playCard_Hand_of_the_Praetors(Card c) public static void playCard_Hand_of_the_Praetors(Card c)
{ {
@@ -1062,9 +1097,12 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a black spell, Emberstrike Duo gets +1/+1 until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a black spell, Emberstrike Duo gets +1/+1 until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
@@ -1091,14 +1129,16 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a red spell, Emberstrike Duo gains first strike until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a red spell, Emberstrike Duo gains first strike until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
}//Emberstrike Duo }//Emberstrike Duo
public static void playCard_Gravelgill_Duo(Card c) { public static void playCard_Gravelgill_Duo(Card c) {
@@ -1136,9 +1176,12 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a blue spell, Gravelgill Duo gets +1/+1 until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a blue spell, Gravelgill Duo gets +1/+1 until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
@@ -1165,14 +1208,16 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a black spell, Emberstrike Duo gains fear until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a black spell, Emberstrike Duo gains fear until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
}//Gravelgill Duo }//Gravelgill Duo
public static void playCard_Chalice_of_the_Void(Card c) { public static void playCard_Chalice_of_the_Void(Card c) {
@@ -1181,25 +1226,26 @@ public class GameActionUtil {
if(list.size() > 0) { if(list.size() > 0) {
for(int i = 0; i < list.size(); i++) { for(int i = 0; i < list.size(); i++) {
final Card card = list.get(i); final Card card = list.get(i);
final SpellAbility sa = AllZone.Stack.peek(); final SpellAbility sa = AllZone.Stack.peek();
Ability ability2 = new Ability(card, "0") { Ability ability2 = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
AllZone.Stack.pop(); AllZone.Stack.pop();
AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a spell with same amount of charge counters on Chalice of the Void. The spell is countered"); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a spell with same amount of charge counters on Chalice of the Void. The spell is countered");
ability2.setStackDescription(sb2.toString());
int convertedManaSpell = CardUtil.getConvertedManaCost(sa.getSourceCard().getManaCost());
if(sa.isSpell() == true && card.getCounters(Counters.CHARGE) == convertedManaSpell) AllZone.Stack.add(ability2); int convertedManaSpell = CardUtil.getConvertedManaCost(sa.getSourceCard().getManaCost());
} if(sa.isSpell() == true && card.getCounters(Counters.CHARGE) == convertedManaSpell) AllZone.Stack.add(ability2);
}//if }
} // Chalice_of_the_Void }//if
} // Chalice_of_the_Void
public static void playCard_Safehold_Duo(Card c) { public static void playCard_Safehold_Duo(Card c) {
final Player controller = c.getController(); final Player controller = c.getController();
@@ -1222,8 +1268,6 @@ public class GameActionUtil {
if(AllZone.GameAction.isCardInPlay(card)) { if(AllZone.GameAction.isCardInPlay(card)) {
card.addTempAttackBoost(-1); card.addTempAttackBoost(-1);
card.addTempDefenseBoost(-1); card.addTempDefenseBoost(-1);
} }
} }
}; };
@@ -1236,9 +1280,12 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a green spell, Safehold Duo gets +1/+1 until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a green spell, Safehold Duo gets +1/+1 until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
@@ -1265,14 +1312,16 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a white spell, Safehold Duo gains vigilance until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a white spell, Safehold Duo gains vigilance until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
}//Safehold Duo }//Safehold Duo
public static void playCard_Tattermunge_Duo(Card c) { public static void playCard_Tattermunge_Duo(Card c) {
@@ -1296,8 +1345,6 @@ public class GameActionUtil {
if(AllZone.GameAction.isCardInPlay(card)) { if(AllZone.GameAction.isCardInPlay(card)) {
card.addTempAttackBoost(-1); card.addTempAttackBoost(-1);
card.addTempDefenseBoost(-1); card.addTempDefenseBoost(-1);
} }
} }
}; };
@@ -1310,9 +1357,12 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a red spell, Tattermunge Duo gets +1/+1 until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a red spell, Tattermunge Duo gets +1/+1 until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
@@ -1327,7 +1377,6 @@ public class GameActionUtil {
public void execute() { public void execute() {
if(AllZone.GameAction.isCardInPlay(card)) { if(AllZone.GameAction.isCardInPlay(card)) {
card.removeIntrinsicKeyword("Forestwalk"); card.removeIntrinsicKeyword("Forestwalk");
} }
} }
}; };
@@ -1339,14 +1388,16 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a green spell, Tattermunge Duo gains forestwalk until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a green spell, Tattermunge Duo gains forestwalk until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
}//Tattermunge Duo }//Tattermunge Duo
public static void playCard_Thistledown_Duo(Card c) { public static void playCard_Thistledown_Duo(Card c) {
@@ -1370,8 +1421,6 @@ public class GameActionUtil {
if(AllZone.GameAction.isCardInPlay(card)) { if(AllZone.GameAction.isCardInPlay(card)) {
card.addTempAttackBoost(-1); card.addTempAttackBoost(-1);
card.addTempDefenseBoost(-1); card.addTempDefenseBoost(-1);
} }
} }
}; };
@@ -1384,9 +1433,12 @@ public class GameActionUtil {
AllZone.EndOfTurn.addUntil(untilEOT); AllZone.EndOfTurn.addUntil(untilEOT);
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb2 = new StringBuilder();
+ " played a white spell, Thistledown Duo gets +1/+1 until end of turn."); sb2.append(card.getName()).append(" - ").append(c.getController());
sb2.append(" played a white spell, Thistledown Duo gets +1/+1 until end of turn.");
ability2.setStackDescription(sb2.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if