It is currently 24 Jul 2019, 08:32
   
Text Size

Amulet of Vigor

Moderators: Xander9009, CCGHQ Admins

Amulet of Vigor

Postby gopher » 16 Apr 2013, 14:45

Hi people.

I'm trying to code Amulet of Vigor and I encounter some issues. Here's my code, it works only for lands, not all permanent types :

Code: Select all
  <TRIGGERED_ABILITY  filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a permanent enters the battlefield tapped and under your control, untap it.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_IN_PLAY" >
    return TriggerObject():GetCardType():Test( CARD_TYPE_LAND ) ~= 0
    </TRIGGER>

    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_LAND )
    filter:SetZone( ZONE_IN_PLAY )
    filter:AddExtra( FILTER_EXTRA_LAND_TAPPED )
    filter:SetHint( HINT_ENEMY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION> 
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       TriggerObject():Untap()
    end

    </RESOLUTION_TIME_ACTION>

  </TRIGGERED_ABILITY>
 
The first problem is that this code generates this is the log file :
Code: Select all
[lua] [string "AMULET_OF_VIGOR_191577_TITLE (TARGET_DEFINITION) [2190]"]:6:
 parameter mismatch or too few parameters [expected bzU32]
I'm pretty sure it comes from this : filter:AddExtra( FILTER_EXTRA_LAND_TAPPED ) but FILTER_EXTRA_CREATURE_TAPPED in the Royal Assassin code doesn't generate the error, I don't understand...

The second and main problem is that I can't find out how to trigger with a tapped permanent coming into play, so the amulet triggers on any played permanent, which is particularly ugly and slow (that's why I test it only with lands for now). I've tried this :

return TriggerObject():ComesIntoPlayTapped()

but without any success....


Would someone have an idea ?

Thanks a lot in advance,

Gopher.
gopher
 
Posts: 11
Joined: 17 Mar 2013, 08:41
Has thanked: 0 time
Been thanked: 0 time

Re: Amulet of Vigor

Postby thefiremind » 16 Apr 2013, 15:13

If you look at the constants here you'll see that there's nothing like FILTER_EXTRA_LAND_TAPPED, there's only FILTER_EXTRA_CREATURE_TAPPED, which is a bad name choice for this constant because it filters anything that is tapped, not just creatures.

Anyway, Amulet of Vigor doesn't target anything, so defining a target won't take you very far.

I'd try something like this:
Code: Select all
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_IN_PLAY" >
    return TriggerObject():Tapped() ~= 0
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       TriggerObject():Untap()
    end
    </RESOLUTION_TIME_ACTION>
The ComesIntoPlayTapped() function should act before this trigger has the chance to be checked, so it should work, but I'm not 100% sure.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 717 times

Re: Amulet of Vigor

Postby gopher » 16 Apr 2013, 16:51

thefiremind wrote:If you look at the constants here you'll see that there's nothing like FILTER_EXTRA_LAND_TAPPED
Indeed :D


The ComesIntoPlayTapped() function should act before this trigger has the chance to be checked, so it should work, but I'm not 100% sure.
This works to untap the land fetched by Evolving Wilds, wit PutIntoPlayTapped() but it doesn't seem to work with ComesIntoPlayTapped()... Maybe with a priority of something ? I've played with this sometimes ago, but with no great sucess....

Thanks for your answer anyway :D

G.
gopher
 
Posts: 11
Joined: 17 Mar 2013, 08:41
Has thanked: 0 time
Been thanked: 0 time

Re: Amulet of Vigor

Postby RiiakShiNal » 17 Apr 2013, 13:47

Due to the way abilities are triggered I don't think you will be able to check to see if something is tapped when it comes into play tapped using ComesIntoPlayTapped(). The reason being is the engine likes to trigger abilities in the order they came into play so if you have Amulet of Vigor already in play then place a Cloudpost, Amulet of Vigor's ability would check to see if it should trigger, see that Cloudpost is not yet tapped and return false, then Cloudpost's ability would trigger and make it "come into play tapped". The reason being they are both ZONECHANGE_END triggers and the effects go onto the stack in order they came into play and resolve in reverse order.

However, due to the same triggering order if you trigger on all objects that come into play under your control then in resolution check to see if they are tapped then you could untap them.

Code: Select all
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_IN_PLAY" />
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       if TriggerObject():Tapped() ~= 0 then
          TriggerObject():Untap()
       end
    end
    </RESOLUTION_TIME_ACTION>
Now because this happens in resolution time it may or may not function correctly with other effects. This is also not quite correct from how the rules work, but because of how the engine works this may be the only way to make it work.

If we could trigger the ability after the ZONECHANGE_END trigger from the object coming into play resolves then we could have other more correct options.
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2120
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 471 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 3 guests


Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 3 guests

Login Form