It is currently 11 Sep 2025, 09:43
   
Text Size

M13 Spoiler Season

Post MTG Forge Related Programming Questions Here

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

Re: M13 Spoiler Season

Postby ArsenalNut » 08 Jul 2012, 23:57

moomarc wrote:
friarsol wrote:
moomarc wrote:I'm claiming Elderscale Wurm. Should just be some math logic with damage replacement and a conditional. On the tip of my brain, so will hopefully crack it when I see it on screen.
I think Ali From Cairo is keyworded, if you get that part functional we can convert those related cards to a script too.
When I got started on this I saw the ruling about lifelink still gaining life equal to the original damage, so I don't think scripted damage replacement will work properly. For now I'm adding Elderscale Wurm with a player keyword. I've tested the Ali from Cairo type cards to make sure I didn't break them, tested with multiple EWurms and tested the lifelink scenario. All those work so I'm commiting like this for now, but I'll spend some time tomorrow trying to get a scripted version working.
Have you tried a damage replacement to goes fires a DealDamage ability for exactly the same amount and then a SubAbility that does a SetLife? You'll need two case, one for Combat damage and one for non-Combat damage.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: M13 Spoiler Season

Postby moomarc » 09 Jul 2012, 03:44

I considered it but thoughtthat critical damage would kill the player before the SetLife had time to fire. But it was one of the things I planned to try anyway when I wake up.
-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: M13 Spoiler Season

Postby ArsenalNut » 09 Jul 2012, 04:26

moomarc wrote:I considered it but thoughtthat critical damage would kill the player before the SetLife had time to fire. But it was one of the things I planned to try anyway when I wake up.
Sorry, my OCD kicked in after I made my suggestion and I HAD to try to script it myself. I just checked in a version of Elderscale Wurm that uses replacement effect. Apparently life total is changed as a state based action so I had to predict the results of the damage in order to do the conditional for the setting the life total back to 7.

Also, I fixed the ETB trigger so that it only triggers if your life total is less than 7. The trigger has an "intervening if" clause, so it should only trigger if the condition is true when the trigger event occurs (rule 603.4). I had to look this up because these type of triggers are done inconsistently in the Forge database. I think a lot of the "intervening if" clauses in Forge scripts are done wrong because the condition is supposed to be checked again as it resolves.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: M13 Spoiler Season

Postby moomarc » 09 Jul 2012, 05:20

ArsenalNut wrote:
moomarc wrote:I considered it but thoughtthat critical damage would kill the player before the SetLife had time to fire. But it was one of the things I planned to try anyway when I wake up.
Sorry, my OCD kicked in after I made my suggestion and I HAD to try to script it myself. I just checked in a version of Elderscale Wurm that uses replacement effect. Apparently life total is changed as a state based action so I had to predict the results of the damage in order to do the conditional for the setting the life total back to 7.

Also, I fixed the ETB trigger so that it only triggers if your life total is less than 7. The trigger has an "intervening if" clause, so it should only trigger if the condition is true when the trigger event occurs (rule 603.4). I had to look this up because these type of triggers are done inconsistently in the Forge database. I think a lot of the "intervening if" clauses in Forge scripts are done wrong because the condition is supposed to be checked again as it resolves.
Not a problem! And thanks for fixing the trigger. I still get lost with some of the rules intricacies. So for my future reference, intervening if clauses are checked first to see whether the trigger hits the stack at all, and then again at resolution to see if it actually fires?
-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: M13 Spoiler Season

Postby ArsenalNut » 09 Jul 2012, 05:31

moomarc wrote:Not a problem! And thanks for fixing the trigger. I still get lost with some of the rules intricacies. So for my future reference, intervening if clauses are checked first to see whether the trigger hits the stack at all, and then again at resolution to see if it actually fires?
Yes, you got it.
603.4 Rule Text | Open
603.4. A triggered ability may read “When/Whenever/At [trigger event], if [condition], [effect].” When the trigger event occurs, the ability checks whether the stated condition is true. The ability triggers only if it is; otherwise it does nothing. If the ability triggers, it checks the stated condition again as it resolves. If the condition isn’t true at that time, the ability is removed from the stack and does nothing. Note that this mirrors the check for legal targets. This rule is referred to as the “intervening‘if’ clause” rule. (The word “if” has only its normal English meaning anywhere else in the text of a card; this rule only applies to an “if” that immediately follows a trigger condition.)
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: M13 Spoiler Season

Postby moomarc » 09 Jul 2012, 06:10

Thanks! I did come across one tiny problem with your scripted version. If you're on 7 life with an Elderscale Wurm in play and target yourself with a Prodigal Sorcerer that has lifelink you should go up to 8 life, but currently you stay on 7. If you target the opponent on 7 life with EW in play it works as expected though, so I think that lifelink works out net life change before applying but I can't find where in the code it does this. Any idea what the best solution is?

Edit: I think I know what the problem is. The SetLife is only activating after the life is gained and DmgResult doesn't take this into account. Not sure how to fix though. Perhaps a GainLife subability after SetLife with a condition that the ReplacedSource is a creature you control with lifelink?
-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: M13 Spoiler Season

Postby Hellfish » 09 Jul 2012, 06:52

So,wait, you had to add a conditional to the triggering ability to do an intervening if clause? That means somethings broken in Triggerhandler, because that's supposed to handle intervening if's automatically. So if you specify "if your life total is less than 7" as a condition to go off for the trigger, it will automatically check that again before resolving (or not resolving).
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: M13 Spoiler Season

Postby moomarc » 09 Jul 2012, 07:13

Hellfish wrote:So,wait, you had to add a conditional to the triggering ability to do an intervening if clause? That means somethings broken in Triggerhandler, because that's supposed to handle intervening if's automatically. So if you specify "if your life total is less than 7" as a condition to go off for the trigger, it will automatically check that again before resolving (or not resolving).
Just tested without the extra conditional on the triggering ability and it work as you said it should. Thanks for pointing it out.

I also sorted out the problem with the lifelink ruling with this line:
Code: Select all
SVar:LifelinkQuirk:DB$ GainLife | Defined$ You | LifeAmount$ DmgDone | ConditionDefined$ ReplacedSource | ConditionPresent$ Card.withLifelink+YouCtrl | ConditionCompare$ EQ1 | ConditionLifeTotal$ You | ConditionLifeAmount$ EQ7
Tested with multiple Wurms, at different life totals and damage sources wit and without lifelink and so far nothing seems to break it. Anything else I should try?
-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: M13 Spoiler Season

Postby moomarc » 09 Jul 2012, 07:25

I'm going to remove the "Damage that would reduce your life total to less than 7 reduces it to 7 instead." keyword from Player.AddDamageAfterPrevention as the script seems to work for all test cases now.
-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: M13 Spoiler Season

Postby friarsol » 09 Jul 2012, 12:05

ArsenalNut wrote:The trigger has an "intervening if" clause, so it should only trigger if the condition is true when the trigger event occurs (rule 603.4). I had to look this up because these type of triggers are done inconsistently in the Forge database. I think a lot of the "intervening if" clauses in Forge scripts are done wrong because the condition is supposed to be checked again as it resolves.
Hold on a sec, TriggereedHandler always just handled this (as Hellfish says below) are you sure it's not working already?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: M13 Spoiler Season

Postby ArsenalNut » 09 Jul 2012, 12:17

friarsol wrote:
ArsenalNut wrote:The trigger has an "intervening if" clause, so it should only trigger if the condition is true when the trigger event occurs (rule 603.4). I had to look this up because these type of triggers are done inconsistently in the Forge database. I think a lot of the "intervening if" clauses in Forge scripts are done wrong because the condition is supposed to be checked again as it resolves.
Hold on a sec, TriggereedHandler always just handled this (as Hellfish says below) are you sure it's not working already?
Sorry for the confusion, I didn't realize that TriggerHandler dealt with the second check. I believe moonmarc fixed the Elderscale Wurm script. When I was grepping the cards for examples of ETBs with an "if", I did see there were cards that checked the condition in the ability statement rather than the trigger statement. That's what prompted me to search the rules in the first place.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: M13 Spoiler Season

Postby moomarc » 09 Jul 2012, 13:14

ArsenalNut wrote:
friarsol wrote:
ArsenalNut wrote:The trigger has an "intervening if" clause, so it should only trigger if the condition is true when the trigger event occurs (rule 603.4). I had to look this up because these type of triggers are done inconsistently in the Forge database. I think a lot of the "intervening if" clauses in Forge scripts are done wrong because the condition is supposed to be checked again as it resolves.
Hold on a sec, TriggereedHandler always just handled this (as Hellfish says below) are you sure it's not working already?
Sorry for the confusion, I didn't realize that TriggerHandler dealt with the second check. I believe moonmarc fixed the Elderscale Wurm script. When I was grepping the cards for examples of ETBs with an "if", I did see there were cards that checked the condition in the ability statement rather than the trigger statement. That's what prompted me to search the rules in the first place.
Yip, I fixed it just after Hellfish pointed it out.
-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: M13 Spoiler Season

Postby friarsol » 09 Jul 2012, 14:56

I don't have access to SVN here to fix, but it looks like the following didn't get converted quite right:

Accorder's Shield
Bonesplitter
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: M13 Spoiler Season

Postby ArsenalNut » 09 Jul 2012, 15:02

friarsol wrote:I don't have access to SVN here to fix, but it looks like the following didn't get converted quite right:

Accorder's Shield
Bonesplitter
Fixed
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: M13 Spoiler Season

Postby Sloth » 13 Jul 2012, 15:45

I will code up AF ExchangeControl for Switcheroo.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 48 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 48 users online :: 0 registered, 0 hidden and 48 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 48 guests

Login Form