It is currently 19 Jul 2025, 10:38
   
Text Size

Community Wad

Moderator: CCGHQ Admins

Re: Community Wad

Postby Misplay » 17 Aug 2016, 00:10

Faster than light, very impressive!
EDIt: Art files sent.
Misplay
 
Posts: 92
Joined: 29 Aug 2013, 08:26
Has thanked: 50 times
Been thanked: 10 times

Re: Community Wad

Postby Xander9009 » 17 Aug 2016, 00:58

Misplay wrote:Faster than light, very impressive!
EDIt: Art files sent.
The ones you sent were already added to the update. I also figured out the problem and how to fix the rest. Well, sort of... I tested it out on Walker of the Wastes. I don't actually know what's wrong, but if the images in use already are converted to PNG and then back to TDX, then it fixes the invisible text box issue. They must have been converted badly before somehow. I've actually already got them all fixed, but I did it in batch for ALL art files made after a certain date, so there are LOTS that aren't "fixed" because they weren't messed up to begin with. So, now I'm just sorting through those. Glad it turned out to be an easy fix, though. :)

EDIT: All of the weird clear text boxes should be fixed. I don't know that I got them all, though. I only checked the OGW cards plus all planeswalkers. If anyone notices any others, it's a super easy fix. So, please let me know if you find any (AFTER downloading the new art update, of course, which is already uploaded and available).
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Community Wad

Postby Misplay » 17 Aug 2016, 02:58

Tamiyo is almost fix!
The issue appears when you use the first ability on opponent's creatures: you should draw the card, not your opponent.
Gatherer: "Tamiyo’s first ability can target creatures you don’t control. You’ll draw a card, not their controller, if they deal combat damage."

Glad you find a solution for the "transparence" issue. :)
Misplay
 
Posts: 92
Joined: 29 Aug 2013, 08:26
Has thanked: 50 times
Been thanked: 10 times

Re: Community Wad

Postby Xander9009 » 17 Aug 2016, 03:16

Misplay wrote:Tamiyo is almost fix!
The issue appears when you use the first ability on opponent's creatures: you should draw the card, not your opponent.
Gatherer: "Tamiyo’s first ability can target creatures you don’t control. You’ll draw a card, not their controller, if they deal combat damage."

Glad you find a solution for the "transparence" issue. :)
Fixed and tested moderately thoroughly.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Community Wad

Postby Misplay » 17 Aug 2016, 11:38

I tested it few minutes ago (WAD v590), and the issue isn't fix. :(
Can't help much, sorry.
Misplay
 
Posts: 92
Joined: 29 Aug 2013, 08:26
Has thanked: 50 times
Been thanked: 10 times

Re: Community Wad

Postby tmxk2012917 » 17 Aug 2016, 13:41

nissa, vastwood seer cannot be transferred correctly. There are counters on the card but the card is still nissa, vastwood seer.

I tested it without any mod else
tmxk2012917
 
Posts: 164
Joined: 15 Mar 2015, 09:52
Has thanked: 20 times
Been thanked: 12 times

Re: Community Wad

Postby Xander9009 » 17 Aug 2016, 14:29

Misplay wrote:I tested it few minutes ago (WAD v590), and the issue isn't fix. :(
Can't help much, sorry.
The wad just hasn't updated yet lol. It will soon. I don't know when, but it shouldn't be too long.

tmxk2012917 wrote:nissa, vastwood seer cannot be transferred correctly. There are counters on the card but the card is still nissa, vastwood seer.

I tested it without any mod else
Gah! That dang card just doesn't like to keep working. It's been working perfectly several times in the past, and ever time, it breaks somehow.

EDIT: Also, someone posted the bug in the bug reported that Edlritch Moon cards aren't showing art. First, I frankly didn't even realize anyone had started coding them. So that's nice to hear. Second, the art hasn't been added yet. It's not a bug, and it'll be dealt with whenever someone takes the time to collect the art and add it to the CW.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Community Wad

Postby Xander9009 » 17 Aug 2016, 18:45

tmxk2012917 wrote:nissa, vastwood seer cannot be transferred correctly. There are counters on the card but the card is still nissa, vastwood seer.

I tested it without any mod else
Turned out to be an engine bug I already knew about, I just didn't remember it. In fact, I was the one that discovered it and found the solution, but I'd forgotten all about it.

viewtopic.php?f=63&t=17403&p=182305

Fixed now. Nissa (and 48 other cards) should be working well in the next version.
Last edited by Xander9009 on 17 Aug 2016, 18:58, edited 1 time in total.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Community Wad

Postby tmxk2012917 » 17 Aug 2016, 18:48

thank you
tmxk2012917
 
Posts: 164
Joined: 15 Mar 2015, 09:52
Has thanked: 20 times
Been thanked: 12 times

Re: Community Wad

Postby Misplay » 17 Aug 2016, 19:21

Code for Recruiter of the Guard, from Conspiracy 2 (this card will only be translated in english, it would be cool if someone can translate the others languages, I already add the french version):

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="RECRUITER_OF_THE_GUARD_CW_XXX" />
   <CARDNAME text="RECRUITER_OF_THE_GUARD" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Recruteur de la garde]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Recruiter of the Guard]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="XXX" />
   <ARTID value="RECRUITER_OF_THE_GUARD" />
   <ARTIST name="Jason Rainville" />
   <CASTING_COST cost="{2}{W}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Avant qu'une cause puisse avoir des partisans, elle doit d'abord avoir une voix.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[Before a cause can have supporters, it has to have a voice.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Human" />
   <SUB_TYPE metaname="Soldier" />
   <EXPANSION value="ME2" />
   <RARITY metaname="R" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <TRIGGERED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Quand le Recruteur de la garde arrive sur le champ de bataille, cherchez dans votre bibliothèque une carte de créature avec une endurance de 2 ou moins, révélez-la, et mettez-la dans votre main. Mélangez ensuite votre bibliothèque.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[When Recruiter of the Guard enters the battlefield, search your library for a creature card with toughness 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
      <RESOLUTION_TIME_ACTION>
         local filter = ClearFilter()
         local effectController = EffectController()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_TOUGHNESS, OP_LESS_THAN_OR_EQUAL_TO, 2 )
         filter:SetZone( ZONE_LIBRARY, effectController)
         effectController:ChooseItem( "CARD_QUERY_TUTOR", EffectDC():Make_Targets(0) )
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
         if  target ~= nil then
            target:Reveal()
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
         if  target ~= nil then
            target:PutInHand()
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         EffectController():ShuffleLibrary()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
   <SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
   <AUTHOR><![CDATA[Misplay]]></AUTHOR>
   <EDITORS><![CDATA[Misplay]]></EDITORS>
   <DATE><![CDATA[17-08-16]]></DATE>
</CARD_V2>
Doesn't have the ID of the card... And I'm looking for a good art file, I'll send you it asap.

Small correction of Imperial recruiter's translation (French):
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="IMPERIAL_RECRUITER_CW_184716" />
   <CARDNAME text="IMPERIAL_RECRUITER" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Recruteur impérial]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Imperial Recruiter]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="184716" />
   <ARTID value="IMPERIAL_RECRUITER" />
   <ARTIST name="Mitsuaki Sagiri" />
   <CASTING_COST cost="{2}{R}" />
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Human" />
   <SUB_TYPE metaname="Advisor" />
   <EXPANSION value="ME2" />
   <RARITY metaname="R" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <TRIGGERED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Imperial Recruiter enters the battlefield, search your library for a creature card with power 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Quand le Recruteur impérial arrive sur le champ de bataille, cherchez dans votre bibliothèque une carte de créature avec une force de 2 ou moins, révélez-la, et mettez-la dans votre main. Mélangez ensuite votre bibliothèque.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[When Imperial Recruiter enters the battlefield, search your library for a creature card with power 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[When Imperial Recruiter enters the battlefield, search your library for a creature card with power 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Quando Imperial Recruiter entra nel campo di battaglia, passa in rassegna il tuo grimorio per una carta creatura con forza pari o inferiore a 2, rivelala, e aggiungila alla tua mano. Poi rimescola il tuo grimorio.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[When Imperial Recruiter enters the battlefield, search your library for a creature card with power 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[When Imperial Recruiter enters the battlefield, search your library for a creature card with power 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[When Imperial Recruiter enters the battlefield, search your library for a creature card with power 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[When Imperial Recruiter enters the battlefield, search your library for a creature card with power 2 or less, reveal it, and put it into your hand. Then shuffle your library.]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
      <RESOLUTION_TIME_ACTION>
         local filter = ClearFilter()
         local effectController = EffectController()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_POWER, OP_LESS_THAN_OR_EQUAL_TO, 2 )
         filter:SetZone( ZONE_LIBRARY, effectController)
         effectController:ChooseItem( "CARD_QUERY_TUTOR", EffectDC():Make_Targets(0) )
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
         if  target ~= nil then
            target:Reveal()
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
         if  target ~= nil then
            target:PutInHand()
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         EffectController():ShuffleLibrary()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
   <SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
   <AUTHOR><![CDATA[mamoul]]></AUTHOR>
   <EDITORS><![CDATA[mamoul]]></EDITORS>
   <DATE><![CDATA[27-01-15]]></DATE>
</CARD_V2>
Misplay
 
Posts: 92
Joined: 29 Aug 2013, 08:26
Has thanked: 50 times
Been thanked: 10 times

Re: Community Wad

Postby Xander9009 » 17 Aug 2016, 19:40

Both added, with Recruiter of the Guard getting a warning ability about the eventual filename change.

EDIT: Daretti, Ingenious Iconoclast looks awesome. :) (Plus, I just like the word iconoclast... haha)
http://www.magicspoiler.com/mtg-spoiler ... conoclast/
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Community Wad

Postby Misplay » 17 Aug 2016, 23:46

@ Xander, Bug Researcher: Tamiyo's first ability works well, thanks A LOT for this one, I really like her.
(And a big hug to Fallenangle too!)

However, you changed the third ability, and it doesn't work properly anymore. Don't know why you changed it, maybe I'm missing something (there was an "UPDATED" written at the beginning of the line, in the description of the ability). I just copied the old version of the ability made by Fallenangle. Tested and working well now.

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<CARD_V2 ExportVersion="2">
   <FILENAME text="TAMIYO_FIELD_RESEARCHER_CW_43200060" />
   <CARDNAME text="TAMIYO_FIELD_RESEARCHER" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Tamiyo, Field Researcher]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="43200060" />
   <ARTID value="TAMIYO_FIELD_RESEARCHER" />
   <ARTIST name="Tianhua X" />
   <CASTING_COST cost="{1}{G}{W}{U}" />
   <TYPE metaname="Planeswalker" />
   <TYPE metaname="Enchantment" />
   <SUB_TYPE metaname="Tamiyo" />
   <EXPANSION value="EMN" />
   <RARITY metaname="M" />
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_TRANSITION">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|(Loyalty 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|(Loyauté 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|(Lealtad 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|(Loyalität 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|(Fedeltà 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[(忠誠 4)]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[|(충성 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|(Верность 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|(Lealdade 4)|]]></LOCALISED_TEXT>
      <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
      <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
      <RESOLUTION_TIME_ACTION>
         if EffectSource() ~= nil then
            EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 4 )
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>         
   <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(+1): Choose up to two target creatures. Until your next turn, whenever either of those creatures deals combat damage, you draw a card.]]></LOCALISED_TEXT>
      <AVAILABILITY>
         return PLW_MyPlayerDC( EffectController() ):Get_Int(PLW_TEFERI_ARCHMAGE_EMBLEM) == 1 or EffectController():IsSorceryTime() == true
      </AVAILABILITY>
      <COST type="generic">
         <PREREQUISITE>
            return true
         </PREREQUISITE>
         <RESOLUTION_TIME_ACTION>
            if EffectSource() ~= nil then
               PLW_ShutDownDoublingSeason()
               EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 1 )
            end
         </RESOLUTION_TIME_ACTION>
      </COST>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE" definition="0" compartment="0" count="2" up_to="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         if EffectDC():Get_Targets(0) ~= nil then
            local DelayDC = EffectDC():Make_Chest(2)
            DelayDC:Set_Int(0, MTG():GetTurnNumber())
            DelayDC:Set_CardPtr(1, EffectDC():Get_Targets(0):Get_CardPtr(0))
            DelayDC:Set_CardPtr(2, EffectDC():Get_Targets(0):Get_CardPtr(1))
            MTG():CreateDelayedTrigger(5, DelayDC)
         end
      </RESOLUTION_TIME_ACTION>
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(-2): Tap up to two target nonland permanents. They don't untap during their controller's next untap step.]]></LOCALISED_TEXT>
      <AVAILABILITY>
         return PLW_MyPlayerDC( EffectController() ):Get_Int(PLW_TEFERI_ARCHMAGE_EMBLEM) == 1 or EffectController():IsSorceryTime() == true
      </AVAILABILITY>
      <COST type="RemoveCountersSelf" amount="2" counter_type="Loyalty" />
      <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_TAPHOLD" definition="1" compartment="1" count="2" up_to="1" />
      <TARGET_DEFINITION id="1">
         local filter = ClearFilter()
         filter:Add( FE_IS_PERMANENT, true )
         filter:Add( FE_TYPE, OP_NOT, CARD_TYPE_LAND )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         for i = 0,(2-1) do
            local target_card = EffectDC():Get_Targets(1):Get_CardPtr(i)
            if target_card ~= nil then
               target_card:TapAndHold()
            end
         end
      </RESOLUTION_TIME_ACTION>
      <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
      <SFX text="TARGET_PLAYER_LIFE_PLAY" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(−7): Draw three cards. You get an emblem with "You may cast nonland cards from your hand without paying their mana costs."]]></LOCALISED_TEXT>
      <AVAILABILITY>
         return PLW_MyPlayerDC( EffectController() ):Get_Int(PLW_TEFERI_ARCHMAGE_EMBLEM) == 1 or EffectController():IsSorceryTime() == true
      </AVAILABILITY>
      <COST type="RemoveCountersSelf" amount="7" counter_type="Loyalty" />
      <RESOLUTION_TIME_ACTION>
         EffectController():DrawCards(3)
         MTG():PutTokensOntoBattlefield( "_MANAGER_TAMIYO", 1, EffectController() )
      </RESOLUTION_TIME_ACTION>
   </ACTIVATED_ABILITY>
   <TRIGGERED_ABILITY resource_id="5">
      <TRIGGER value="SOURCE_DEALS_DAMAGE" damage_type="combat">
         return TriggerObject() ~= nil and (TriggerObject() == EffectDC():Get_CardPtr(1) or TriggerObject() == EffectDC():Get_CardPtr(2))
      </TRIGGER>
      <CLEANUP>
         return PLW_UntilMyNextTurn(EffectDC():Get_Int(0))
      </CLEANUP>
      <RESOLUTION_TIME_ACTION>
         EffectController():DrawCards(1)
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         PLW_CreateUniqueTokenForEachPlayer("_MANAGER_PLANESWALKERS", "_MANAGER_PLANESWALKERS")
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY>
      <CONTINUOUS_ACTION layer="0">
         PLW_Protection_Filter()
         EffectSource():Protection()
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TOKEN_REGISTRATION reservation="1" type="_MANAGER_PLANESWALKERS" />
   <TOKEN_REGISTRATION reservation="1" type="_MANAGER_TAMIYO" />
   <AI_COUNTER_SCORE type="Loyalty" score="100" />
   <AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
   <AUTHOR><![CDATA[fallenangle]]></AUTHOR>
   <EDITORS><![CDATA[fallenangle, Xander9009]]></EDITORS>
   <DATE><![CDATA[07-13-16, 16-08-16]]></DATE>
</CARD_V2>
Xander9009 wrote:Daretti, Ingenious Iconoclast looks awesome.
Seems like Tezzeret has a new friend... Kaya isn't bad either.
http://www.magicspoiler.com/mtg-spoiler/kaya-ghost-assassin/
Misplay
 
Posts: 92
Joined: 29 Aug 2013, 08:26
Has thanked: 50 times
Been thanked: 10 times

Re: Community Wad

Postby Xander9009 » 18 Aug 2016, 01:04

Misplay wrote:@ Xander, Bug Researcher: Tamiyo's first ability works well, thanks A LOT for this one, I really like her.
(And a big hug to Fallenangle too!)

However, you changed the third ability, and it doesn't work properly anymore. Don't know why you changed it, maybe I'm missing something (there was an "UPDATED" written at the beginning of the line, in the description of the ability). I just copied the old version of the ability made by Fallenangle. Tested and working well now.

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<CARD_V2 ExportVersion="2">
   <FILENAME text="TAMIYO_FIELD_RESEARCHER_CW_43200060" />
   <CARDNAME text="TAMIYO_FIELD_RESEARCHER" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Tamiyo, Field Researcher]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="43200060" />
   <ARTID value="TAMIYO_FIELD_RESEARCHER" />
   <ARTIST name="Tianhua X" />
   <CASTING_COST cost="{1}{G}{W}{U}" />
   <TYPE metaname="Planeswalker" />
   <TYPE metaname="Enchantment" />
   <SUB_TYPE metaname="Tamiyo" />
   <EXPANSION value="EMN" />
   <RARITY metaname="M" />
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_TRANSITION">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|(Loyalty 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|(Loyauté 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|(Lealtad 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|(Loyalität 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|(Fedeltà 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[(忠誠 4)]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[|(충성 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|(Верность 4)|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|(Lealdade 4)|]]></LOCALISED_TEXT>
      <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
      <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
      <RESOLUTION_TIME_ACTION>
         if EffectSource() ~= nil then
            EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 4 )
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>         
   <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(+1): Choose up to two target creatures. Until your next turn, whenever either of those creatures deals combat damage, you draw a card.]]></LOCALISED_TEXT>
      <AVAILABILITY>
         return PLW_MyPlayerDC( EffectController() ):Get_Int(PLW_TEFERI_ARCHMAGE_EMBLEM) == 1 or EffectController():IsSorceryTime() == true
      </AVAILABILITY>
      <COST type="generic">
         <PREREQUISITE>
            return true
         </PREREQUISITE>
         <RESOLUTION_TIME_ACTION>
            if EffectSource() ~= nil then
               PLW_ShutDownDoublingSeason()
               EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 1 )
            end
         </RESOLUTION_TIME_ACTION>
      </COST>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE" definition="0" compartment="0" count="2" up_to="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         if EffectDC():Get_Targets(0) ~= nil then
            local DelayDC = EffectDC():Make_Chest(2)
            DelayDC:Set_Int(0, MTG():GetTurnNumber())
            DelayDC:Set_CardPtr(1, EffectDC():Get_Targets(0):Get_CardPtr(0))
            DelayDC:Set_CardPtr(2, EffectDC():Get_Targets(0):Get_CardPtr(1))
            MTG():CreateDelayedTrigger(5, DelayDC)
         end
      </RESOLUTION_TIME_ACTION>
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(-2): Tap up to two target nonland permanents. They don't untap during their controller's next untap step.]]></LOCALISED_TEXT>
      <AVAILABILITY>
         return PLW_MyPlayerDC( EffectController() ):Get_Int(PLW_TEFERI_ARCHMAGE_EMBLEM) == 1 or EffectController():IsSorceryTime() == true
      </AVAILABILITY>
      <COST type="RemoveCountersSelf" amount="2" counter_type="Loyalty" />
      <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_TAPHOLD" definition="1" compartment="1" count="2" up_to="1" />
      <TARGET_DEFINITION id="1">
         local filter = ClearFilter()
         filter:Add( FE_IS_PERMANENT, true )
         filter:Add( FE_TYPE, OP_NOT, CARD_TYPE_LAND )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         for i = 0,(2-1) do
            local target_card = EffectDC():Get_Targets(1):Get_CardPtr(i)
            if target_card ~= nil then
               target_card:TapAndHold()
            end
         end
      </RESOLUTION_TIME_ACTION>
      <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
      <SFX text="TARGET_PLAYER_LIFE_PLAY" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(−7): Draw three cards. You get an emblem with "You may cast nonland cards from your hand without paying their mana costs."]]></LOCALISED_TEXT>
      <AVAILABILITY>
         return PLW_MyPlayerDC( EffectController() ):Get_Int(PLW_TEFERI_ARCHMAGE_EMBLEM) == 1 or EffectController():IsSorceryTime() == true
      </AVAILABILITY>
      <COST type="RemoveCountersSelf" amount="7" counter_type="Loyalty" />
      <RESOLUTION_TIME_ACTION>
         EffectController():DrawCards(3)
         MTG():PutTokensOntoBattlefield( "_MANAGER_TAMIYO", 1, EffectController() )
      </RESOLUTION_TIME_ACTION>
   </ACTIVATED_ABILITY>
   <TRIGGERED_ABILITY resource_id="5">
      <TRIGGER value="SOURCE_DEALS_DAMAGE" damage_type="combat">
         return TriggerObject() ~= nil and (TriggerObject() == EffectDC():Get_CardPtr(1) or TriggerObject() == EffectDC():Get_CardPtr(2))
      </TRIGGER>
      <CLEANUP>
         return PLW_UntilMyNextTurn(EffectDC():Get_Int(0))
      </CLEANUP>
      <RESOLUTION_TIME_ACTION>
         EffectController():DrawCards(1)
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         PLW_CreateUniqueTokenForEachPlayer("_MANAGER_PLANESWALKERS", "_MANAGER_PLANESWALKERS")
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY>
      <CONTINUOUS_ACTION layer="0">
         PLW_Protection_Filter()
         EffectSource():Protection()
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TOKEN_REGISTRATION reservation="1" type="_MANAGER_PLANESWALKERS" />
   <TOKEN_REGISTRATION reservation="1" type="_MANAGER_TAMIYO" />
   <AI_COUNTER_SCORE type="Loyalty" score="100" />
   <AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
   <AUTHOR><![CDATA[fallenangle]]></AUTHOR>
   <EDITORS><![CDATA[fallenangle, Xander9009]]></EDITORS>
   <DATE><![CDATA[07-13-16, 16-08-16]]></DATE>
</CARD_V2>
Xander9009 wrote:Daretti, Ingenious Iconoclast looks awesome.
Seems like Tezzeret has a new friend... Kaya isn't bad either.
http://www.magicspoiler.com/mtg-spoiler/kaya-ghost-assassin/
I didn't change it because it wasn't working, but rather because it was setting a bad precedent. fallenangle and I had been discussing it while he was making it, and we discussed using a manager token to get it to work (it was being stubborn and not working other ways). After it was working, I mentioned that it should be done by using the planeswalker manager we already have and it should work the same, but without a manager token just for one (simple) ability of one card.

I tested it on my end and it was working, and I just tested again, and it was still working. Could you do me a favor and open up your _MANAGER_PLANESWALKER file and check the bottom? The last ability should have the header "<!-- Tamiyo, Field Researcher Emblem -->". If it doesn't, then your end isn't working because of that. You should also check the function file "D14_PLW.LOL". Make sure line 14 reads "PLW_TAMIYO_FIELD_RESEARCHER_EMBLEM = 6". I just checked Google Drive online and the correct versions of the files are there, so if you're using the loose files version, just grab those two files and it should work.

Also, UPDATED was just in there so I could make sure while testing that the game was in fact loading my test version, and not the old version (which I already knew worked, and didn't want a false positive). I Just forgot to remove it.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Community Wad

Postby Misplay » 18 Aug 2016, 01:34

Ok. Not sure to understand everything you said, so I just put the copy of those files....

Here's the copy of the "_MANAGER_PLANESWALKERS" file I used (WAD v589):
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="11">
   <FILENAME text="_MANAGER_PLANESWALKERS" />
   <CARDNAME text="_MANAGER_PLANESWALKERS" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Planeswalker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Planeswalker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Planeswalker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Planeswalker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Planeswalker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[プレインズウォーカー]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[플레인즈워커]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Planeswalker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Planeswalker]]></LOCALISED_TEXT>
   </TITLE>
   <ARTID value="0" />
   <ARTIST name="Nobody" />
   <CASTING_COST cost="" />
   <TYPE metaname="" />
   <EXPANSION value="DPI" />
   <RARITY metaname="C" />
   <TRIGGERED_ABILITY linked_ability_group="1" replacement_query="1">
      <TRIGGER value="ZONECHANGE_END" to_zone="ZONE_BATTLEFIELD" >
         if TriggerObject() ~= nil then
            local filter = ClearFilter()
            filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
            PLW_FilterNameSet(filter, "PLANESWALKERS", true)
            filter:Add( FE_CARD_INSTANCE, OP_IS, TriggerObject() )
            filter:Add( FE_CARD_NAME, OP_NOT, "GARRUK_RELENTLESS" )
            filter:Add( FE_CARD_NAME, OP_NOT, "SARKHAN_THE_DRAGONSPEAKER" )
            return filter:CountStopAt(1) == 1
         end
         return false
      </TRIGGER>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_EXILE" definition="0" compartment="0" at_random="1" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         if TriggerObject() ~= nil then
            filter:Add( FE_CARD_INSTANCE, OP_IS, TriggerObject() )
         end
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         LinkedDC():Set_Int(88, 2)
         EffectSource():StoreCopiableValues(EffectDC():Make_Chest(2))
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local card = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if card ~= nil then
            card:UseCopiableValues(EffectDC():Get_Chest(2))
         end
      </RESOLUTION_TIME_ACTION>
      <CONTINUOUS_ACTION layer="1">
         local card = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if card ~= nil and EffectDC():Get_Chest(2) ~= nil  then
            card:UseCopiableValues(EffectDC():Get_Chest(2))
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="4">
         local card = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if card ~= nil then
            local characteristics = card:GetCurrentCharacteristics()
            local card_type = characteristics:CardType_GetWritable()
            local sub_type = characteristics:SubType_GetWritable()
            sub_type:ClearAllOfType( CARD_TYPE_ARTIFACT )
            sub_type:ClearAllOfType( CARD_TYPE_CREATURE )
            sub_type:ClearAllOfType( CARD_TYPE_ENCHANTMENT )
            sub_type:ClearAllOfType( CARD_TYPE_LAND )
            sub_type:ClearAllOfType( CARD_TYPE_PLANESWALKER )
            card_type:Clear()
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="5">
         local card = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if card ~= nil then
            card:GetCurrentCharacteristics():Colour_Get():Clear()
         end
      </CONTINUOUS_ACTION>
      <RESOLUTION_TIME_ACTION>
         MTG():CreateDelayedTrigger(20, nil)
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         MTG():ReevaluateContinuousEffects()
      </RESOLUTION_TIME_ACTION>
      <DURATION>
         return LinkedDC():Get_Int(88) == 1
      </DURATION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY resource_id="20" replacement_effect="1" linked_ability_group="1" active_zone="ZONE_ANY">
      <TRIGGER value="STATE_BASED_EFFECTS"/>
      <CLEANUP fire_once="1" />
      <RESOLUTION_TIME_ACTION>
         LinkedDC():Set_Int(88, 1)
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         MTG():ReevaluateContinuousEffects()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- Invisible token protection -->
   <STATIC_ABILITY>
      <CONTINUOUS_ACTION layer="8">
         if EffectSource() ~= nil then
            local characteristics = EffectSource():GetCurrentCharacteristics()
            characteristics:Bool_Set(CHARACTERISTIC_SHROUD, 1)
            characteristics:Bool_Set(CHARACTERISTIC_INDESTRUCTIBLE, 1)
            characteristics:AI_SetWorthless()
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="8">
         if EffectSource() ~= nil then
            local filter = ClearFilter()
            filter:Add(FE_CMC, OP_GREATER_THAN_OR_EQUAL_TO, 0)
            EffectSource():Protection()
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1">
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD"/>
      <RESOLUTION_TIME_ACTION>
         --MTG():MessageAllPlayers("Created PLW Manager")
         local filter = ClearFilter()
         filter:Add( FE_CARD_NAME, OP_IS, "_MANAGER_PLANESWALKERS" )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
         local filter_count = filter:EvaluateObjects()
         if filter_count &gt; 1 then
            for i=1,filter_count-1 do
               local card = filter:GetNthEvaluatedObject(i)
               if card ~= nil then
                  card:QueueZoneChange( ZONE_CEASED_TO_EXIST, EffectController() )
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- Planeswalker rules -->
   <!-- 1. Planeswalker goes to the graveyard when it has no loyalty counters left -->
   <TRIGGERED_ABILITY replacement_effect="1">
      <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
      <TRIGGER value="STATE_BASED_EFFECTS" />
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
         PLW_FilterNameSet(filter, "PLANESWALKERS", true)
      </FILTER>
      <RESOLUTION_TIME_ACTION filter_id="0">
         if FilteredCard() ~= nil and FilteredCard():CountCounters( MTG():GetCountersType("Loyalty") ) == 0 then
            FilteredCard():PutInGraveyard()
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- 2. Planeswalkers' "Legendary rule" -->
   <TRIGGERED_ABILITY replacement_query="1">
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD">
         return PLW_IsInNameSet( TriggerObject(), "PLANESWALKERS" )
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         MTG():ClearFilterMark()
         local tobj = TriggerObject()
         local filter = ClearFilter()
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
         PLW_FilterNameSet(filter, "PLANESWALKERS", true)
         local filter_count = filter:EvaluateObjects()
         if filter:CountStopAt(2) == 2 then
            for i=0,filter_count-1 do
               local card = filter:GetNthEvaluatedObject(i)
               if card:GetCardType():Test(CARD_TYPE_CREATURE) == false then
                  if PLW_GetSubType(card) == PLW_GetSubType(tobj) then
                     card:MarkForFilter()
                  end
               end
            end
            filter:SetMarkedObjectsOnly()
            if filter:CountStopAt(2) == 2 then
               EffectController():ChooseItem( "PLW_CARD_QUERY_CHOOSE_PLANESWALKER_TO_SAVE", EffectDC():Make_Targets(0) )
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local to_keep = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if to_keep ~= nil then
            local filter = ClearFilter()
            filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
            PLW_FilterNameSet(filter, "PLANESWALKERS", true)
            local filter_count = filter:EvaluateObjects()
            for i=0,filter_count-1 do
               local card = filter:GetNthEvaluatedObject(i)
               if card ~= to_keep and PLW_GetSubType(card) == PLW_GetSubType( TriggerObject() ) then
                  card:PutInGraveyard()
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- 3. Planeswalkers' abilities can be played only once per turn -->
   <TRIGGERED_ABILITY replacement_effect="1">
      <TRIGGER value="ACTIVATED_ABILITY_PLAYED" simple_qualifier="objectyoucontrol">
         if not PLW_IsInNameSet( TriggerObject(), "PLANESWALKERS" ) then
            return false
         end
         --MTG():MessageAllPlayers("PLW ability activated")
         local activations_chest = PLW_MyDuelDC():Get_Chest(PLW_PLANESWALKERS_ACTIVATIONS_CHEST)
         if activations_chest == nil then
            activations_chest = PLW_MyDuelDC():Make_Chest(PLW_PLANESWALKERS_ACTIVATIONS_CHEST)
         end
         -- Find the Planeswalker
         local current_index = -1
         local last_index = activations_chest:Get_Int(0)
         if last_index &gt; 0 then
            for i=1,last_index,2 do
               local card = activations_chest:Get_CardPtr(i)
               if card ~= nil and card == TriggerObject() then
                  -- Planeswalker found
                  current_index = i
                  break
               end
            end
         else
            last_index = -1 -- this will make it right when adding 2 later
         end
         if current_index == -1 then
            -- Planeswalker not found, let's add it
            last_index = last_index + 2
            activations_chest:Set_Int(0, last_index)
            activations_chest:Set_CardPtr( last_index, TriggerObject() )
            activations_chest:Set_Int(last_index+1, 0)
            current_index = last_index
         end
         -- Increase Planeswalker's activations count (1 register further than the card pointer)
         activations_chest:Int_Inc(current_index+1)
         -- Increase player's own activations count (will be used by The Chain Veil's first ability)
         PLW_MyPlayerDC( EffectController() ):Int_Inc(PLW_PLANESWALKERS_ACTIVATIONS)
         -- Save Planeswalker's activations count index for continuous action
         EffectDC():Set_Int(1, current_index+1)
         --EffectController():DisplayMessage("Activations : "..activations_chest:Get_Int( EffectDC():Get_Int(1) ))
         return true
      </TRIGGER>
      <CONTINUOUS_ACTION layer="8">
         if TriggerObject() ~= nil then
            local activations_chest = PLW_MyDuelDC():Get_Chest(PLW_PLANESWALKERS_ACTIVATIONS_CHEST)
            if activations_chest ~= nil then
               local loyalty_activations = activations_chest:Get_Int( EffectDC():Get_Int(1) )
               local chain_veil_activations = PLW_MyPlayerDC( TriggerObject():GetController() ):Get_Int(PLW_CHAIN_VEIL_ACTIVATIONS)
               if loyalty_activations &gt; chain_veil_activations then
                  TriggerObject():GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_CANT_USE_ACTIVATED_ABILITIES, 1)
               end
            end
         end
      </CONTINUOUS_ACTION>
      <DURATION simple_duration="UntilEOT" />
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_CLEANUP
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         PLW_MyDuelDC():Free_Compartment(PLW_PLANESWALKERS_ACTIVATIONS_CHEST)
         for i=0,MTG():GetNumberOfPlayers()-1 do
            local player_chest = PLW_MyPlayerDC( MTG():GetNthPlayer(i) )
            player_chest:Set_Int(PLW_PLANESWALKERS_ACTIVATIONS, 0)
            player_chest:Set_Int(PLW_CHAIN_VEIL_ACTIVATIONS, 0)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- 4. Damage redirection -->
   <TRIGGERED_ABILITY replacement_query="1" linked_ability_group="1">
      <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
      <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" pre_trigger="1" damage_type="noncombat">
         if LinkedDC():Get_Int(0) ~= 1 then
            local controller = EffectController()
            local amount = Damage() and Damage():GetAmount()
            if amount ~= nil and amount &gt; 0 and SecondaryPlayer() == controller and TriggerObject():GetPlayer():GetTeam() ~= controller:GetTeam() then
               local filter = ClearFilter()
               filter:Add(FE_CONTROLLER, OP_IS, controller)
               PLW_FilterNameSet(filter, "PLANESWALKERS", true)
               if filter:CountStopAt(1) == 1 then
                  EffectDC():Set_Int(2, amount)
                  Damage():Multiply(0)
                  return true
               end
            end
         else
            LinkedDC():Set_Int(0, 0) -- reset the flag
         end
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         local source = TriggerObject()
         if source ~= nil then
            local player = source:GetPlayer()
            if player ~= nil then
               local filter = ClearFilter()
               filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
               PLW_FilterNameSet(filter, "PLANESWALKERS", true)
               player:ChooseItem( "PLW_CARD_QUERY_CHOOSE_PLANESWALKER_REDIRECT_DAMAGE_TO", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
         local amount = EffectDC():Get_Int(2)
         if target ~= nil then
            PLW_DealDamageToPlaneswalker(TriggerObject(), target, amount)
         else
            LinkedDC():Set_Int(0, 1) -- set this flag so the trigger won't trigger again this time
            TriggerObject():DealDamageTo( amount, SecondaryPlayer() )
         end
         -- APPROXIMATION: if the damage is unpreventable, this way I'm removing that characteristic
         -- APPROXIMATION: if the Planeswalker isn't a creature, damage triggers from the source won't trigger
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- 5. Attacking Planeswalkers -->
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </FILTER>
      <CONTINUOUS_ACTION layer="8" filter_id="0">
         if FilteredCard() ~= nil then
            local filter = ClearFilter()
            filter:Add( FE_CARD_NAME, OP_IS, EffectSource() )
            filter:EvaluateObjects()
            if EffectSource() == filter:GetNthEvaluatedObject(0) then -- only 1 manager should grant the ability
               FilteredCard():GetCurrentCharacteristics():GrantAbility(0)
            end
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_query="1" resource_id="0">
      <TRIGGER value="ATTACKING" simple_qualifier="self" />
      <RESOLUTION_TIME_ACTION>
         local defending = TriggerObject() and TriggerObject():GetPlayerAttacked()
         if defending ~= nil then
            local filter = ClearFilter()
            filter:Add(FE_CONTROLLER, OP_IS, defending)
            filter:Add(FE_LUA_CONDITION, 1, EffectController(), EffectDC())
            local subfilter = filter:AddSubFilter_Or()
            subfilter:Add(FE_CARD_NAME, OP_IS, "GIDEON_JURA")
            subfilter:Add(FE_CARD_NAME, OP_IS, "GIDEON_BATTLE_FORGED")
            if filter:CountStopAt(1) &gt; 0 then
               EffectController():ChooseItem("PLW_CARD_QUERY_CHOOSE_PLANESWALKER_TO_ATTACK", EffectDC():Make_Targets(0))
            else
               filter = ClearFilter()
               filter:Add(FE_CONTROLLER, OP_IS, defending)
               PLW_FilterNameSet(filter, "PLANESWALKERS", true)
               if filter:CountStopAt(1) == 1 then
                  EffectController():ChooseItem("PLW_CARD_QUERY_CHOOSE_PLANESWALKER_TO_ATTACK", EffectDC():Make_Targets(0), QUERY_FLAG_MAY )
               end
            end
         end
         -- APPROXIMATION: a creature attacking a Planeswalker shouldn't be counted as attacking the player
      </RESOLUTION_TIME_ACTION>
      <FILTER_CONDITION id="1">
         local oDC = RSN_GetObjectDC(FilteredCard())
         if oDC ~= nil then
            return oDC:Get_Int(0) == 1
         end
         return false
      </FILTER_CONDITION>
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if target ~= nil then
            local defending = TriggerObject() and TriggerObject():GetPlayerAttacked()
            if defending ~= nil and defending:IsAI() == false then
               defending:SetCustomQueryInstructionCardPtr(target)
               defending:BeginNewMultipleChoice()
                  defending:AddMultipleChoiceAnswer("CONTROL_MB_CONFIRM")
               defending:AskMultipleChoiceQuestion( "PLW_CARD_QUERY_ATTACKED_PLANESWALKER", TriggerObject() )
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if target ~= nil then
            local delayDC = EffectDC():Make_Chest(1)
            delayDC:Set_CardPtr( 0, TriggerObject() )
            delayDC:Set_CardPtr(1, target)
            MTG():CreateDelayedTrigger(1, delayDC)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" resource_id="1">
      <CLEANUP>
         return MTG():GetStep() == STEP_END_OF_COMBAT
      </CLEANUP>
      <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
      <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" damage_type="combat" pre_trigger="1">
         local amount = Damage() and Damage():GetAmount()
         if amount ~= nil and amount &gt; 0 and TriggerObject() == EffectDC():Get_CardPtr(0) then
            local target = EffectDC():Get_CardPtr(1)
            if target ~= nil then
               PLW_SetLastDamageInfo( target, TriggerObject(), amount )
               if target:GetCardType():Test(CARD_TYPE_CREATURE) then
                  Damage():RedirectAllTo(target)
               else
                  Damage():Multiply(0)
                  if PLW_MyPlayerDC( target:GetController() ):Get_Int(PLW_AJANI_STEADFAST_EMBLEM) == 0 then
                     target:RemoveCounters( MTG():GetCountersType("Loyalty"), amount )
                  else
                     target:RemoveCounters( MTG():GetCountersType("Loyalty"), 1 )
                  end
                  EffectDC():Set_Int(2, amount)
                  MTG():CreateDelayedTrigger( 2, EffectDC() )
               end
            end
            return true
         end
         return false
         -- APPROXIMATION: if the Planeswalker isn't a creature, damage triggers from the source won't trigger
      </TRIGGER>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY forced_skip="1" resource_id="2">
      <CLEANUP fire_once="1" />
      <TRIGGER value="STATE_BASED_EFFECTS" />
      <RESOLUTION_TIME_ACTION>
         local target = EffectDC():Get_CardPtr(1)
         if target ~= nil then
            PLW_SetLastDamageInfo( target, EffectDC():Get_CardPtr(0), EffectDC():Get_Int(2) )
            MTG():FireTrigger( TRIGGER_OBJECT_TAKES_DAMAGE, target )
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- 6. Damage to Planeswalker creatures (this works only for Gideon when he becomes a creature) -->
   <TRIGGERED_ABILITY replacement_effect="1">
      <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
      <TRIGGER value="OBJECT_TAKES_DAMAGE">
         return PLW_IsInNameSet( TriggerObject(), "PLANESWALKERS" )
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         if TriggerObject() ~= nil and TriggerObject():GetCardType():Test(CARD_TYPE_PLANESWALKER) then
            local amount = Damage() and Damage():GetAmount()
            if amount ~= nil then
               TriggerObject():RemoveCounters( MTG():GetCountersType("Loyalty"), amount )
            end
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!-- 8. Planeswalker type hack -->
   <TRIGGERED_ABILITY replacement_effect="1">
      <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD">
         if TriggerObject():GetCardType():Test(CARD_TYPE_PLANESWALKER) then
            EffectDC():Protect_CardPtr(COMPARTMENT_ID_PARAM_TRIGGER_OBJECT)
            return true
         end
         return false
      </TRIGGER>
      <CONTINUOUS_ACTION layer="1">
         if TriggerObject() ~= nil then
            local characteristics = TriggerObject():GetCurrentCharacteristics()
            local card_type = characteristics:CardType_GetWritable()
            local supertype = characteristics:SuperType_GetWritable()
            card_type:Clear()
            -- I chose "Basic Snow Enchantment", it seems the only safe choice.
            -- I avoided Legendary since we are already managing the Planeswalkers' "Legendary rule" manually.
            card_type:Add(CARD_TYPE_ENCHANTMENT)
            supertype:Add(SUPERTYPE_BASIC)
            supertype:Add(SUPERTYPE_SNOW)
         end
      </CONTINUOUS_ACTION>
      <DURATION>
         return TriggerObject() == nil
      </DURATION>
   </TRIGGERED_ABILITY>
   <AI_BASE_SCORE score="-5000" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
D14_PLW.lol (WAD v589):
Code: Select all
-- Constants and functions for TFM&G2K's Planeswalkers
-- Namesets updated to: Magic 2015

PLW_MY_CHEST = 9910
PLW_TRANSFORM_CHEST = 4320

-- *** DuelDataChest register indexes (inside PLW_MY_CHEST) *** --
PLW_PLANESWALKERS_ACTIVATIONS_CHEST = 1

-- *** PlayerDataChest register indexes (inside PLW_MY_CHEST) *** --
PLW_AJANI_STEADFAST_EMBLEM = 1
PLW_PLANESWALKERS_ACTIVATIONS = 2
PLW_CHAIN_VEIL_ACTIVATIONS = 3
PLW_TEFERI_ARCHMAGE_EMBLEM = 4
PLW_KARN_ULTIMATE = 5

-- *** RSN's ObjectDC register indexes *** --
PLW_LAST_DAMAGE_CHEST = 991

PLANESWALKER_TYPE_AJANI = PLANESWALKER_TYPES
PLANESWALKER_TYPE_CHANDRA = PLANESWALKER_TYPES + 1
PLANESWALKER_TYPE_GARRUK = PLANESWALKER_TYPES + 2
PLANESWALKER_TYPE_JACE = PLANESWALKER_TYPES + 3
PLANESWALKER_TYPE_LILIANA = PLANESWALKER_TYPES + 4
PLANESWALKER_TYPE_DOMRI = PLANESWALKER_TYPES + 5
PLANESWALKER_TYPE_ELSPETH = PLANESWALKER_TYPES + 6
PLANESWALKER_TYPE_GIDEON = PLANESWALKER_TYPES + 7
PLANESWALKER_TYPE_KARN = PLANESWALKER_TYPES + 8
PLANESWALKER_TYPE_KOTH = PLANESWALKER_TYPES + 9
PLANESWALKER_TYPE_BOLAS = PLANESWALKER_TYPES + 10
PLANESWALKER_TYPE_NISSA = PLANESWALKER_TYPES + 11
PLANESWALKER_TYPE_RAL = PLANESWALKER_TYPES + 12
PLANESWALKER_TYPE_SARKHAN = PLANESWALKER_TYPES + 13
PLANESWALKER_TYPE_SORIN = PLANESWALKER_TYPES + 14
PLANESWALKER_TYPE_TAMIYO = PLANESWALKER_TYPES + 15
PLANESWALKER_TYPE_TEZZERET = PLANESWALKER_TYPES + 16
PLANESWALKER_TYPE_TIBALT = PLANESWALKER_TYPES + 17
PLANESWALKER_TYPE_VENSER = PLANESWALKER_TYPES + 18
PLANESWALKER_TYPE_VRASKA = PLANESWALKER_TYPES + 19
PLANESWALKER_TYPE_ASHIOK = PLANESWALKER_TYPES + 20
PLANESWALKER_TYPE_XENAGOS = PLANESWALKER_TYPES + 21
PLANESWALKER_TYPE_KIORA = PLANESWALKER_TYPES + 22
PLANESWALKER_TYPE_DACK = PLANESWALKER_TYPES + 23
PLANESWALKER_TYPE_FREYALISE = PLANESWALKER_TYPES + 24
PLANESWALKER_TYPE_NIXILIS = PLANESWALKER_TYPES + 25
PLANESWALKER_TYPE_NAHIRI = PLANESWALKER_TYPES + 26
PLANESWALKER_TYPE_DARETTI = PLANESWALKER_TYPES + 27
PLANESWALKER_TYPE_TEFERI = PLANESWALKER_TYPES + 28
PLANESWALKER_TYPE_UGIN = PLANESWALKER_TYPES + 29
PLANESWALKER_TYPE_NARSET = PLANESWALKER_TYPES + 30

PLW_NameSet = function(nameset, index)
   local t = {}

   t.PLANESWALKERS = {
   "AJANI_GOLDMANE",
   "AJANI_VENGEANT",
   "AJANI_CALLER_OF_THE_PRIDE",
   "AJANI_MENTOR_OF_HEROES",
   "AJANI_STEADFAST",
   "ARLINN_KORD",
   "ARLINN_EMBRACED_BY_THE_MOON",
   "ASHIOK_NIGHTMARE_WEAVER",
   "CHANDRA_ABLAZE",
   "CHANDRA_FLAMECALLER",
   "CHANDRA_NALAAR",
   "CHANDRA_PYROMASTER",
   "CHANDRA_THE_FIREBRAND",
   "CHANDRA_ROARING_FLAME",
   "DOMRI_RADE",
   "ELSPETH_TIREL",
   "ELSPETH_KNIGHTERRANT",
   "ELSPETH_SUNS_CHAMPION",
   "GARRUK_RELENTLESS",
   "GARRUK_THE_VEILCURSED",
   "GARRUK_WILDSPEAKER",
   "GARRUK_CALLER_OF_BEASTS",
   "GARRUK_PRIMAL_HUNTER",
   "GARRUK_APEX_PREDATOR",
   "GIDEON_ALLY_OF_ZENDIKAR",
   "GIDEON_BATTLE_FORGED",
   "GIDEON_JURA",
   "GIDEON_CHAMPION_OF_JUSTICE",
   "JACE_BELEREN",
   "JACE_ARCHITECT_OF_THOUGHT",
   "JACE_MEMORY_ADEPT",
   "JACE_TELEPATH_UNBOUND",
   "JACE_THE_MIND_SCULPTOR",
   "JACE_THE_LIVING_GUILDPACT",
   "JACE_UNRAVELER_OF_SECRETS",
   "KARN_LIBERATED",
   "KIORA_MASTER_OF_THE_DEPTHS",
   "KIORA_THE_CRASHING_WAVE",
   "KOTH_OF_THE_HAMMER",
   "LILIANA_DEFIANT_NECROMANCER",
   "LILIANA_OF_THE_DARK_REALMS",
   "LILIANA_OF_THE_VEIL",
   "LILIANA_THE_LAST_HOPE",
   "LILIANA_VESS",
   "NARSET_TRANSCENDENT",
   "NICOL_BOLAS_PLANESWALKER",
   "NISSA_REVANE",
   "NISSA_SAGE_ANIMIST",
   "NISSA_VOICE_OF_ZENDIKAR",
   "NISSA_WORLDWAKER",
   "RAL_ZAREK",
   "SARKHAN_THE_MAD",
   "SARKHAN_UNBROKEN",
   "SARKHAN_VOL",
   "SARKHAN_THE_DRAGONSPEAKER",
   "SORIN_MARKOV",
   "SORIN_LORD_OF_INNISTRAD",
   "SORIN_SOLEMN_VISITOR",
   "SORIN_GRIM_NEMESIS",
   "TAMIYO_THE_MOON_SAGE",
   "TAMIYO_FIELD_RESEARCHER",
   "TEZZERET_THE_SEEKER",
   "TEZZERET_AGENT_OF_BOLAS",
   "TIBALT_THE_FIENDBLOODED",
   "UGIN_THE_SPIRIT_DRAGON",
   "VENSER_THE_SOJOURNER",
   "VRASKA_THE_UNSEEN",
   "XENAGOS_THE_REVELER",
   "DACK_FAYDEN",
   "FREYALISE_LLANOWARS_FURY",
   "OB_NIXILIS_OF_THE_BLACK_OATH",
   "OB_NIXILIS_REIGNITED",
   "NAHIRI_THE_LITHOMANCER",
   "NAHIRI_THE_HARBINGER",
   "DARETTI_SCRAP_SAVANT",
   "TEFERI_TEMPORAL_ARCHMAGE"
   }
   return t[nameset:upper()][index]
end

PLW_SubTypes = function(index)
   local t = {
   AJANI_GOLDMANE=PLANESWALKER_TYPE_AJANI,
   AJANI_VENGEANT=PLANESWALKER_TYPE_AJANI,
   AJANI_CALLER_OF_THE_PRIDE=PLANESWALKER_TYPE_AJANI,
   AJANI_MENTOR_OF_HEROES=PLANESWALKER_TYPE_AJANI,
   AJANI_STEADFAST=PLANESWALKER_TYPE_AJANI,
   ARLINN_KORD=PLANESWALKER_TYPE_ARLINN,
   ARLINN_EMBRACED_BY_THE_MOON=PLANESWALKER_TYPE_ARLINN,
   ASHIOK_NIGHTMARE_WEAVER=PLANESWALKER_TYPE_ASHIOK,
   CHANDRA_ABLAZE=PLANESWALKER_TYPE_CHANDRA,
   CHANDRA_FLAMECALLER=PLANESWALKER_TYPE_CHANDRA,
   CHANDRA_NALAAR=PLANESWALKER_TYPE_CHANDRA,
   CHANDRA_PYROMASTER=PLANESWALKER_TYPE_CHANDRA,
   CHANDRA_ROARING_FLAME=PLANESWALKER_TYPE_CHANDRA,
   CHANDRA_THE_FIREBRAND=PLANESWALKER_TYPE_CHANDRA,
   DACK_FAYDEN=PLANESWALKER_TYPE_DACK,
   DARETTI_SCRAP_SAVANT=PLANESWALKER_TYPE_DARETTI,
   DOMRI_RADE=PLANESWALKER_TYPE_DOMRI,
   ELSPETH_TIREL=PLANESWALKER_TYPE_ELSPETH,
   ELSPETH_KNIGHTERRANT=PLANESWALKER_TYPE_ELSPETH,
   ELSPETH_SUNS_CHAMPION=PLANESWALKER_TYPE_ELSPETH,
   FREYALISE_LLANOWARS_FURY=PLANESWALKER_TYPE_FREYALISE,
   GARRUK_RELENTLESS=PLANESWALKER_TYPE_GARRUK,
   GARRUK_THE_VEILCURSED=PLANESWALKER_TYPE_GARRUK,
   GARRUK_WILDSPEAKER=PLANESWALKER_TYPE_GARRUK,
   GARRUK_CALLER_OF_BEASTS=PLANESWALKER_TYPE_GARRUK,
   GARRUK_PRIMAL_HUNTER=PLANESWALKER_TYPE_GARRUK,
   GARRUK_APEX_PREDATOR=PLANESWALKER_TYPE_GARRUK,
   GIDEON_ALLY_OF_ZENDIKAR=PLANESWALKER_TYPE_GIDEON,
   GIDEON_BATTLE_FORGED=PLANESWALKER_TYPE_GIDEON,
   GIDEON_JURA=PLANESWALKER_TYPE_GIDEON,
   GIDEON_CHAMPION_OF_JUSTICE=PLANESWALKER_TYPE_GIDEON,
   JACE_BELEREN=PLANESWALKER_TYPE_JACE,
   JACE_ARCHITECT_OF_THOUGHT=PLANESWALKER_TYPE_JACE,
   JACE_MEMORY_ADEPT=PLANESWALKER_TYPE_JACE,
   JACE_TELEPATH_UNBOUND=PLANESWALKER_TYPE_JACE,
   JACE_THE_MIND_SCULPTOR=PLANESWALKER_TYPE_JACE,
   JACE_THE_LIVING_GUILDPACT=PLANESWALKER_TYPE_JACE,
   JACE_UNRAVELER_OF_SECRETS=PLANESWALKER_TYPE_JACE,
   KARN_LIBERATED=PLANESWALKER_TYPE_KARN,
   KIORA_MASTER_OF_THE_DEPTHS=PLANESWALKER_TYPE_KIORA,
   KIORA_THE_CRASHING_WAVE=PLANESWALKER_TYPE_KIORA,
   KOTH_OF_THE_HAMMER=PLANESWALKER_TYPE_KOTH,
   LILIANA_OF_THE_DARK_REALMS=PLANESWALKER_TYPE_LILIANA,
   LILIANA_DEFIANT_NECROMANCER=PLANESWALKER_TYPE_LILIANA,
   LILIANA_OF_THE_VEIL=PLANESWALKER_TYPE_LILIANA,
   LILIANA_THE_LAST_HOPE=PLANESWALKER_TYPE_LILIANA,
   LILIANA_VESS=PLANESWALKER_TYPE_LILIANA,
   NAHIRI_THE_LITHOMANCER=PLANESWALKER_TYPE_NAHIRI,
   NAHIRI_THE_HARBINGER=PLANESWALKER_TYPE_NAHIRI,
   NARSET_TRANSCENDENT=PLANESWALKER_TYPE_NARSET,
   NICOL_BOLAS_PLANESWALKER=PLANESWALKER_TYPE_BOLAS,
   NISSA_REVANE=PLANESWALKER_TYPE_NISSA,
   NISSA_SAGE_ANIMIST=PLANESWALKER_TYPE_NISSA,
   NISSA_VOICE_OF_ZENDIKAR=PLANESWALKER_TYPE_NISSA,
   NISSA_WORLDWAKER=PLANESWALKER_TYPE_NISSA,
   OB_NIXILIS_OF_THE_BLACK_OATH=PLANESWALKER_TYPE_NIXILIS,
   OB_NIXILIS_REIGNITED=PLANESWALKER_TYPE_NIXILIS,
   RAL_ZAREK=PLANESWALKER_TYPE_RAL,
   SARKHAN_THE_MAD=PLANESWALKER_TYPE_SARKHAN,
   SARKHAN_UNBROKEN=PLANESWALKER_TYPE_SARKHAN,
   SARKHAN_VOL=PLANESWALKER_TYPE_SARKHAN,
   SARKHAN_THE_DRAGONSPEAKER=PLANESWALKER_TYPE_SARKHAN,
   SORIN_MARKOV=PLANESWALKER_TYPE_SORIN,
   SORIN_LORD_OF_INNISTRAD=PLANESWALKER_TYPE_SORIN,
   SORIN_SOLEMN_VISITOR=PLANESWALKER_TYPE_SORIN,
   SORIN_GRIM_NEMESIS=PLANESWALKER_TYPE_SORIN,
   TAMIYO_THE_MOON_SAGE=PLANESWALKER_TYPE_TAMIYO,
   TAMIYO_FIELD_RESEARCHER=PLANESWALKER_TYPE_TAMIYO,
   TEFERI_TEMPORAL_ARCHMAGE=PLANESWALKER_TYPE_TEFERI,
   TEZZERET_THE_SEEKER=PLANESWALKER_TYPE_TEZZERET,
   TEZZERET_AGENT_OF_BOLAS=PLANESWALKER_TYPE_TEZZERET,
   TIBALT_THE_FIENDBLOODED=PLANESWALKER_TYPE_TIBALT,
   UGIN_THE_SPIRIT_DRAGON=PLANESWALKER_TYPE_UGIN,
   VENSER_THE_SOJOURNER=PLANESWALKER_TYPE_VENSER,
   VRASKA_THE_UNSEEN=PLANESWALKER_TYPE_VRASKA,
   XENAGOS_THE_REVELER=PLANESWALKER_TYPE_XENAGOS
   }
   return t[index]
end

PLW_IsInNameSet = function(card, nameset)
-- returns true if card's name is in the given nameset
   if card ~= nil and nameset ~= nil then
      local index = 1
      local name = PLW_NameSet(nameset, 1)
      while name ~= nil do
         if card:GetCardName() == name then
            return true
         end
         index = index + 1
         name = PLW_NameSet(nameset, index)
      end
   end
   return false
end

PLW_FilterNameSet = function(filter, nameset, condition)
-- adds the given nameset to the filter (condition=true/1 means to include the names, otherwise the names will be excluded)
   if filter ~= nil and nameset ~= nil then
      local locfilter = filter
      local operator = OP_NOT
      if condition == 1 or condition == true then
         locfilter = filter:AddSubFilter_Or()
         operator = OP_IS
      end
      local index = 1
      local name = PLW_NameSet(nameset, 1)
      while name ~= nil do
         locfilter:Add(FE_CARD_NAME, operator, name)
         index = index + 1
         name = PLW_NameSet(nameset, index)
      end
   end
end

PLW_GetSubType = function(card)
-- returns the Planeswalker sub-type according to the card name
   if card ~= nil then
      local subtype = PLW_SubTypes( card:GetCardName() )
      if subtype ~= nil then
         return subtype
      end
   end
   return -1
end

PLW_CreateUniqueToken = function(filename, cardname, player)
-- Creates a token from filename only if there are no tokens called cardname on the battlefield belonging to player
-- It doesn't make any check about token duplication, so it's better to use this for invisible tokens that need to be created on first turn
   local filter = ClearFilter()
   filter:Add(FE_CARD_NAME, OP_IS, cardname)
   filter:Add(FE_CONTROLLER, OP_IS, player)
   if filter:CountStopAt(1) == 0 then
      MTG():PutTokensOntoBattlefield(filename, 1, player)
   end
end

PLW_CreateUniqueTokenForEachPlayer = function(filename, cardname)
-- Calls the above function for each player
   for i=0,MTG():GetNumberOfPlayers()-1 do
      PLW_CreateUniqueToken( filename, cardname, MTG():GetNthPlayer(i) )
   end
end

PLW_Protection_Filter = function()
-- The planeswalker protection filter
   if EffectSource() ~= nil then
      local filter = ClearFilter()
      filter:Add(FE_CARD_NAME, OP_IS, "ENCHANTED_EVENING") -- With Enchanted Evening on the battlefield, Planeswalkers would be enchantments for real
      if filter:CountStopAt(1) == 0 or EffectSource():GetZone() ~= ZONE_BATTLEFIELD then
         filter = ClearFilter()
         filter:SetZone( ZONE_ANYWHERE )
         local subfilter = filter:AddSubFilter_Or()
         subfilter:Add( FE_CARD_NAME, OP_IS, "ABOLISH" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ABSOLVER_THRULL" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ACIDIC_SLIME" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ALLAY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ALTARS_LIGHT" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ANNUL" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ARENSONS_AURA" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ARGIVIAN_FIND" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ARTISANS_SORROW" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AURA_BLAST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AURA_EXTRACTION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AURA_FRACTURE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AURA_MUTATION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AURA_OF_SILENCE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AURA_SHARDS" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AURAMANCER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "AVEN_CLOUDCHASER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "BALDUVIAN_SHAMAN" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "BLIGHTCASTER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "BLOOD_OATH" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "BREAK_ASUNDER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "CAPASHEN_UNICORN" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "CLEAR" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "CLOUDCHASER_EAGLE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "CONSIGN_TO_DUST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "CREEPING_MOLD" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "CURSEBREAK" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DARU_SANCTIFIER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DAWN_TO_DUSK" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DAWNING_PURIST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DEGLAMER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DEICIDE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DEMYSTIFY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DESECRATION_PLAGUE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DESTRUCTIVE_REVELRY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DEVOUT_CHAPLAIN" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DEVOUT_WITNESS" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DISEMPOWER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DISENCHANT" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DISMANTLING_BLOW" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DISPELLERS_CAPSULE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DOWSING_SHAMAN" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DRUID_LYRIST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "DUERGAR_HEDGEMAGE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ECHOING_CALM" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ELF_REPLICA" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ELVISH_HEXHUNTER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ELVISH_LYRIST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ERASE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ESPER_CHARM" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "FADE_INTO_ANTIQUITY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "FILIGREE_FRACTURE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "FRANTIC_PURIFICATION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "GLEEFUL_SABOTAGE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "GOLGARI_CHARM" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "GRIFFIN_DREAMFINDER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "HANNA_SHIPS_NAVIGATOR" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "HARMONIC_SLIVER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "HIDE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "HOODWINK" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "HULL_BREACH" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ILLUMINATION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "INDRIK_STOMPHOWLER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "KAMI_OF_ANCIENT_LAW" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "KEENING_APPARITION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "KIORAS_DISMISSAL" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "KITHKIN_SPELLDUSTER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "KOR_SANCTIFIERS" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "KROSAN_GRIP" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "LEAVE_NO_TRACE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "LEONIN_RELICWARDER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "MINE_EXCAVATION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "MOLDER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "MONK_IDEALIST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "MONK_REALIST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "MORTAL_OBSTINACY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "MYSTIC_MELTING" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "NANTUKO_CALMER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "NANTUKO_VIGILANTE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "NATURAL_END" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "NATURALIZE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "NATURES_CLAIM" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "NIKKOONNA" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "NULLMAGE_SHEPHERD" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "ORIMS_THUNDER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "PEACE_AND_QUIET" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "POLIS_CRUSHER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "PRIEST_OF_IROAS" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "QASALI_PRIDEMAGE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "QUAGMIRE_DRUID" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "QUIET_PURITY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RAIN_OF_THORNS" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RAY_OF_DISSOLUTION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RAY_OF_DISTORTION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RAY_OF_REVELATION" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RECLAMATION_SAGE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RELIC_CRUSH" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RELIQUARY_MONK" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RENDING_VINES" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RETURN_TO_DUST" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "REVIVING_MELODY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "REVOKE_EXISTENCE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RONOM_UNICORN" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "RUST_SCARAB" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SCOUR" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SEAL_OF_CLEANSING" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SEAL_OF_PRIMORDIUM" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SEED_SPARK" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SERENE_OFFERING" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SERRAS_LITURGY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SHINEWEND" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SILENT_SENTINEL" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SILVERCHASE_FOX" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SKULL_OF_ORM" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SLICE_IN_TWAIN" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SOLEMN_OFFERING" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SOLTARI_VISIONARY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SPRING_CLEANING" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "STERN_PROCTOR" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "STOMP_AND_HOWL" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SUNDERING_GROWTH" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SUNDERING_VITAE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SWAN_SONG" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "SYLVOK_REPLICA" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TATTOO_WARD" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TEAR" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TEFERIS_CARE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TERASHIS_GRASP" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "THUNDERSCAPE_BATTLEMAGE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TOLARIAN_EMISSARY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TRAGIC_POET" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TREASURY_THRULL" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TRITON_CAVALRY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "TRYGON_PREDATOR" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "UNRAVEL_THE_AETHER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "URGENT_EXORCISM" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "VIRIDIAN_ZEALOT" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "WANE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "WAR_PRIEST_OF_THUNE" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "WEAR_AWAY" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "WICKERBOUGH_ELDER" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "WILD_SWING" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "WIPE_CLEAN" )
         subfilter:Add( FE_CARD_NAME, OP_IS, "WISPMARE" )
         if EffectSource():GetCardType():Test(CARD_TYPE_CREATURE) == false then
            subfilter:Add( FE_CARD_NAME, OP_IS, "ANGELIC_EDICT" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "BANISHING_STROKE" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "BANISHMENT_DECREE" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "CRIME" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "ETHERSWORN_ADJUDICATOR" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "FEAST_OF_DREAMS" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "IONAS_JUDGMENT" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "MORTIFY" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "PHARIKAS_MENDER" )
            subfilter:Add( FE_CARD_NAME, OP_IS, "TREVAS_CHARM" )
         end
      end
   end
   return filter
end

PLW_SetLastDamageInfo = function(victim, damager, amount)
-- Saves the last damager (and the last damage amount, if provided) of the victim using RSN's ObjectDC
   if RSN_GetObjectDC ~= nil then
      local obj_chest = RSN_GetObjectDC(victim, true)
      local damage_chest = obj_chest:Get_Chest(PLW_LAST_DAMAGE_CHEST)
      if damage_chest == nil then
         damage_chest = obj_chest:Make_Chest(PLW_LAST_DAMAGE_CHEST)
      end
      damage_chest:Set_CardPtr(0, damager)
      if amount ~= nil then
         damage_chest:Set_Int(1, amount)
      end
   end
end

PLW_GetLastDamager = function(victim)
-- Gets the last damager of the victim using RSN's ObjectDC
   if RSN_GetObjectDC ~= nil then
      local obj_chest = RSN_GetObjectDC(victim, false)
      if obj_chest ~= nil then
         local damage_chest = obj_chest:Get_Chest(PLW_LAST_DAMAGE_CHEST)
         if damage_chest ~= nil then
            return damage_chest:Get_CardPtr(0)
         end
      end
   end
   return nil
end

PLW_GetLastDamageAmount = function(victim)
-- Gets the last damage amount on the victim using RSN's ObjectDC
   if RSN_GetObjectDC ~= nil then
      local obj_chest = RSN_GetObjectDC(victim, false)
      if obj_chest ~= nil then
         local damage_chest = obj_chest:Get_Chest(PLW_LAST_DAMAGE_CHEST)
         if damage_chest ~= nil then
            return damage_chest:Get_Int(1)
         end
      end
   end
   return 0
end

PLW_FilterPermanents = function(filter)
-- filters the 5 permanent types so that cards with no types cannot be chosen
-- (I'm excluding tribal since there are no cards that have that type alone)
   local subFilter = filter:AddSubFilter_Or()
   for type=CARD_TYPE_ARTIFACT,CARD_TYPE_PLANESWALKER do
      if type ~= CARD_TYPE_INSTANT then
         subFilter:Add(FE_TYPE, OP_IS, type)
      end
   end
end

PLW_FilterPermanentsExcept = function(filter, exception)
-- same as function above, but excluding a type
   filter:Add(FE_TYPE, OP_NOT, exception)
   local subFilter = filter:AddSubFilter_Or()
   for type=CARD_TYPE_ARTIFACT,CARD_TYPE_PLANESWALKER do
      if type ~= CARD_TYPE_INSTANT and type ~= exception then
         subFilter:Add(FE_TYPE, OP_IS, type)
      end
   end
end

PLW_FilterNonlandPermanents = function(filter)
-- wrapper for the very common nonland permanents filter
   PLW_FilterPermanentsExcept(filter, CARD_TYPE_LAND)
end

PLW_DisplayManaPool = function(player)
-- displays the mana pool when using RiiakShiNal's mana tokens (credits: sumomole, gorem2k)
   if player:IsAI() == false then
      local count = {}
      local message = ""
      local color_letter = {"X", "W", "U", "B", "R", "G"}
      local mana_cardname = {"TOKEN_MANA_C", "TOKEN_MANA_W", "TOKEN_MANA_U", "TOKEN_MANA_B", "TOKEN_MANA_R", "TOKEN_MANA_G"}
      for i=0,5 do
         local filter = ClearFilter()
         filter:Add( FE_CARD_NAME, OP_IS, mana_cardname[i+1] )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
         filter:Add(FE_IS_TAPPED, false)
         count[i] = filter:Count()
         message = message.."{"..color_letter[i+1].."}"..count[i].."   "
      end
      player:DisplayMessage(" mana pool: \]\n\n\["..message)
   end
end

PLW_UntilMyNextTurn = function(currentTurn)
-- to be used in durations that last "until your next turn"
   if currentTurn ~= nil then
      local controller = EffectController()
      if controller ~= nil then
         return controller:MyTurn() and MTG():GetTurnNumber() > currentTurn
      else
         -- NOTE: This still fails if the effect is issued during another player's turn or if players skip turns or take extra turns.
         -- The solutions are too complicated to be worth using them so I decided to live with the approximation.
         return MTG():GetTurnNumber() >= currentTurn + MTG():GetNumberOfPlayers()
      end
   end
   return true
end

PLW_ShutDownDoublingSeason = function()
-- to be used in costs that add counters, so that Doubling Season doesn't double them
   local filter = ClearFilter()
   filter:Add(FE_CARD_NAME, OP_IS, "DOUBLING_SEASON")
   filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
   local filter_count = filter:EvaluateObjects()
   if filter_count > 0 then
      for i=0,filter_count-1 do
         filter:GetNthEvaluatedObject(i):GetCurrentCharacteristics():LoseAllAbilities()
      end
   end
end

PLW_MyPlayerDC = function(player)
-- addresses a specific register of PlayerDataChest, so that I can use only one and keep being super-compatible
   local chest = nil
   if player ~= nil then
      chest = player:PlayerDataChest():Get_Chest(PLW_MY_CHEST)
      if chest == nil then
         chest = player:PlayerDataChest():Make_Chest(PLW_MY_CHEST)
      end
   end
   return chest
end

PLW_MyDuelDC = function()
-- addresses a specific register of DuelDataChest, so that I can use only one and keep being super-compatible
   local chest = MTG():DuelDataChest():Get_Chest(PLW_MY_CHEST)
   if chest == nil then
      chest = MTG():DuelDataChest():Make_Chest(PLW_MY_CHEST)
   end
   return chest
end
Hope this could help you.
Last edited by Misplay on 18 Aug 2016, 01:37, edited 1 time in total.
Misplay
 
Posts: 92
Joined: 29 Aug 2013, 08:26
Has thanked: 50 times
Been thanked: 10 times

Re: Community Wad

Postby Xander9009 » 18 Aug 2016, 01:37

Current CW Core version is 591. And yes, those two files are missing the code needed to make Tamiyo's last ability work. So, either getting the new versions from the loose file or updated the entire packed core should correct the issue.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: No registered users and 2 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 2 guests

Login Form