It is currently 08 Sep 2025, 08:29
   
Text Size

Distribution effects

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Distribution effects

Postby 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 :cry: ). 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).
-Marc
User avatar
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

Postby 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
User avatar
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

Postby Sloth » 13 Feb 2013, 12:44

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.
I will take a look at improving the AI.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Distribution effects

Postby friarsol » 13 Feb 2013, 13:11

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.
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.

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

Postby moomarc » 13 Feb 2013, 13:15

Thanks to all of you for the help =D> I love this community!
-Marc
User avatar
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

Postby 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

Postby moomarc » 13 Feb 2013, 14:17

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.
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!)
-Marc
User avatar
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

Postby Sloth » 13 Feb 2013, 15:11

moomarc wrote:(PS - thanks SLoth, that was quick!)
I only did the DealDamage sbilities yet. I will take a look at Damage Prevention later.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Distribution effects

Postby friarsol » 13 Feb 2013, 16:00

moomarc wrote:
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.
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!)
Looks like there are 8 cards that can be scripted with PutCounter support of Distribute.
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

Postby moomarc » 13 Feb 2013, 17:53

moomarc wrote:
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.
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!)
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).

Anyway, with that I bow out for the day.
-Marc
User avatar
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

Postby friarsol » 13 Feb 2013, 18:00

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).
Gah, foiled again! How did you know I just wanted more Alliances cards to be scripted?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Distribution effects

Postby moomarc » 13 Feb 2013, 18:04

friarsol wrote:Gah, foiled again! How did you know I just wanted more Alliances cards to be scripted?
Haha! Must be getting predictable in your old age. :P We can at least get one more from Ice Age in the form of Spoils of War.
-Marc
User avatar
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

Postby 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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Distribution effects

Postby 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.
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
User avatar
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

Postby moomarc » 14 Feb 2013, 08:12

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.
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.

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
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 47 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 47 users online :: 0 registered, 0 hidden and 47 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 47 guests

Login Form