It is currently 12 Nov 2025, 21:20
   
Text Size

Rhox and Thorn Elemental

Moderator: CCGHQ Admins

Rhox and Thorn Elemental

Postby thefiremind » 28 Sep 2012, 08:29

Just as a tip (mostly for those who didn't see the expansion challenges yet), I'm going to show you the code used for Rhox and Thorn Elemental:
Code: Select all
  <TRIGGERED_ABILITY forced_skip="1" filter_zone="ZONE_IN_PLAY">
    <TRIGGER value="BLOCKING">
    return SecondaryObject() == Object()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    Object():GetPlayer():BeginNewMultipleChoice()   
    Object():GetPlayer():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_COMBAT_DAMAGE_TO_PLAYER" )   
    Object():GetPlayer():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_COMBAT_DAMAGE_TO_CREATURES" )   
    Object():GetPlayer():AskMultipleChoiceQuestion( "CARD_QUERY_MC_CHOOSE_DAMAGE_CREATURE_OR_PLAYER" )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local decision = Object():GetMultipleChoiceResult()
    if decision == 0 then
       ObjectDC():Set_Int(0, 1)
    elseif decision == 1 then
       ObjectDC():Set_Int(0, 0)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" pre_trigger="1">
    <TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_CREATURE" simple_qualifier="self" />
    <RESOLUTION_TIME_ACTION>
    if ObjectDC():Get_Int(0) == 1 then
       Damage():SetReceivingPlayer( SecondaryObject():GetPlayer() )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I think it has a flaw: if the creature is blocked by more than one creature, the question will be asked once for each blocking creature. It would have been better with a WAS_BLOCKED trigger. Maybe in the challenge they are always blocked by one creature at most, I haven't tried yet.

EDIT: Just tried, and it's not true! Those creatures can be blocked by any number of other creatures in that challenge... maybe not in the winning solution, but that would not be a good reason to let the card ask the same question over and over. The right trigger condition should be just:
Code: Select all
<TRIGGER value="WAS_BLOCKED" simple_qualifier="self" />
< 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: 722 times

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 11 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 9824 on 10 Nov 2025, 04:33

Users browsing this forum: No registered users and 11 guests

Login Form