Page 4 of 5

Re: M13 Spoiler Season

PostPosted: 08 Jul 2012, 23:57
by ArsenalNut
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.

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 03:44
by moomarc
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.

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 04:26
by ArsenalNut
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.

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 05:20
by moomarc
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?

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 05:31
by ArsenalNut
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.)

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 06:10
by moomarc
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?

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 06:52
by Hellfish
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).

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 07:13
by moomarc
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?

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 07:25
by moomarc
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.

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 12:05
by friarsol
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?

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 12:17
by ArsenalNut
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.

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 13:14
by moomarc
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.

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 14:56
by friarsol
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

Re: M13 Spoiler Season

PostPosted: 09 Jul 2012, 15:02
by ArsenalNut
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

Re: M13 Spoiler Season

PostPosted: 13 Jul 2012, 15:45
by Sloth
I will code up AF ExchangeControl for Switcheroo.