help with Phyrexian War Beast
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
7 posts
• Page 1 of 1
help with Phyrexian War Beast
by slapshot5 » 18 Apr 2010, 05:19
Hi all,
I'm currently working on Phyrexian War Beast (among other things...)
Two parts here - when Phyrexian War Beast leaves play
1) It does one damage to controller
2) controller must sacrifice a land
First pass code implements the one damage:
CardFactory_Creatures.java:
CardFactory_Creatures.java:
Probably:
1) Immediately put both things on the stack
2) have the one damage resolve
3) ask for input for a land to sacrifice
4) have that resolve
Thoughts? Tweaks?
Thanks,
slapshot5
I'm currently working on Phyrexian War Beast (among other things...)
Two parts here - when Phyrexian War Beast leaves play
1) It does one damage to controller
2) controller must sacrifice a land
First pass code implements the one damage:
CardFactory_Creatures.java:
- Code: Select all
//*************** START *********** START **************************
else if(cardName.equals("Phyrexian War Beast")) {
/* When Phyrexian War Beast leaves the battlefield, sacrifice a land
* and Phyrexian War Beast deals 1 damage to you.
*/
final SpellAbility ability = new Spell(card) {
private static final long serialVersionUID = -3829801813561677938L;
public void resolve() {
AllZone.GameAction.addDamage(card.getController(), 1, card);
}
};
final Command oneDamage = new Command() {
private static final long serialVersionUID = -8829001394137848084L;
public void execute() {
String player = card.getController();
ability.setStackDescription(card.getName() + " - does 1 damage to "+player +"and sacrifice one land.");
AllZone.Stack.add(ability);
}//execute
};
card.addLeavesPlayCommand(oneDamage);
}//*************** END ************ END **************************
CardFactory_Creatures.java:
- Code: Select all
//*************** START *********** START **************************
else if(cardName.equals("Phyrexian War Beast")) {
/* When Phyrexian War Beast leaves the battlefield, sacrifice a land
* and Phyrexian War Beast deals 1 damage to you.
*/
final SpellAbility ability = new Spell(card) {
private static final long serialVersionUID = -3829801813561677938L;
public void resolve() {
AllZone.GameAction.addDamage(card.getController(), 1, card);
}
};
final Ability ability2 = new Ability(card, "0") {
public void resolve() {
Card c = getTargetCard();
AllZone.GameAction.sacrifice(c);
}
};
final Command sacrificeLand = new Command() {
private static final long serialVersionUID = -1793348608291550952L;
public void execute() {
AllZone.InputControl.setInput(CardFactoryUtil.input_targetType(ability2, "Land"));
ButtonUtil.disableAll();
ability.setStackDescription(card.getName() + " - sacrifice a land");
//AllZone.Stack.add(ability2);
}
};
final Command oneDamage = new Command() {
private static final long serialVersionUID = -8829001394137848084L;
public void execute() {
String player = card.getController();
ability.setStackDescription(card.getName() + " - does 1 damage to "+player +"and sacrifice one land.");
AllZone.Stack.add(ability);
}//execute
};
card.addLeavesPlayCommand(oneDamage);
card.addLeavesPlayCommand(sacrificeLand);
}//*************** END ************ END **************************
Probably:
1) Immediately put both things on the stack
2) have the one damage resolve
3) ask for input for a land to sacrifice
4) have that resolve
Thoughts? Tweaks?
Thanks,
slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: help with Phyrexian War Beast
by Rob Cashwalker » 19 Apr 2010, 15:24
I'd say to combine the two effects as one Command. The effects are part of one sentence, so they "stack" together.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: help with Phyrexian War Beast
by DennisBergkamp » 19 Apr 2010, 16:17
Yeah, I agree. Might not be 100% rules-compliant (or maybe it is ?), but in this case it's not a big deal at all.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: help with Phyrexian War Beast
by slapshot5 » 20 Apr 2010, 04:38
Ok, I'm getting close. The problem I have now is that when I select the land to sacrifice, it asks to Pay Mana Cost. I just click Cancel and the land is not sacrificed.
current code:
current code:
- Code: Select all
//*************** START *********** START **************************
else if(cardName.equals("Phyrexian War Beast")) {
/* When Phyrexian War Beast leaves the battlefield, sacrifice a land
* and Phyrexian War Beast deals 1 damage to you.
*/
final SpellAbility ability = new Spell(card) {
private static final long serialVersionUID = -3829801813561677938L;
public void resolve() {
Card c = getTargetCard();
AllZone.GameAction.sacrifice(c);
AllZone.GameAction.addDamage(card.getController(), 1, card);
}
};
final Command sacrificeLandAndOneDamage = new Command() {
private static final long serialVersionUID = -1793348608291550952L;
public void execute() {
String player = card.getController();
ability.setStackDescription(card.getName() + " - does 1 damage to "+player +" and sacrifice one land.");
AllZone.Stack.add(ability);
//probably want to check that there are lands in play
PlayerZone play = AllZone.getZone(Constant.Zone.Play,player);
CardList choice = new CardList(play.getCards());
choice = choice.getType("Land");
AllZone.InputControl.setInput(CardFactoryUtil.input_sacrifice(ability,choice,"Select a land to sacrifice"));
}
};
card.addLeavesPlayCommand(sacrificeLandAndOneDamage);
}//*************** END ************ END **************************
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: help with Phyrexian War Beast
by slapshot5 » 24 Apr 2010, 05:55
bump.
Can anyone help me get this card fixed up? The reason being this: This is the only card that needs to be implemented in Forge to completely build the deck that won the 1996 world championship (minus the mistakenly added Sleight of Mind).
http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtgcom/arcana/91
I think that would be an awesome addition to Forge to be able to ship with a complete deck that won a world championship.
-slapshot5
Can anyone help me get this card fixed up? The reason being this: This is the only card that needs to be implemented in Forge to completely build the deck that won the 1996 world championship (minus the mistakenly added Sleight of Mind).
http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtgcom/arcana/91
I think that would be an awesome addition to Forge to be able to ship with a complete deck that won a world championship.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: help with Phyrexian War Beast
by DennisBergkamp » 24 Apr 2010, 06:11
Oh wow, cool! I suppose that's a good enough reason
After a bunch of tries I got it to work. You were really close, the only minor thing that was wrong is that it should be Ability instead of Spell. Also, you don't need the "AllZone.Stack.add(ability)" because the input itself will add it after selecting a land:


After a bunch of tries I got it to work. You were really close, the only minor thing that was wrong is that it should be Ability instead of Spell. Also, you don't need the "AllZone.Stack.add(ability)" because the input itself will add it after selecting a land:
- Code: Select all
//*************** START *********** START **************************
else if(cardName.equals("Phyrexian War Beast")) {
/* When Phyrexian War Beast leaves the battlefield, sacrifice a land
* and Phyrexian War Beast deals 1 damage to you.
*/
final Ability ability = new Ability(card, "0") {
private static final long serialVersionUID = -3829801813561677938L;
public void resolve() {
Card c = getTargetCard();
AllZone.GameAction.sacrifice(c);
AllZone.GameAction.addDamage(card.getController(), 1, card);
}
};
final Command sacrificeLandAndOneDamage = new Command() {
private static final long serialVersionUID = -1793348608291550952L;
public void execute() {
String player = card.getController();
ability.setStackDescription(card.getName() + " - does 1 damage to "+player +" and sacrifice one land.");
//AllZone.Stack.add(ability);
//probably want to check that there are lands in play
PlayerZone play = AllZone.getZone(Constant.Zone.Play,player);
CardList choice = new CardList(play.getCards());
choice = choice.getType("Land");
AllZone.InputControl.setInput(CardFactoryUtil.input_sacrifice(ability,choice,"Select a land to sacrifice"));
}
};
card.addLeavesPlayCommand(sacrificeLandAndOneDamage);
}//*************** END ************ END **************************

-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: help with Phyrexian War Beast
by Chris H. » 24 Apr 2010, 10:42
`slapshot5 wrote:I think that would be an awesome addition to Forge to be able to ship with a complete deck that won a world championship.
Yes, a wonderful idea, thank you.

-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 24 guests