Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Amulet of Vigor
Moderator: CCGHQ Admins
Amulet of Vigor
by 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 :
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.
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>
- Code: Select all
[lua] [string "AMULET_OF_VIGOR_191577_TITLE (TARGET_DEFINITION) [2190]"]:6:
parameter mismatch or too few parameters [expected bzU32]
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
by 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:
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>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Amulet of Vigor
by gopher » 16 Apr 2013, 16:51
Indeedthefiremind wrote:If you look at the constants here you'll see that there's nothing like FILTER_EXTRA_LAND_TAPPED
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....The ComesIntoPlayTapped() function should act before this trigger has the chance to be checked, so it should work, but I'm not 100% sure.
Thanks for your answer anyway
G.
- gopher
- Posts: 11
- Joined: 17 Mar 2013, 08:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Amulet of Vigor
by 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.
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.
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>
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.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 13 guests