It is currently 25 Apr 2024, 19:19
   
Text Size

How to implement: Change Creature Card Color?

Moderator: CCGHQ Admins

How to implement: Change Creature Card Color?

Postby 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!
ferdie
 
Posts: 4
Joined: 04 Jun 2012, 13:05
Has thanked: 1 time
Been thanked: 0 time

Re: How to implement: Change Creature Card Color?

Postby 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.
Code: Select all
    <CONTINUOUS_ACTION>
    local colour_obj = Object():GetTargetCard():GetCurrentCharacteristics():Colour_Get()
    colour_obj:Add(COLOUR_BLACK)
    </CONTINUOUS_ACTION>
This adds the black colour to the existing one(s), but if you use Set instead of Add, you get the effect you need.

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>
(Not tested)

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...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: How to implement: Change Creature Card Color?

Postby 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!
ferdie
 
Posts: 4
Joined: 04 Jun 2012, 13:05
Has thanked: 1 time
Been thanked: 0 time

Re: How to implement: Change Creature Card Color?

Postby thefiremind » 05 Jun 2012, 18:05

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!
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).

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>
This way, the activated ability only changes the colour, but when it resolves, the triggered ability starts and gives the power/toughness buff. You shouldn't notice any visible change (if I didn't write something wrong).
< 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: 721 times

Re: How to implement: Change Creature Card Color?

Postby ferdie » 11 Jun 2012, 04:18

Thanks! I'll try that method out.
ferdie
 
Posts: 4
Joined: 04 Jun 2012, 13:05
Has thanked: 1 time
Been thanked: 0 time


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 30 guests


Who is online

In total there are 30 users online :: 0 registered, 0 hidden and 30 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 30 guests

Login Form