It is currently 20 May 2013, 08:03
   
Text Size

Help with "Rayne, Academy Chancellor"

Moderator: CCGHQ Admins

Help with "Rayne, Academy Chancellor"

Postby Zambooo » 27 Jul 2012, 10:16

This time I tried to do Rayne, Academy Chancellor (http://magiccards.info/ud/en/43.html) with bad results (I didn't suppose it would work). The ability triggers twice each time and last time it triggered when my opponent was getting back a card from its graveyard.

Here's what I did:
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="RAYNE_ACADEMY_CHANCELLOR_15164" />
  <CARDNAME text="RAYNE_ACADEMY_CHANCELLOR" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Rayne, Academy Chancellor]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Rayne Cancelliere Accademico]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="15164" />
  <ARTID value="15164" />
  <ARTIST name="Matthew Wilson" />
  <CASTING_COST cost="{2}{U}" />
  <SUPERTYPE metaname="Legendary" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Wizard" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" order_ko-KR="0" order_pt-BR="0" order_ru-RU="0" />
  <EXPANSION value="UDS" />
  <RARITY metaname="R" />
  <POWER value="1" />
  <TOUGHNESS value="1" />
 
  <TRIGGERED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever you or a permanent you control becomes the target of a spell or ability an opponent controls, you may draw a card. You may draw an additional card if Rayne, Academy Chancellor is enchanted.]]></LOCALISED_TEXT>
    <TRIGGER value="BECAME_TARGET" simple_qualifier="PermanentsYouControl" >
    return ( (SecondaryObject() ~= nil) and (SecondaryObject():GetPlayer():GetTeam() ~= EffectController():GetTeam()) )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    if EffectController():IsAI() == 0 then
       EffectController():BeginNewMultipleChoice()   
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )   
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )   
       EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_DRAW_A_CARD")
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
   if (EffectSource():IsEnchanted() == 0) then
      if EffectController():IsAI() == 0 then
         local decision = Object():GetMultipleChoiceResult()
         if decision == 0 then
            EffectController():DrawCard()
         end
      elseif CountCardsInLibrary(EffectController()) &gt; 5 then
         EffectController():DrawCard()
      end
   elseif (EffectSource():IsEnchanted() ~= 0) then
      if EffectController():IsAI() == 0 then
         local decision = Object():GetMultipleChoiceResult()
         if decision == 0 then
            PlayerDrawCards( EffectController(), 2 )
         end
      elseif CountCardsInLibrary(EffectController()) &gt; 5 then
         PlayerDrawCards( EffectController(), 2 )
      end
   end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
 
  <TRIGGERED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <TRIGGER value="BECAME_TARGET" simple_qualifier="You" >
    return (SecondaryObject():GetPlayer():GetTeam() ~= EffectController():GetTeam())
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    if EffectController():IsAI() == 0 then
       EffectController():BeginNewMultipleChoice()   
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )   
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )   
       EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_DRAW_A_CARD")
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
   if (EffectSource():IsEnchanted() == 0) then
      if EffectController():IsAI() == 0 then
         local decision = Object():GetMultipleChoiceResult()
         if decision == 0 then
            EffectController():DrawCard()
         end
      elseif CountCardsInLibrary(EffectController()) &gt; 5 then
         EffectController():DrawCard()
      end
   elseif (EffectSource():IsEnchanted() ~= 0) then
      if EffectController():IsAI() == 0 then
         local decision = Object():GetMultipleChoiceResult()
         if decision == 0 then
            PlayerDrawCards( EffectController(), 2 )
         end
      elseif CountCardsInLibrary(EffectController()) &gt; 5 then
         PlayerDrawCards( EffectController(), 2 )
      end
   end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>


 
  <HELP title="MORE_INFO_BADGE_TITLE_12" body="MORE_INFO_BADGE_BODY_12" zone="ZONE_ANY" />
  <AI_BASE_SCORE score="600" zone="ZONE_IN_PLAY" />
</CARD_V2>
Zambooo
 
Posts: 79
Joined: 01 Jul 2012, 21:33
Has thanked: 15 times
Been thanked: 1 time

Re: Help with "Rayne, Academy Chancellor"

Postby kevlahnota » 27 Jul 2012, 10:34

because you have two trigger, you must have only one trigger.

something like (I don't know if this is correct but you must have only one trigger):

Code: Select all
<TRIGGER value="BECAME_TARGET">
    if (TriggerObject():GetPlayer():GetTeam() == EffectController():GetTeam()) or       
       (TriggerPlayer() == EffectController()) then
    return true
    end
</TRIGGER>
Last edited by kevlahnota on 27 Jul 2012, 11:30, edited 1 time in total.
User avatar
kevlahnota
Programmer
 
Posts: 418
Joined: 19 Jul 2010, 17:45
Location: Philippines
Has thanked: 5 times
Been thanked: 97 times

Re: Help with "Rayne, Academy Chancellor"

Postby Zambooo » 27 Jul 2012, 11:19

The ability didn't trigger when my opponent targetted me with Diabolic Edict...
Zambooo
 
Posts: 79
Joined: 01 Jul 2012, 21:33
Has thanked: 15 times
Been thanked: 1 time

Re: Help with "Rayne, Academy Chancellor"

Postby kevlahnota » 27 Jul 2012, 11:31

Zambooo wrote:The ability didn't trigger when my opponent targetted me with Diabolic Edict...
I modified the code above, please try.
User avatar
kevlahnota
Programmer
 
Posts: 418
Joined: 19 Jul 2010, 17:45
Location: Philippines
Has thanked: 5 times
Been thanked: 97 times

Re: Help with "Rayne, Academy Chancellor"

Postby RiiakShiNal » 27 Jul 2012, 11:43

kev, you forgot to put in the condition that it only triggers if the spell/ability is controlled by an opponent so it should be more like this:
Code: Select all
<TRIGGER value="BECAME_TARGET">
    return ((TriggerObject():GetPlayer():GetTeam() == EffectController():GetTeam()) or       
       (TriggerPlayer() == EffectController())) and
       (SecondaryObject():GetPlayer():GetTeam() ~= EffectController():GetTeam())
</TRIGGER>
Need Decks and/or Cards unlocked then check out the Wiki: DotP 2013 Unlocking
RiiakShiNal
Programmer
 
Posts: 597
Joined: 16 May 2011, 21:37
Has thanked: 17 times
Been thanked: 109 times

Re: Help with "Rayne, Academy Chancellor"

Postby thefiremind » 27 Jul 2012, 11:49

There's another thing to add: it says "permanent" so the targetted object should be in play.
I also think it would be more precise if you could decide to draw only 1 card when the creature is enchanted.
Taking all into account, I would do something like this:
Code: Select all
  <TRIGGERED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <TRIGGER value="BECAME_TARGET">
    return ((TriggerObject() ~= nil and
    TriggerObject():GetPlayer():GetTeam() == EffectController():GetTeam() and
    TriggerObject():GetZone() == ZONE_IN_PLAY) or
    TriggerPlayer() == EffectController()) and
    (SecondaryObject():GetPlayer():GetTeam() ~= EffectController():GetTeam())
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    if EffectController():IsAI() == 0 then
       EffectController():BeginNewMultipleChoice()
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )
       EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_DRAW_A_CARD" )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if EffectController():IsAI() == 0 then
       local decision = Object():GetMultipleChoiceResult()
       if decision == 0 then
          EffectController():DrawCard()
       end
    elseif CountCardsInLibrary(EffectController()) &gt; 5 then
       EffectController():DrawCard()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if EffectSource():IsEnchanted() == 0 then
       return
    end
    if EffectController():IsAI() == 0 then
       EffectController():BeginNewMultipleChoice()
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )
       EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_DRAW_A_CARD" )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if EffectSource():IsEnchanted() == 0 then
       return
    end
    if EffectController():IsAI() == 0 then
       local decision = Object():GetMultipleChoiceResult()
       if decision == 0 then
          EffectController():DrawCard()
       end
    elseif CountCardsInLibrary(EffectController()) &gt; 5 then
       EffectController():DrawCard()
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
(There are ways to shorten the code, like making a brand new multiple choice with "do nothing" / "draw a card" / "draw 2 cards", or using a repeating action, but I see no reason to make it more complicated just to save some bytes :wink:)
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
User avatar
thefiremind
Programmer
 
Posts: 1636
Joined: 07 Nov 2011, 10:55
Has thanked: 60 times
Been thanked: 359 times

Re: Help with "Rayne, Academy Chancellor"

Postby Zambooo » 27 Jul 2012, 14:18

Mmmh.. the ability triggered when one of my creature was targetted by Spitting Earth, but didn't do it when another creature was targetted by the ability of Cyclops Gladiator
Zambooo
 
Posts: 79
Joined: 01 Jul 2012, 21:33
Has thanked: 15 times
Been thanked: 1 time

Re: Help with "Rayne, Academy Chancellor"

Postby RiiakShiNal » 27 Jul 2012, 14:37

Zambooo wrote:Mmmh.. the ability triggered when one of my creature was targetted by Spitting Earth, but didn't do it when another creature was targetted by the ability of Cyclops Gladiator
That would be because kevlahnota wrote Cyclops Gladiator in a way where it does not "target", but instead allows for choosing any creature that fits the conditions. This is actually incorrect as it would allow Cyclops Gladiator to target things it shouldn't such as creatures with Hexproof or Shroud like Troll Ascetic, Gladecover Scout, Drove of Elves, and Deft Duelist. Cyclops Gladiator should be written such that it has both a TARGET_DEFINITION block and a TARGET_DETERMINATION block so that it can't target things it's not allowed to target and abilities like those on Rayne, Academy Chancellor work.

Instead of:
Code: Select all
   <PLAY_TIME_ACTION>
    local defendingPlayer = Object():GetPlayerAttacked()
   if defendingPlayer ~= nil then
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetController( defendingPlayer )
      filter:AddCardType( CARD_TYPE_CREATURE )
      filter:SetZone( ZONE_IN_PLAY )
      filter:SetHint( HINT_ENEMY, EffectController() )
      filter:May()
       filter:AIMay()
      EffectController():ChooseTarget( NO_VALIDATION, "CARD_QUERY_CHOOSE_CREATURE_TO_ARENA", EffectDC():Make_Targets(0) )
   end
    </PLAY_TIME_ACTION>
It should something like be:
Code: Select all
   <TARGET_DEFINITION id="0">
   local defendingPlayer = Object():GetPlayerAttacked()
   if defendingPlayer ~= nil then
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetController( defendingPlayer )
      filter:AddCardType( CARD_TYPE_CREATURE )
      filter:SetZone( ZONE_IN_PLAY )
      filter:SetHint( HINT_ENEMY, EffectController() )
      filter:May()
      filter:AIMay()
   end
   </TARGET_DEFINITION>
   <TARGET_DETERMINATION>
      return AtLeastOneTargetFromDefinition(0)
   </TARGET_DETERMINATION>
   <PLAY_TIME_ACTION target_choosing="1">
      EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_ARENA", EffectDC():Make_Targets(0) )
   </PLAY_TIME_ACTION>
Need Decks and/or Cards unlocked then check out the Wiki: DotP 2013 Unlocking
RiiakShiNal
Programmer
 
Posts: 597
Joined: 16 May 2011, 21:37
Has thanked: 17 times
Been thanked: 109 times

Re: Help with "Rayne, Academy Chancellor"

Postby thefiremind » 27 Jul 2012, 14:45

It also lacks of the target_choosing tag. Maybe that tag is more important than I could imagine.

Anyway, it's better if you test your cards against "official" decks, so that you don't blame your cards for other cards' bugs. :wink:
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
User avatar
thefiremind
Programmer
 
Posts: 1636
Joined: 07 Nov 2011, 10:55
Has thanked: 60 times
Been thanked: 359 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 3 guests


Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 10 minutes)
Most users ever online was 177 on 10 Oct 2011, 16:37

Users browsing this forum: No registered users and 3 guests

Login Form