Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Help with "Rayne, Academy Chancellor"
Moderator: CCGHQ Admins
Help with "Rayne, Academy Chancellor"
by 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:
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()) > 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()) > 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()) > 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()) > 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>
Re: Help with "Rayne, Academy Chancellor"
by 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):
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.
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Re: Help with "Rayne, Academy Chancellor"
by Zambooo » 27 Jul 2012, 11:19
The ability didn't trigger when my opponent targetted me with Diabolic Edict...
Re: Help with "Rayne, Academy Chancellor"
by kevlahnota » 27 Jul 2012, 11:31
I modified the code above, please try.Zambooo wrote:The ability didn't trigger when my opponent targetted me with Diabolic Edict...
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Re: Help with "Rayne, Academy Chancellor"
by 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>
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Help with "Rayne, Academy Chancellor"
by 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:
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()) > 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()) > 5 then
EffectController():DrawCard()
end
</RESOLUTION_TIME_ACTION>
</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: 721 times
Re: Help with "Rayne, Academy Chancellor"
by 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
Re: Help with "Rayne, Academy Chancellor"
by RiiakShiNal » 27 Jul 2012, 14:37
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.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
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>
- 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>
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Help with "Rayne, Academy Chancellor"
by 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.
Anyway, it's better if you test your cards against "official" decks, so that you don't blame your cards for other cards' bugs.
< 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: 721 times
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 9 guests