It is currently 11 May 2025, 09:31
   
Text Size

Multi-Mode "Charm" spells

Moderator: CCGHQ Admins

Multi-Mode "Charm" spells

Postby Shatterhouse » 23 Apr 2011, 03:26

Okay, I seem to have gotten Charms working.

Charms are tricky because they could have different targets depending on which mode you select as the card is played.

Note that the repository already had Funeral Charm, but there was a flaw in that it only chose targets after it resolved, giving opposing players no clue what was about to happen until it was too late to cast a counterspell.

This solution is to trigger an ability as the spell is cast, have the triggered ability choose the targets, and then resolve the spell's effect onto the triggered ability's target. Here's how I handled the two relevant abilities of Fury Charm :

Code: Select all
<SPELL_ABILITY layer="7c" tag="FURY_CHARM_RULE_1" simple_filter="Target">
   <TARGET_DETERMINATION>
      return TargetArtifactOrCreatureBad()
    </TARGET_DETERMINATION>
      <PLAYTIME>
         Object():GetFilter():Clear()
         Object():GetPlayer():BeginNewMultipleChoice( true )
         Object():GetPlayer():AddMultipleChoiceAnswer( "FURY_CHARM_MODAL_1" )
         Object():GetPlayer():AddMultipleChoiceAnswer( "FURY_CHARM_MODAL_2" )
         Object():GetPlayer():AskMultipleChoiceQuestion( "MODAL_TITLE" )
      </PLAYTIME>
      <EFFECT>
        if ((Object():GetMultipleChoiceResult() == 1) and (Object():GetTargetCard() ~= nil)) then
          PlusOnePlusOneToTargetCard()
          Trample()
         end
         if ((Object():GetMultipleChoiceResult() == 0) and (Object():GetTargetCard() ~= nil)) then
         DestroyTargetCard()
         end
      </EFFECT>
      <DURATION>
        return UntilEndOfTurn()
      </DURATION>
    </SPELL_ABILITY>
    <TRIGGERED_ABILITY layer="7c" zone="HAND" auto_skip="1" >
   <TRIGGER value="SPELL_PLAYED">
      return SelfTriggered()   
   </TRIGGER>   
   <PLAYTIME>
        if Object():GetMultipleChoiceResult() == 0 then
            TargetArtifactBad()
            ChooseTargetArtifact()
        end
        if Object():GetMultipleChoiceResult() == 1 then
           TargetCreatureBad()
           ChooseTargetCreature()
        end
   </PLAYTIME>
   <FILTER>
       return TargetCard()
   </FILTER>
   <EFFECT>
<!-- Triggered ability has no real effect -->
   </EFFECT>      
    </TRIGGERED_ABILITY>
It might be cleaner to separate each of the modes into their own triggered abilities that include the MultipleChoiceResult() in their trigger check. But it works okay like this.
The only weird thing is that there will be a slight delay between the targeting and the resolving of the spell, because it's really two things that are resolving.
Shatterhouse
 
Posts: 72
Joined: 20 Apr 2011, 00:07
Has thanked: 0 time
Been thanked: 2 times

Re: Multi-Mode "Charm" spells

Postby spiwy » 23 Apr 2011, 13:17

Cool! Thanks for the Discovery :P After i finish the deck i'm building, Myr Rampaging, I want to try to do a tribal Giant deck and I would like to have some Austere Command in it, so I think this can help much :)

Regards!
spiwy
 
Posts: 24
Joined: 15 Mar 2011, 14:21
Location: Spain
Has thanked: 1 time
Been thanked: 0 time

Re: Multi-Mode "Charm" spells

Postby spiwy » 17 May 2011, 11:04

Ok, so i made my first attemp to make a working Austere Command and this is what i did to select the first option:

Code: Select all
<SPELL_ABILITY tag="AUSTERE_COMMAND_RULE_1" layer="0">
         <PLAYTIME>
            Object():GetFilter():Clear()
            Object():GetPlayer():BeginNewMultipleChoice( true )
            Object():GetPlayer():AddMultipleChoiceAnswer( "AUSTERE_COMMAND_OPTION_1" )
            Object():GetPlayer():AddMultipleChoiceAnswer( "AUSTERE_COMMAND_OPTION_2" )
            Object():GetPlayer():AddMultipleChoiceAnswer( "AUSTERE_COMMAND_OPTION_3" )
            Object():GetPlayer():AddMultipleChoiceAnswer( "AUSTERE_COMMAND_OPTION_4" )
            Object():GetPlayer():AskMultipleChoiceQuestion( "AUSTERE_COMMAND_ONE" )
         </PLAYTIME>
         <EFFECT>
            if Object():GetMultipleChoiceResult() == 0 then
               Object():Register_Set(0,1)
            end
            if Object():GetMultipleChoiceResult() == 1 then
               Object():Register_Set(0,2)
            end
            if Object():GetMultipleChoiceResult() == 2 then
               Object():Register_Set(0,3)
            end
            if Object():GetMultipleChoiceResult() == 3 then
               Object():Register_Set(0,4)
            end
         </EFFECT>
      </SPELL_ABILITY>
Anyway, when i started to try it ingame i saw that you can't have more than 3 questions to show ingame so i can't make this card work perfectly... A shame indeed =(
spiwy
 
Posts: 24
Joined: 15 Mar 2011, 14:21
Location: Spain
Has thanked: 1 time
Been thanked: 0 time


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 7 guests


Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 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 7 guests

Login Form