Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



How to implement: Change Creature Card Color?
Moderator: CCGHQ Admins
How to implement: Change Creature Card Color?
by ferdie » 05 Jun 2012, 11:25
Hi All,
Is there a way to make Wild Mongrel work for DOTP 2012?
I looked at the documentations, but there is only mention of retrieving
card color nothing for setting it.
Thanks!
Is there a way to make Wild Mongrel work for DOTP 2012?
I looked at the documentations, but there is only mention of retrieving
card color nothing for setting it.
Thanks!
Re: How to implement: Change Creature Card Color?
by thefiremind » 05 Jun 2012, 12:50
This topic should have been opened in Card Programming Talk sub-section (it would have been more visible since this sub-section is mostly unused). Anyway, yes there is.
If you have the deck packs, you can check the card Rise from the Grave.
For Wild Mongrel you should code something like this:
Note that, even if it works, you won't see the card frame changing colour. If you need a good test scenario, try to block Zombie Outlander with a Wild Mongrel after changing its colour (or make Zombie Outlander block your Wild Mongrel, then change its colour and see if the damage is dealt).
If you have the deck packs, you can check the card Rise from the Grave.
- Code: Select all
<CONTINUOUS_ACTION>
local colour_obj = Object():GetTargetCard():GetCurrentCharacteristics():Colour_Get()
colour_obj:Add(COLOUR_BLACK)
</CONTINUOUS_ACTION>
For Wild Mongrel you should code something like this:
- Code: Select all
<ACTIVATED_ABILITY layer="7C">
<COST type="Discard">
<PLAYTIME>
ChooseTarget( "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
</PLAYTIME>
<TARGET_DETERMINATION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetPlayer( Object():GetPlayer() )
filter:SetZone( ZONE_HAND )
filter:NotTargetted()
return TargetGoodF()
</TARGET_DETERMINATION>
</COST>
<RESOLUTION_TIME_ACTION>
Object():GetPlayer():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
MTG():EffectDataChest():Set_Int(0, Object():GetPlayer():GetChosenColour())
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION>
if Object():GetZone() == ZONE_IN_PLAY then
Object():GetCurrentCharacteristics():Colour_Get():Set( MTG():EffectDataChest():Get_Int(0) )
end
</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION>
if Object():GetZone() == ZONE_IN_PLAY then
Object():GetCurrentCharacteristics():Power_Add( 1 )
Object():GetCurrentCharacteristics():Toughness_Add( 1 )
end
</CONTINUOUS_ACTION>
<DURATION>
return (MTG():GetStep() == STEP_CLEANUP)
</DURATION>
</ACTIVATED_ABILITY>
Note that, even if it works, you won't see the card frame changing colour. If you need a good test scenario, try to block Zombie Outlander with a Wild Mongrel after changing its colour (or make Zombie Outlander block your Wild Mongrel, then change its colour and see if the damage is dealt).
< 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: 722 times
Re: How to implement: Change Creature Card Color?
by ferdie » 05 Jun 2012, 15:46
Just made one minor change,
Set layer to 5 instead of 7C, at 7C color changes were only activating on every 2nd discard,
changing it to layer 5 removed the issue.
Thank you very much!
Set layer to 5 instead of 7C, at 7C color changes were only activating on every 2nd discard,
changing it to layer 5 removed the issue.
Thank you very much!
Re: How to implement: Change Creature Card Color?
by thefiremind » 05 Jun 2012, 18:05
You could have different problems with layer 5, because effects that set power/toughness (like Gigantiform) are on 7A and would overwrite the power/toughness change of the ability (while they shouldn't).ferdie wrote:Just made one minor change,
Set layer to 5 instead of 7C, at 7C color changes were only activating on every 2nd discard,
changing it to layer 5 removed the issue.
Thank you very much!
There's a trick that allows to use proper layers for each component, if you want to try:
- Code: Select all
<ACTIVATED_ABILITY layer="5">
<COST type="Discard">
<PLAYTIME>
ChooseTarget( "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
</PLAYTIME>
<TARGET_DETERMINATION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetPlayer( Object():GetPlayer() )
filter:SetZone( ZONE_HAND )
filter:NotTargetted()
return TargetGoodF()
</TARGET_DETERMINATION>
</COST>
<RESOLUTION_TIME_ACTION>
Object():GetPlayer():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
MTG():EffectDataChest():Set_Int(0, Object():GetPlayer():GetChosenColour())
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION>
if Object():GetZone() == ZONE_IN_PLAY then
Object():GetCurrentCharacteristics():Colour_Get():Set( MTG():EffectDataChest():Get_Int(0) )
end
</CONTINUOUS_ACTION>
<DURATION>
return (MTG():GetStep() == STEP_CLEANUP)
</DURATION>
</ACTIVATED_ABILITY>
<TRIGGERED_ABILITY forced_skip="1" layer="7C">
<TRIGGER value="ABILITY_RESOLVED" simple_qualifier="self" />
<CONTINUOUS_ACTION>
if Object():GetZone() == ZONE_IN_PLAY then
Object():GetCurrentCharacteristics():Power_Add( 1 )
Object():GetCurrentCharacteristics():Toughness_Add( 1 )
end
</CONTINUOUS_ACTION>
<DURATION>
return (MTG():GetStep() == STEP_CLEANUP)
</DURATION>
</TRIGGERED_ABILITY>
< 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: 722 times
Re: How to implement: Change Creature Card Color?
by ferdie » 11 Jun 2012, 04:18
Thanks! I'll try that method out.
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests