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

This commit is contained in:
jendave
2011-08-06 09:51:45 +00:00
parent 941b021f16
commit 71994b65d3

View File

@@ -2944,8 +2944,11 @@ public class GameActionUtil {
} }
}; // ability2 }; // ability2
ability2.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb = new StringBuilder();
+ " played a blue spell, put a 1/1 blue Bird token with flying into play."); sb.append(card.getName()).append(" - ").append(c.getController());
sb.append(" played a blue spell, put a 1/1 blue Bird token with flying into play.");
ability2.setStackDescription(sb.toString());
AllZone.Stack.add(ability2); AllZone.Stack.add(ability2);
} }
}//if }//if
@@ -2963,8 +2966,11 @@ public class GameActionUtil {
} }
}; // ability }; // ability
ability.setStackDescription(card.getName() + " - " + c.getController() StringBuilder sb = new StringBuilder();
+ " played a green spell, put a 2/2 green Wolf token into play."); sb.append(card.getName()).append(" - ").append(c.getController());
sb.append(" played a green spell, put a 2/2 green Wolf token into play.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
}//if }//if
@@ -3002,8 +3008,6 @@ public class GameActionUtil {
//AllZone.GameAction.gainLife(card.getController(), 1); //AllZone.GameAction.gainLife(card.getController(), 1);
card.getController().gainLife(1); card.getController().gainLife(1);
} }
}// resolve() }// resolve()
};//ability2 };//ability2
@@ -3032,8 +3036,13 @@ public class GameActionUtil {
c.getController().subtractLife(1, card); c.getController().subtractLife(1, card);
} //resolve } //resolve
};//ability };//ability
ability.setStackDescription(card.getName() + " - " + c.getController() +
" played a "+card.getChosenColor()+" spell, " + c.getController()+" loses 1 life."); StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" - ").append(c.getController());
sb.append(" played a ").append(card.getChosenColor()).append(" spell, ");
sb.append(c.getController()).append(" loses 1 life.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
}//if }//if
@@ -3066,10 +3075,13 @@ public class GameActionUtil {
player_d.addDamage(1, F_card); player_d.addDamage(1, F_card);
//AllZone.GameAction.addDamage(player_d, F_card, 1); //AllZone.GameAction.addDamage(player_d, F_card, 1);
} }
}; };// Ability
ability.setStackDescription(list.get(i) + " - Deals 1 damage to him or her");
AllZone.Stack.add(ability);
StringBuilder sb = new StringBuilder();
sb.append(list.get(i)).append(" - Deals 1 damage to him or her");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability);
} }
} }
@@ -3083,8 +3095,12 @@ public class GameActionUtil {
public void resolve() { public void resolve() {
player.addDamage(1, source); player.addDamage(1, source);
} }
}; };// Ability
ability.setStackDescription(source + " - deals 1 damage to "+player+".");
StringBuilder sb = new StringBuilder();
sb.append(source).append(" - deals 1 damage to ").append(player).append(".");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
} }
@@ -3644,7 +3660,11 @@ public class GameActionUtil {
} }
}//resolve }//resolve
};//sacrificeCreature };//sacrificeCreature
sacrificeCreature.setStackDescription(abyss.getName()+" - destroy a nonartifact creatur of your choice.");
StringBuilder sb = new StringBuilder();
sb.append(abyss.getName()).append(" - destroy a nonartifact creatur of your choice.");
sacrificeCreature.setStackDescription(sb.toString());
if(abyss_getTargets(player,abyss).size() > 0) if(abyss_getTargets(player,abyss).size() > 0)
AllZone.Stack.add(sacrificeCreature); AllZone.Stack.add(sacrificeCreature);
}//end for }//end for
@@ -3765,7 +3785,12 @@ public class GameActionUtil {
player.addDamage(2, c); player.addDamage(2, c);
} }
}; };
sacrificeArtifact.setStackDescription(c.getName()+" - sacrifice an artifact or "+c.getName()+" becomes tapped and deals 2 damage to you.");
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - sacrifice an artifact or ");
sb.append(c.getName()).append(" becomes tapped and deals 2 damage to you.");
sacrificeArtifact.setStackDescription(sb.toString());
AllZone.Stack.add(sacrificeArtifact); AllZone.Stack.add(sacrificeArtifact);
}//end for }//end for
} }
@@ -3812,15 +3837,23 @@ public class GameActionUtil {
creatures.remove(c); creatures.remove(c);
if(creatures.size() == 0) { if(creatures.size() == 0) {
//there are no creatures to sacrifice, so we must do the 7 damage //there are no creatures to sacrifice, so we must do the 7 damage
sevenDamage.setStackDescription(c.getName()+" - deals 7 damage to controller");
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - deals 7 damage to controller");
sevenDamage.setStackDescription(sb.toString());
AllZone.Stack.add(sevenDamage); AllZone.Stack.add(sevenDamage);
} }
else { else {
sacrificeCreature.setStackDescription(c.getName()+" - sacrifice a creature.");
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - sacrifice a creature.");
sacrificeCreature.setStackDescription(sb.toString());
AllZone.Stack.add(sacrificeCreature); AllZone.Stack.add(sacrificeCreature);
} }
}//end for }//end for
} }// upkeep_Lord_of_the_Pit()
private static void upkeep_Drop_of_Honey() { private static void upkeep_Drop_of_Honey() {
/* /*
@@ -3888,11 +3921,15 @@ public class GameActionUtil {
return humanCreatures.get(0); return humanCreatures.get(0);
} }
} }
}; };// Ability
ability.setStackDescription(c.getName()+" - destroy 1 creature with lowest power.");
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - destroy 1 creature with lowest power.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
}//end for }//end for
} }// upkeep_Drop_of_Honey()
/** /**
* runs the upkeep for Genesis * runs the upkeep for Genesis
@@ -3950,7 +3987,11 @@ public class GameActionUtil {
private static final long serialVersionUID = -5102763277280782548L; private static final long serialVersionUID = -5102763277280782548L;
public void execute() { public void execute() {
ability.setStackDescription(c.getName()+" - return 1 creature from your graveyard to your hand");
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - return 1 creature from your graveyard to your hand");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
}; };
@@ -3966,7 +4007,11 @@ public class GameActionUtil {
} else //computer } else //computer
{ {
if(ComputerUtil.canPayCost(ability)) { if(ComputerUtil.canPayCost(ability)) {
ability.setStackDescription(c.getName()+" - return 1 creature from your graveyard to your hand");
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - return 1 creature from your graveyard to your hand");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
} }
@@ -4026,11 +4071,11 @@ public class GameActionUtil {
} }
} // resolve } // resolve
}; // ability }; // ability
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Wall of Reverence - ").append(player).append(" gains life equal to target creature's power."); sb.append("Wall of Reverence - ").append(player).append(" gains life equal to target creature's power.");
ability.setStackDescription(sb.toString()); ability.setStackDescription(sb.toString());
// ability.setStackDescription("Wall of Reverence - "
// + player + " gains life equal to target creature's power.");
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
}//endOfTurn_Wall_Of_Reverence() }//endOfTurn_Wall_Of_Reverence()
@@ -4075,7 +4120,11 @@ public class GameActionUtil {
AllZone.Phase.addExtraTurn(card.getController()); AllZone.Phase.addExtraTurn(card.getController());
} }
}; };
ability.setStackDescription(card + " - " +card.getController() + " takes an extra turn.");
StringBuilder sb = new StringBuilder();
sb.append(card).append(" - ").append(card.getController()).append(" takes an extra turn.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
} }
@@ -4200,7 +4249,10 @@ public class GameActionUtil {
crd.addCounter(Counters.P1P1, 1); crd.addCounter(Counters.P1P1, 1);
} }
}; };
ability.setStackDescription(c.getName() + " - Ally: gets a +1/+1 counter.");
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - Ally: gets a +1/+1 counter.");
ability.setStackDescription(sb.toString());
if(c.getController().equals(AllZone.HumanPlayer)) { if(c.getController().equals(AllZone.HumanPlayer)) {
if(showAllyDialog(c)) AllZone.Stack.add(ability); if(showAllyDialog(c)) AllZone.Stack.add(ability);
@@ -4220,9 +4272,11 @@ public class GameActionUtil {
} }
}; };
ability.setStackDescription(c.getName() + " - Ally: " + c.getController() StringBuilder sb = new StringBuilder();
+ " puts a 2/2 green Wolf creature token onto the battlefield, and adds a +1/+1 on " + c.getName() sb.append(c.getName()).append(" - Ally: ").append(c.getController());
+ "."); sb.append(" puts a 2/2 green Wolf creature token onto the battlefield, and adds a +1/+1 on ");
sb.append(c.getName()).append(".");
ability.setStackDescription(sb.toString());
if(c.getController().equals(AllZone.HumanPlayer)) { if(c.getController().equals(AllZone.HumanPlayer)) {
if(showAllyDialog(c)) AllZone.Stack.add(ability); if(showAllyDialog(c)) AllZone.Stack.add(ability);
@@ -4283,8 +4337,10 @@ public class GameActionUtil {
} }
}; };
ability.setStackDescription(c.getName() + " - Ally: Ally creatures you control gain " + keyword StringBuilder sb = new StringBuilder();
+ " until end of turn."); sb.append(c.getName()).append(" - Ally: Ally creatures you control gain ");
sb.append(keyword).append(" until end of turn.");
ability.setStackDescription(sb.toString());
if(c.getController().equals(AllZone.HumanPlayer)) { if(c.getController().equals(AllZone.HumanPlayer)) {
if(showAllyDialog(c)) AllZone.Stack.add(ability); if(showAllyDialog(c)) AllZone.Stack.add(ability);
@@ -4307,7 +4363,9 @@ public class GameActionUtil {
} }
}; };
ability.setStackDescription(c.getName() + " - Ally: gain life equal to the number of allies you control."); StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - Ally: gain life equal to the number of allies you control.");
ability.setStackDescription(sb.toString());
if(c.getController().equals(AllZone.HumanPlayer)) { if(c.getController().equals(AllZone.HumanPlayer)) {
if(showAllyDialog(c)) AllZone.Stack.add(ability); if(showAllyDialog(c)) AllZone.Stack.add(ability);
@@ -4330,9 +4388,11 @@ public class GameActionUtil {
ally.addCounter(Counters.P1P1, 1); ally.addCounter(Counters.P1P1, 1);
} }
} }
}; };// Ability
ability.setStackDescription(c.getName()
+ " - Ally: put a +1/+1 counter on each Ally creature you control."); StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - Ally: put a +1/+1 counter on each Ally creature you control.");
ability.setStackDescription(sb.toString());
if(c.getController().equals(AllZone.HumanPlayer)) { if(c.getController().equals(AllZone.HumanPlayer)) {
if(showAllyDialog(c)) AllZone.Stack.add(ability); if(showAllyDialog(c)) AllZone.Stack.add(ability);