Stack question - implementing Bottle of Suleiman

Hi all,
I'm trying to implement Bottle of Suleiman. It works, but the game flow could be a bit better I think.
Basically, what I think I want to do is this:
1) activate the ability
2) put something on the Stack like "Bottle of Suleiman - flip a coin"
3) hit OK for the stack
4) pop a choice for Heads or Tails
5) Indicate in some way the result
For step 5, what is the accepted way to do something like this. I don't think it belongs on the stack. I don't think it goes in the Message Box where all the Phase info is displayed. Should this just pop a generic message box with the result?
Currently, it works as 1-4. The only indication you have of won or lost is if you have a new Djinn, or lost 5 life. And maybe this is ok.
Here is the current code:
cards.txt:
-slapshot5
I'm trying to implement Bottle of Suleiman. It works, but the game flow could be a bit better I think.
Basically, what I think I want to do is this:
1) activate the ability
2) put something on the Stack like "Bottle of Suleiman - flip a coin"
3) hit OK for the stack
4) pop a choice for Heads or Tails
5) Indicate in some way the result
For step 5, what is the accepted way to do something like this. I don't think it belongs on the stack. I don't think it goes in the Message Box where all the Phase info is displayed. Should this just pop a generic message box with the result?
Currently, it works as 1-4. The only indication you have of won or lost is if you have a new Djinn, or lost 5 life. And maybe this is ok.
Here is the current code:
cards.txt:
- Code: Select all
Bottle of Suleiman
4
Artifact
no text
- Code: Select all
//*************** START *********** START **************************
if(cardName.equals("Bottle of Suleiman")) {
final SpellAbility ability = new Ability_Activated(card, "1") {
private static final long serialVersionUID = -5741302550353410000L;
public boolean canPlayAI() {
//should do something like ok if CompLife > 10 or something
//or life greater than 5 or have no creatures
return false;
}
public void resolve() {
String choice = "";
String choices[] = {"heads","tails"};
boolean flip = MyRandom.percentTrue(50);
if(card.getController().equals(Constant.Player.Human)) {
choice = (String) AllZone.Display.getChoice("Choose one", choices);
}
else {
choice = choices[MyRandom.random.nextInt(2)];
}
AllZone.GameAction.sacrifice(card);
if( (flip == true && choice.equals("heads")) ||
(flip == false && choice.equals("tails"))) {
CardFactoryUtil.makeToken("Djinn", "", card, "0", new String[] {"Creature", "Artifact", "Djinn"}, 5, 5, new String[] {"Flying"});
}
else{
AllZone.GameAction.addDamage(card.getController(), 5, card);
}
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("1: Flip a coin. Win: Put 5/5 Djinn in play. Lose: Does 5 damage to you.");
ability.setStackDescription("Bottle of Suleiman - flip a coin");
//ability.setBeforePayMana(new Input_NoCost_TapAbility(ability));
}//*************** END ************ END **************************
-slapshot5