Distribution effects
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
26 posts
• Page 1 of 2 • 1, 2
Distribution effects
by moomarc » 13 Feb 2013, 11:43
I've just added the base for damage and damage prevention distribution for cards like Forked Lightning and Angel of Salvation. Two things I haven't been able to do yet (so any help would be appreciated):
* I have no idea how to go about implementing it for the AI. So for now I'm just converting cards that are already flagged with RemAIDeck:True.
* I can't seem to find a way to pass xPaid to the target (so no Rolling Thunder yet
). I tried adding it in AbilityFactory (I left my effort in there as it forms the basic structure of how it would be applied elsewhere. It looks like setXManaCostPaid should be set as soon as you hit the okay button, but I also tried setting the amount to be divided later in the target process in targetSelection, using a boolean to check if the distribution amount has been set, then try get xpaid directly from the card using hostC.getXManaCostPaid(), but that was no more effective. I'd love to get Rolling Thunder working - it was one of those cards that just made me smile whenever I drew it!
EDIT: Damn, just tested using a defined X value like Valid_Card.OppCtrl. That reminded me that X is only paid after targeting. So I might have to find a way to implement an AnnounceX parameter that's handled in AbilityFactory and lets you pick a number from 0 to 99 (unless we already have a way to calculate the amount of potential mana you have through cards on the battlefield - cards in hand not an issue seeing as you can't play spells while paying the cost).
* I have no idea how to go about implementing it for the AI. So for now I'm just converting cards that are already flagged with RemAIDeck:True.
* I can't seem to find a way to pass xPaid to the target (so no Rolling Thunder yet

EDIT: Damn, just tested using a defined X value like Valid_Card.OppCtrl. That reminded me that X is only paid after targeting. So I might have to find a way to implement an AnnounceX parameter that's handled in AbilityFactory and lets you pick a number from 0 to 99 (unless we already have a way to calculate the amount of potential mana you have through cards on the battlefield - cards in hand not an issue seeing as you can't play spells while paying the cost).
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Distribution effects
by Hellfish » 13 Feb 2013, 12:29
Ideally, we should add an "announcement" step of cost payment where things like X and Multikicker must be decided before any actual targeting/payment is done.Big job, but it would ease other things alot I think.
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Distribution effects
by Sloth » 13 Feb 2013, 12:44
I will take a look at improving the AI.moomarc wrote:* I have no idea how to go about implementing it for the AI. So for now I'm just converting cards that are already flagged with RemAIDeck:True.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Distribution effects
by friarsol » 13 Feb 2013, 13:11
Yea this is what really needs to happen. Profane Command is buggy right now due to this issue. While sometimes it's nice that X can just be however much. Things would be much more consistent with an Announce portion. It may be worth doing this piecemeal, adding announce to a few cards (Similar to how Cost and Target have their own specifications). Before adding it to X Spells.Hellfish wrote:Ideally, we should add an "announcement" step of cost payment where things like X and Multikicker must be decided before any actual targeting/payment is done.Big job, but it would ease other things alot I think.
Edit: I may be able to take a look tonight and add a chunk to SA Requirements, that treats Announcement of X as a new entity that happens before targeting.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Distribution effects
by moomarc » 13 Feb 2013, 13:15
Thanks to all of you for the help
I love this community!

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Distribution effects
by swordshine » 13 Feb 2013, 14:13
Great work! Can this distribution effect be used in counter distributions in future? Cards like Blessings of Nature can be converted, and Forgotten Ancient can be scripted correctly.
- swordshine
- Posts: 682
- Joined: 11 Jul 2010, 02:37
- Has thanked: 116 times
- Been thanked: 87 times
Re: Distribution effects
by moomarc » 13 Feb 2013, 14:17
Should be easy enough. It's literally a one-liner in each effect that needs it and a tweak to the stack description. At least, that's true for getting it right for the human player. Sloth has it working for DealDamage for the AI, so far so he should be able to comment more from the AI side. (PS - thanks SLoth, that was quick!)swordshine wrote:Great work! Can this distribution effect be used in counter distributions in future? Cards like Blessings of Nature can be converted, and Forgotten Ancient can be scripted correctly.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Distribution effects
by Sloth » 13 Feb 2013, 15:11
I only did the DealDamage sbilities yet. I will take a look at Damage Prevention later.moomarc wrote:(PS - thanks SLoth, that was quick!)
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Distribution effects
by friarsol » 13 Feb 2013, 16:00
Looks like there are 8 cards that can be scripted with PutCounter support of Distribute.moomarc wrote:Should be easy enough. It's literally a one-liner in each effect that needs it and a tweak to the stack description. At least, that's true for getting it right for the human player. Sloth has it working for DealDamage for the AI, so far so he should be able to comment more from the AI side. (PS - thanks SLoth, that was quick!)swordshine wrote:Great work! Can this distribution effect be used in counter distributions in future? Cards like Blessings of Nature can be converted, and Forgotten Ancient can be scripted correctly.
http://magiccards.info/query?q=o%3Adist ... rd&s=cname
I'm not sure if Distribute works with Forgotten Ancient, since it a) doesn't target and b) doesn't determine the "other creatures" until resolution. I'll post in the Card Development thread how I think this card might be done.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Distribution effects
by moomarc » 13 Feb 2013, 17:53
Done! I've converted Blessings of Nature for reference, but it really is the same template. We'll probably need a bit more infrastructure to support the last few cards on Sol's list because we need to remember which cards successfully had counters put on them (and in the case of Bounty of the Hunt, how many counters).moomarc wrote:Should be easy enough. It's literally a one-liner in each effect that needs it and a tweak to the stack description. At least, that's true for getting it right for the human player. Sloth has it working for DealDamage for the AI, so far so he should be able to comment more from the AI side. (PS - thanks SLoth, that was quick!)swordshine wrote:Great work! Can this distribution effect be used in counter distributions in future? Cards like Blessings of Nature can be converted, and Forgotten Ancient can be scripted correctly.
Anyway, with that I bow out for the day.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Distribution effects
by friarsol » 13 Feb 2013, 18:00
Gah, foiled again! How did you know I just wanted more Alliances cards to be scripted?moomarc wrote:We'll probably need a bit more infrastructure to support the last few cards on Sol's list because we need to remember which cards successfully had counters put on them (and in the case of Bounty of the Hunt, how many counters).
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Distribution effects
by moomarc » 13 Feb 2013, 18:04
Haha! Must be getting predictable in your old age.friarsol wrote:Gah, foiled again! How did you know I just wanted more Alliances cards to be scripted?

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Distribution effects
by friarsol » 14 Feb 2013, 03:28
After having a bit of difficulty with using variables and distribute. r19583 introduces Announce, which allows for cards like Rolling Thunder. Announce has the ability of fixing the buggy Profane Command and allowing X spells to work as expected with CostReduction cards. I also hope that we can use it with Multikicker to resolve alllll of the problems Multikicker brings about.
Max, from what I understand, I believe I'm using PlayerController the way you were planning on having it be used. But if you don't think this is a good use of that, I can move this code block back into SpellAbilityRequirements like I was originally planning.
Max, from what I understand, I believe I'm using PlayerController the way you were planning on having it be used. But if you don't think this is a good use of that, I can move this code block back into SpellAbilityRequirements like I was originally planning.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Distribution effects
by Hellfish » 14 Feb 2013, 08:07
Posting here since it's part if your dividedasyouchoose work, marc 
Meteor Shower got a stray spelldescription in the middle of the file.

Meteor Shower got a stray spelldescription in the middle of the file.
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Distribution effects
by moomarc » 14 Feb 2013, 08:12
Already fixed, just not committed yet. Was just testing Serra's Hymn before committing the last few conversions and new cards from DealDamage and PreventDamage. All that's left there is Butcher Orgg. I started doing him based on Cunning Giant, but then realised the distribution is between defined creatures/players. So needs a little more work for that one.Hellfish wrote:Posting here since it's part if your dividedasyouchoose work, marc
Meteor Shower got a stray spelldescription in the middle of the file.
Edit: Oh, Fiery Justice also doesn't seem to work. Can't select one of the players that have been targeted for damage distribution as the gain life target. So I can't even test whether the ruling would be applied about the player surviving if they would receive enough damage to die from the first part, then go above 0 life again due to the life gain part. Here's the script if anyone can think of an easy solution:
- Fiery Justice | Open
- Code: Select all
Name:Fiery Justice
ManaCost:R G W
Types:Sorcery
Text:no text
A:SP$ DealDamage | Cost$ R G W | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player to distribute damage to | NumDmg$ 5 | TargetMin$ 1 | TargetMax$ 5 | DividedAsYouChoose$ 5 | SubAbility$ Justice | SpellDescription$ CARDNAME deals 5 damage divided as you choose among any number of target creatures and/or players. Target opponent gains 5 life.
SVar:Justice:DB$ GainLife | ValidTgts$ Opponent | TgtPrompt$ Select target opponent to gain life | LifeAmount$ 5
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/fiery_justice.jpg
SetInfo:TSB|Special|http://magiccards.info/scans/en/tsts/92.jpg
SetInfo:ICE|Rare|http://magiccards.info/scans/en/ia/366.jpg
Oracle:Fiery Justice deals 5 damage divided as you choose among any number of target creatures and/or players. Target opponent gains 5 life.
End
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
26 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 65 guests