Page 1 of 1

Shadow

PostPosted: 24 Sep 2013, 22:50
by BlindWillow
In coding Nether Traitor for a deck I'm working on, I noticed the old EVASION_INDEX way of handling shadow doesn't seem to work anymore. I came up with the following, and it seems to work in testing, but I would like to get the opinion of the resident coding experts, as who knows what the AI is really thinking when it blocks and doesn't block. :lol:

Here's the new evasion test:
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1">
    <TRIGGER value="EVASION_TEST" pre_trigger="1">
    if EffectSource() ~= nil then
   if EffectSource():GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHADOW ) == true then
      return ( TriggerObject() == EffectSource() and SecondaryObject():GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHADOW ) == false ) or ( SecondaryObject() == EffectSource() and TriggerObject():GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHADOW ) == false )
   end
    end
    </TRIGGER>
  </TRIGGERED_ABILITY>

Re: Shadow

PostPosted: 24 Sep 2013, 23:15
by thefiremind
BlindWillow wrote:In coding Nether Traitor for a deck I'm working on, I noticed the old EVASION_INDEX way of handling shadow doesn't seem to work anymore.
That's bad news! Another function that got discontinued. Luckily, as I said in another occasion, I think that the EVASION_TEST can do everything that the EVASION_... constants could do before.

BlindWillow wrote:I came up with the following, and it seems to work in testing, but I would like to get the opinion of the resident coding experts, as who knows what the AI is really thinking when it blocks and doesn't block. :lol:
Why not making it easier:
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1">
    <TRIGGER value="EVASION_TEST" pre_trigger="1">
    return TriggerObject():GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHADOW ) ~= SecondaryObject():GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHADOW )
    </TRIGGER>
  </TRIGGERED_ABILITY>
Maybe I'm forgetting something, but I think this is all we need for shadow: if one of the 2 creatures has shadow and the other one doesn't, then they can't "interact".

Re: Shadow

PostPosted: 24 Sep 2013, 23:33
by BlindWillow
I will have to test that out right now. I do hope it works, because that is nice and simple. [-o<

Re: Shadow

PostPosted: 25 Sep 2013, 00:05
by BlindWillow
That seems to work just fine as far as I can tell.