New keyword: spDestroyAll
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
20 posts
• Page 2 of 2 • 1, 2
Re: New keyword: spDestroyAll
by friarsol » 07 Sep 2010, 21:15
That might work better, but you probably need to do the calculation twice. Once before the creatures are destroyed and once after they are destroyed. And then subtract the difference. And since I don't know when the calculation occurs I'm not sure if that's quite right either.
We might be better always counting how many of the type is Destroyed during the keyworded resolution and setting an SVar there. Then we can just use that variable instead if it's needed.
We would need the two destroy functions to return a boolean to make this work.
But something like this could do the trick, instead of the current code
We might be better always counting how many of the type is Destroyed during the keyworded resolution and setting an SVar there. Then we can just use that variable instead if it's needed.
We would need the two destroy functions to return a boolean to make this work.
But something like this could do the trick, instead of the current code
- Code: Select all
int destroyedCount = 0;
boolean destroyed;
for(int i = 0; i < all.size(); i++) {
Card c = all.get(i);
if(NoRegen[0])
destroyed = AllZone.GameAction.destroyNoRegeneration(c);
else
destroyed = AllZone.GameAction.destroy(c);
if (destroyed) destroyedCount++;
}
card.setSVar("CountDestroyed", Integer.toString(destroyedCount));
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New keyword: spDestroyAll
by Rob Cashwalker » 08 Sep 2010, 01:34
No, just "X" does the job. The resolve method counts the number of creatures in play matching the criteria, then counts the remaining ones. The difference is passed to the drawback handler, which uses it as "X".
It's not a number that should be needed for longer than handling the drawback, so it's not necessary to store it as an SVar.
So Hellfire works exactly as I posted.
It's not a number that should be needed for longer than handling the drawback, so it's not necessary to store it as an SVar.
So Hellfire works exactly as I posted.
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: New keyword: spDestroyAll
by Chris H. » 08 Sep 2010, 02:03
`Rob Cashwalker wrote:No, just "X" does the job. The resolve method counts the number of creatures in play matching the criteria, then counts the remaining ones. The difference is passed to the drawback handler, which uses it as "X".
It's not a number that should be needed for longer than handling the drawback, so it's not necessary to store it as an SVar.
So Hellfire works exactly as I posted.
OK, I think I understand. The X is calculated as part of the code and no additional calculations are needed. So this works as is:
spDestroyAll:Creature.nonBlack:Drawback$DamageYou/X.Plus.3
-
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
Re: New keyword: spDestroyAll
by Sloth » 08 Sep 2010, 06:15
There are three cards that have a similar drawback (Multani's Decree, Righteous Fury and Fracturing Gust). They don't count the permanents put into the graveyard, but the permanents destroyed, which is different when cards like Progenitus or Legacy Weapon are involved. Should we leave them for now, ignore the difference and just put them in or do we need another SVar for them?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: spDestroyAll
by Rob Cashwalker » 08 Sep 2010, 11:00
Once again, the code counts the affected cards on the battlefield before and after the destruction. It doesn't check the graveyard, so those should work OK.
Edit - while I was in CardFactory checking on drawback code to make sure it doesn't execute if the target becomes illegal, I realized that the original code was checking the graveyard. I have now corrected it to reflect the above statement.
Edit - while I was in CardFactory checking on drawback code to make sure it doesn't execute if the target becomes illegal, I realized that the original code was checking the graveyard. I have now corrected it to reflect the above statement.
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
20 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 38 guests