It is currently 16 Apr 2024, 14:04
   
Text Size

General DotP 2014 Coding Questions

Moderator: CCGHQ Admins

Re: General DotP 2014 Coding Questions

Postby RiiakShiNal » 07 Sep 2015, 16:48

Xander9009 wrote:Any idea why ManifestTarget:PutOntoBattlefield(EffectController()) would successfully put the card onto the battlefield, but not under EffectController()'s control? Any way you can think of to fix that? (I've been staring at and tweaking/rewriting the code for Ghastly Conscription for quite awhile now. It's working as it should except everything enters under my opponent's control.)
I can't think of any reason why it shouldn't work, but you might be able to force the controller with
Code: Select all
ManifestTarget:SetBaseController(EffectController())
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 24 Sep 2015, 15:16

Just for the record, that didn't work. Unfortunately, I gave up on it for the time (which is why I forgot to respond, but I did try it).

Anyway, I'm actually posting another question. Is there a simple way to check if a spell can currently be cast normally? The new awaken ability is giving me some trouble. I couldn't find an alternate cost that required an extra target, so my only thought was to handle the separate target abilities just like Overload. Sadly, I just noticed that overload has a bug that Neo apparently hadn't caught, the overload ability can be activated on sorceries to play them as instants. The same, then, is true for awaken, but it is otherwise working. I know I can check if it's sorcery time or if the card has flash, but I'm not sure if that's enough.

This is the last keyword ability to get working for the generator, and then it can handle all of the do-able keywords: rally (but of course not all of the abilities in full), devoid, ingest, awaken. (Landfall, of course, is already done, and converge doesn't require anything particularly special.)

EDIT: It's not enough, I suspect. GrantPseudoFlash such as on Alchemist's Refuge. Any way to detect that?

EDIT 2: Looking at the list of cards that use GrantPseudoFlash, there are four than can affect sorceries (most affect either themselves or creatures).
Alchemist's Refuge
Hypersonic Dragon
Quicken
Vedalken Orrery
I think the best thing to do here IF pseudo flash isn't exposed would be to make a fake characteristic and grant it to all affected cards. Then those cards and any other cards can check for this fake characeristic. This would work equally well for all four of the cards above, and I could easily extend it to the other 13 spells that use the function. 18 total: 4 listed above plus another Alchemist's Refuge, and 13 others. That's not too many to add a new function to easily. I just want to check if that's what I should do.
Last edited by Xander9009 on 10 Sep 2016, 15:42, 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: General DotP 2014 Coding Questions

Postby RiiakShiNal » 25 Sep 2015, 10:48

There is no way to detect if a spell can be cast normally. The closest you could probably get is using CanCastSpellUsingResourceCost(), but even that requires you know the cost ahead of time and may not work in some circumstances.

There is no way to detect PsuedoFlash, so you would need to grant a custom characteristic to be able to detect it.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 25 Sep 2015, 12:33

Thanks. I thought that function was for determining if a cost was payable and didn't realize it checked timing. I just tested it, and adding that as a prerequisite for activating the ability did make it so the stack had to be properly empty.

Awaken and overload are being handled by an activated ability, not an alternate cast ability, so the cost will never change. It should, according to the rules, but when it's handled in a utility ability, the spell goes straight to the stack without giving the card a chance to determine targeting requirements. So, I don't think we can ever get it quite right, but at least this way it can be cast when it should be able to, even if not for the right cost in every situation.

I know how we could possibly make that work, but it'll require that all cost reducing cards be altered (or at least those than can affect overload and awaken, so only cards that reduce based on instants/sorceries or colors should require changes). I'm not too worried about that at the moment.

Another question, though. I'm coding Mistform Warchief. I've used the filtering function of your deck builder to try and find a card that compares creature types in a function rather than a filter, but I didn't find any. Are there any you can think of that might? Intersects doesn't have a related function, so I need to do it manually. I've come up with this, but it tests up to 1000 creature types (SIZE_OF_TYPE_BAND is 1000, I believe, and that is what's used to calculate the vanilla constants being used) to make sure it catches every possible creature type. I didn't see a constant or variable that tracks the actual number of creature types and I don't want to use just the original number since as more creature types are added, we define those new ones and they wouldn't be included in the function, then. I feel like I must be overlooking something, though...

Code: Select all
      <TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="controller" pre_trigger="1">
         if TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE) then
            local TriggerObject = TriggerObject():GetSubType()
            local EffectSource = EffectSource():GetSubType()
            for i=CREATURE_TYPES,ENCHANTMENT_TYPES-1 do
               if EffectSource:Test(i) and TriggerObject:Test(i) then
                  return true
               end
            end
         end
         return false
      </TRIGGER>
_______________________________
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: General DotP 2014 Coding Questions

Postby RiiakShiNal » 26 Sep 2015, 13:31

Coat of Arms compares creature subtypes. It looks for creatures with subtypes that intersect with the current creature from the FILTER other than that creature.

So your trigger might look something like this:
Code: Select all
<TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="controller" pre_trigger="1">
  local oCard = TriggerObject()
  if (oCard:GetCardType():Test(CARD_TYPE_CREATURE)) then
    local oFilter = ClearFilter()
    oFilter:Add(FE_CARD_INSTANCE, OP_IS, oCard)
    oFilter:Add(FE_SUBTYPE, OP_INTERSECTS, EffectSource())
    oFilter:SetZone(ZONE_ANY, EffectController())
    if (oFilter:Count() &gt; 0) then
      return true
    end
  end
  return false
</TRIGGER>
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 26 Sep 2015, 16:26

Fair enough. Just because it needs to be done to a specific card doesn't mean I can't use a filter. Much more efficient solution. Thanks.
_______________________________
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: General DotP 2014 Coding Questions

Postby Xander9009 » 15 Oct 2015, 20:39

EDIT2: Ignore this problem

Alright, another problem. Frontier Siege doesn't seem to want to work. When the combat phase is automatically skipped, it triggers twice during the second main phase. I tried putting in a LinkedDC() int check to make it only occur once. I originally had it check that the current turn number was less than the stored int, and if it will return true, then it sets the int to the current turn number. This worked, sort of. It had a problem I don't recall now, but it ALSO would have prevented the proper triggering of the ability during extra main phases.

I opted to try a slightly different approach. I made it check that the int is 0 and it sets it to 1 if it'll return true. Then, in a different triggered ability, it sets it to 0 at the beginning of each phase. However, now it never triggers. Putting in a debug line, I discovered that the current step is 4, which corresponds to STEP_BEGIN_COMBAT, the first step in the skipped phase, and it doesn't even try to trigger again, showing this is the only triggering of it. I don't understand what's going on.

Here's the current code.
Frontier Siege - Not Working | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="FRONTIER_SIEGE_MM_CW_391840" />
   <CARDNAME text="FRONTIER_SIEGE" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Frontier Siege]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Siège de la frontière]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Asedio a la frontera]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Belagerung des Grenzlandes]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Assedio della Frontiera]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[開拓地の包囲]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[변경 야영지 공성]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Осада Пограничья]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Cerco à Fronteira]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[围攻锋疆]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[圍攻鋒疆]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="391840" />
   <ARTID value="CW391840" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{3}{G}" />
   <TYPE metaname="Enchantment" />
   <EXPANSION value="FRF" />
   <RARITY metaname="R" />
   <TRIGGERED_ABILITY linked_ability_group="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Frontier Siege enters the battlefield, choose Khans or Dragons.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au moment où le Siège de la frontière arrive sur le champ de bataille, choisissez Khans ou Dragons.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[En cuanto el Asedio a la frontera entre al campo de batalla, elige kans o dragones.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sowie Belagerung des Grenzlandes ins Spiel kommt, wähle Khane oder Drachen.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Mentre l’Assedio della Frontiera entra nel campo di battaglia, scegli Khan o Draghi.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[開拓地の包囲が戦場に出るに際し、カンか龍かを選ぶ。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[변경 야영지 공성이 전장에 들어오면서, 칸 또는 용을 선택한다.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[При выходе Осады Пограничья на поле битвы выберите Ханов или Драконов.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Conforme Cerco à Fronteira entra no campo de batalha, escolha Khans ou Dragões.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[于围攻锋疆进战场时,选择可汗或龙王。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[於圍攻鋒疆進戰場時,選擇可汗或龍王。]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
      <RESOLUTION_TIME_ACTION>
         local EffectController = EffectController()
         if EffectController ~= nil then
            EffectController:BeginNewMultipleChoice()
               EffectController:AddMultipleChoiceAnswer("CARD_QUERY_FRONTIER_SIEGE_OPTION_KHANS")
               EffectController:AddMultipleChoiceAnswer("CARD_QUERY_FRONTIER_SIEGE_OPTION_DRAGONS")
            EffectController:AskMultipleChoiceQuestion("CARD_QUERY_FRONTIER_SIEGE_CHOOSE_KHANS_OR_DRAGONS", EffectSource())
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local Choice = EffectController():GetMultipleChoiceResult()
         LinkedDC():Set_Int(0, Choice+1)
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY linked_ability_group="1">
      <CONTINUOUS_ACTION layer="6">
         local Choice = LinkedDC():Get_Int(0)
         if Choice == 1 then
            EffectSource():GetCurrentCharacteristics():GrantAbility(1)
            EffectSource():GetCurrentCharacteristics():GrantAbility(2)
         elseif Choice == 2 then
            EffectSource():GetCurrentCharacteristics():GrantAbility(3)
            EffectSource():GetCurrentCharacteristics():GrantAbility(4)
            EffectSource():GetCurrentCharacteristics():GrantAbility(5)
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[• Khans — At the beginning of each of your main phases, add {G}{G} to your mana pool.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[• Khans — Au début de chacune de vos phases principales, ajoutez {G}{G} à votre réserve.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[• Kans — Al comienzo de cada una de tus fases principales, agrega {G}{G} a tu reserva de maná.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[• Khane — Erhöhe zu Beginn jeder deiner Hauptphasen deinen Manavorrat um {G}{G}.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[• Khan — All’inizio di ogni tua fase principale, aggiungi {G}{G} alla tua riserva di mana.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[• カン ― あなたの各メイン・フェイズの開始時に、あなたのマナ・プールに{G}{G}を加える。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[• 칸 — 당신의 각 본단계 시작에, {G}{G}를 당신의 마나풀에 담는다.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[• Ханы — В начале каждой вашей главной фазы добавьте {G}{G} в ваше хранилище маны.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[• Khans — No início de cada uma das suas fases principais, adicione {G}{G} à sua reserva de mana.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[● 可汗~在你的每个行动阶段开始时,加{G}{G}到你的法术力池中。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[• 可汗~在你的每個行動階段開始時,加{G}{G}到你的魔法力池中。]]></LOCALISED_TEXT>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[• Dragons — Whenever a creature with flying enters the battlefield under your control, you may have it fight target creature you don’t control.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[• Dragons — À chaque fois qu’une créature avec le vol arrive sur le champ de bataille sous votre contrôle, vous pouvez faire qu’elle se batte contre une créature ciblée que vous ne contrôlez pas.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[• Dragones — Siempre que una criatura con la habilidad de volar entre al campo de batalla bajo tu control, puedes hacer que luche contra la criatura objetivo que no controlas.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[• Drachen — Immer wenn eine Kreatur mit Flugfähigkeit unter deiner Kontrolle ins Spiel kommt, kannst du sie gegen eine Kreatur deiner Wahl, die du nicht kontrollierst, kämpfen lassen.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[• Draghi — Ogniqualvolta una creatura con volare entra nel campo di battaglia sotto il tuo controllo, puoi farla lottare con una creatura bersaglio che non controlli.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[• 龍 ― 飛行を持つクリーチャーが1体あなたのコントロール下で戦場に出るたび、あなたがコントロールしていないクリーチャー1体を対象とする。あなたは「その戦場に出たクリーチャーはそれと格闘を行う。」を選んでもよい。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[• 용 — 비행이 있는 생물이 당신의 조종하에 전장에 들어올 때마다, 당신이 조종하지 않는 생물을 목표로 정한다. 당신은 두 생물이 서로 싸우도록 할 수 있다.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[• Драконы — Каждый раз, когда существо с Полетом выходит на поле битвы под вашим контролем, вы можете заставить его драться с целевым существом не под вашим контролем.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[• Dragons — Toda vez que uma criatura com voar entrar no campo de batalha sob seu controle, você pode fazê-la combater uma criatura alvo que você não controla.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[● 龙王~每当一个具飞行异能的生物在你的操控下进战场时,你可以让它和目标不由你操控的生物互斗。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[• 龍王~每當一個具飛行異能的生物在你的操控下進戰場時,你可以讓它和目標不由你操控的生物互鬥。]]></LOCALISED_TEXT>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY resource_id="1" forced_skip="1" linked_ability_group="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|Khans|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|Khans|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|Kans.|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|Khane|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|Khan|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[カン]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[칸]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|Ханы|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|Khans|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[可汗]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[可汗]]></LOCALISED_TEXT>
      <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
         if (MTG():GetStep() == STEP_MAIN_1 or MTG():GetStep() == STEP_MAIN_2) and LinkedDC():Get_Int(0) == 0 then
            LinkedDC():Set_Int(0, 1)
            MTG():MessageAllPlayers("1: "..LinkedDC():Get_Int(0))
            return true
         end
         MTG():MessageAllPlayers("1 - Step: "..MTG():GetStep())
         MTG():MessageAllPlayers("1 - Int: "..LinkedDC():Get_Int(0))
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Produce("{G}", 2)
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
         S_DisplayManaPool(EffectController())
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY resource_id="2" replacement_effect="1" linked_ability_group="1">
      <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller" pre_trigger="1">
         LinkedDC():Set_Int(0, 0)
         MTG():MessageAllPlayers("2 - Step: "..MTG():GetStep())
         MTG():MessageAllPlayers("2 - Int: "..LinkedDC():Get_Int(0))
         return false
      </TRIGGER>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY resource_id="3">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|Dragons|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|Dragons|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|Dragones.|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|Drachen|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|Draghi|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[龍]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[용]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|Драконы|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|Dragões|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[龙王]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[龍王]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY">
         return TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE) and TriggerObject():GetCurrentCharacteristics():Bool_Get(CHARACTERISTIC_FLYING)
      </TRIGGER>
      <MAY />
      <TARGET tag="CARD_QUERY_FRONTIER_SIEGE_CHOOSE_A_CREATURE_YOU_DONT_CONTROL" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
         filter:Add(FE_CONTROLLER, OP_NOT, EffectController())
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local TargetA = TriggerObject()
         local TargetB = EffectDC():Get_Targets(0):Get_CardPtr(0)
         if TargetA ~= nil and TargetB ~= nil then
            local DamageFromA = TargetA:GetCurrentCharacteristics():Power_Get()
            local DamageFromB = TargetB:GetCurrentCharacteristics():Power_Get()
            TargetA:DealDamageTo(DamageFromA, TargetB)
            TargetB:DealDamageTo(DamageFromB, TargetA)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY resource_id="4">
      <CONTINUOUS_ACTION layer="0">
         RSN_ClearCanProduceMana()
         RSN_MarkCanProduceMana("{G}")
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY resource_id="5" forced_skip="1" replacement_effect="1">
      <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
      <RESOLUTION_TIME_ACTION>
         RSN_ClearProducedMana()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
   <AUTHOR><![CDATA[Tejahn]]></AUTHOR>
   <EDITORS><![CDATA[Tejahn]]></EDITORS>
   <DATE><![CDATA[24-03-15]]></DATE>
</CARD_V2>
No creatures on the battlefield so the combat phase is skipped, not testing main phase 1. What's it's doing right now is checking whether or not to trigger at the beginning of the second main phase. It shows that int is 0 but the phase is 4 (MAIN_PHASE_2 is 9). So, it fails to trigger. But, how was it triggering before the fix? It originally had the MAIN_PHASE_2 check, it just didn't have the LinkedDC check. Even more confusingly, how was it triggering twice? Most importantly, though, how can I get around that and make the card trigger one time at the beginning of each of the player's main phases?

EDIT1: Actually, while I'm asking questions, I'll toss another one in. Someone mentioned Manifest wasn't working for them, and someone else mentioned that Dream Salvage wasn't working for them. Both work on my machine. However, I use a loose file directory. I tested it with a packed wad, and they failed. I removed all unnecessary cards from the loose file directory and packed it, and the resulting wad had non-functional cards. The exact same folder directory works if left unpacked. Is this a known issue? Tested with no other mods installed, so it's not interference (unless it's from base game stuff, which I've just realized is a possibility and will test). I'm quite confused...

EDIT2: I realized after some more testing that LinkedDC register 0 was already in use in the previous ability that handles choosing Khans or Dragons and grants the correct abilities. When I changed it to use/check register 1, it worked fine with the following code:

Frontier Siege - Working | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="FRONTIER_SIEGE_MM_CW_391840" />
   <CARDNAME text="FRONTIER_SIEGE" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Frontier Siege]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Siège de la frontière]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Asedio a la frontera]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Belagerung des Grenzlandes]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Assedio della Frontiera]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[開拓地の包囲]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[변경 야영지 공성]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Осада Пограничья]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Cerco à Fronteira]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[围攻锋疆]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[圍攻鋒疆]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="391840" />
   <ARTID value="CW391840" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{3}{G}" />
   <TYPE metaname="Enchantment" />
   <EXPANSION value="FRF" />
   <RARITY metaname="R" />
   <TRIGGERED_ABILITY linked_ability_group="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Frontier Siege enters the battlefield, choose Khans or Dragons.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au moment où le Siège de la frontière arrive sur le champ de bataille, choisissez Khans ou Dragons.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[En cuanto el Asedio a la frontera entre al campo de batalla, elige kans o dragones.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sowie Belagerung des Grenzlandes ins Spiel kommt, wähle Khane oder Drachen.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Mentre l’Assedio della Frontiera entra nel campo di battaglia, scegli Khan o Draghi.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[開拓地の包囲が戦場に出るに際し、カンか龍かを選ぶ。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[변경 야영지 공성이 전장에 들어오면서, 칸 또는 용을 선택한다.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[При выходе Осады Пограничья на поле битвы выберите Ханов или Драконов.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Conforme Cerco à Fronteira entra no campo de batalha, escolha Khans ou Dragões.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[于围攻锋疆进战场时,选择可汗或龙王。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[於圍攻鋒疆進戰場時,選擇可汗或龍王。]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
      <RESOLUTION_TIME_ACTION>
         local EffectController = EffectController()
         if EffectController ~= nil then
            EffectController:BeginNewMultipleChoice()
               EffectController:AddMultipleChoiceAnswer("CARD_QUERY_FRONTIER_SIEGE_OPTION_KHANS")
               EffectController:AddMultipleChoiceAnswer("CARD_QUERY_FRONTIER_SIEGE_OPTION_DRAGONS")
            EffectController:AskMultipleChoiceQuestion("CARD_QUERY_FRONTIER_SIEGE_CHOOSE_KHANS_OR_DRAGONS", EffectSource())
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local Choice = EffectController():GetMultipleChoiceResult()
         LinkedDC():Set_Int(0, Choice+1)
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY linked_ability_group="1">
      <CONTINUOUS_ACTION layer="6">
         local Choice = LinkedDC():Get_Int(0)
         if Choice == 1 then
            EffectSource():GetCurrentCharacteristics():GrantAbility(1)
         elseif Choice == 2 then
            EffectSource():GetCurrentCharacteristics():GrantAbility(2)
            EffectSource():GetCurrentCharacteristics():GrantAbility(3)
            EffectSource():GetCurrentCharacteristics():GrantAbility(4)
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[• Khans — At the beginning of each of your main phases, add {G}{G} to your mana pool.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[• Khans — Au début de chacune de vos phases principales, ajoutez {G}{G} à votre réserve.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[• Kans — Al comienzo de cada una de tus fases principales, agrega {G}{G} a tu reserva de maná.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[• Khane — Erhöhe zu Beginn jeder deiner Hauptphasen deinen Manavorrat um {G}{G}.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[• Khan — All’inizio di ogni tua fase principale, aggiungi {G}{G} alla tua riserva di mana.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[• カン ― あなたの各メイン・フェイズの開始時に、あなたのマナ・プールに{G}{G}を加える。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[• 칸 — 당신의 각 본단계 시작에, {G}{G}를 당신의 마나풀에 담는다.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[• Ханы — В начале каждой вашей главной фазы добавьте {G}{G} в ваше хранилище маны.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[• Khans — No início de cada uma das suas fases principais, adicione {G}{G} à sua reserva de mana.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[● 可汗~在你的每个行动阶段开始时,加{G}{G}到你的法术力池中。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[• 可汗~在你的每個行動階段開始時,加{G}{G}到你的魔法力池中。]]></LOCALISED_TEXT>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[• Dragons — Whenever a creature with flying enters the battlefield under your control, you may have it fight target creature you don’t control.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[• Dragons — À chaque fois qu’une créature avec le vol arrive sur le champ de bataille sous votre contrôle, vous pouvez faire qu’elle se batte contre une créature ciblée que vous ne contrôlez pas.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[• Dragones — Siempre que una criatura con la habilidad de volar entre al campo de batalla bajo tu control, puedes hacer que luche contra la criatura objetivo que no controlas.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[• Drachen — Immer wenn eine Kreatur mit Flugfähigkeit unter deiner Kontrolle ins Spiel kommt, kannst du sie gegen eine Kreatur deiner Wahl, die du nicht kontrollierst, kämpfen lassen.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[• Draghi — Ogniqualvolta una creatura con volare entra nel campo di battaglia sotto il tuo controllo, puoi farla lottare con una creatura bersaglio che non controlli.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[• 龍 ― 飛行を持つクリーチャーが1体あなたのコントロール下で戦場に出るたび、あなたがコントロールしていないクリーチャー1体を対象とする。あなたは「その戦場に出たクリーチャーはそれと格闘を行う。」を選んでもよい。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[• 용 — 비행이 있는 생물이 당신의 조종하에 전장에 들어올 때마다, 당신이 조종하지 않는 생물을 목표로 정한다. 당신은 두 생물이 서로 싸우도록 할 수 있다.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[• Драконы — Каждый раз, когда существо с Полетом выходит на поле битвы под вашим контролем, вы можете заставить его драться с целевым существом не под вашим контролем.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[• Dragons — Toda vez que uma criatura com voar entrar no campo de batalha sob seu controle, você pode fazê-la combater uma criatura alvo que você não controla.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[● 龙王~每当一个具飞行异能的生物在你的操控下进战场时,你可以让它和目标不由你操控的生物互斗。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[• 龍王~每當一個具飛行異能的生物在你的操控下進戰場時,你可以讓它和目標不由你操控的生物互鬥。]]></LOCALISED_TEXT>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY resource_id="1" linked_ability_group="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|Khans|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|Khans|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|Kans.|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|Khane|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|Khan|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[カン]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[칸]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|Ханы|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|Khans|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[可汗]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[可汗]]></LOCALISED_TEXT>
      <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
         if (MTG():GetStep() == STEP_MAIN_1 or MTG():GetStep() == STEP_MAIN_2) and LinkedDC():Get_Int(1) ~= 1 then
            LinkedDC():Set_Int(1, 1)
            return true
         end
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Produce("{G}", 2)
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
         S_DisplayManaPool(EffectController())
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         LinkedDC():Set_Int(1, 0)
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY resource_id="2">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|Dragons|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|Dragons|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|Dragones.|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|Drachen|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|Draghi|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[龍]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[용]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|Драконы|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|Dragões|]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[龙王]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[龍王]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY">
         return TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE) and TriggerObject():GetCurrentCharacteristics():Bool_Get(CHARACTERISTIC_FLYING)
      </TRIGGER>
      <MAY />
      <TARGET tag="CARD_QUERY_FRONTIER_SIEGE_CHOOSE_A_CREATURE_YOU_DONT_CONTROL" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
         filter:Add(FE_CONTROLLER, OP_NOT, EffectController())
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local TargetA = TriggerObject()
         local TargetB = EffectDC():Get_Targets(0):Get_CardPtr(0)
         if TargetA ~= nil and TargetB ~= nil then
            local DamageFromA = TargetA:GetCurrentCharacteristics():Power_Get()
            local DamageFromB = TargetB:GetCurrentCharacteristics():Power_Get()
            TargetA:DealDamageTo(DamageFromA, TargetB)
            TargetB:DealDamageTo(DamageFromB, TargetA)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY resource_id="3">
      <CONTINUOUS_ACTION layer="0">
         RSN_ClearCanProduceMana()
         RSN_MarkCanProduceMana("{G}")
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY resource_id="4" forced_skip="1" replacement_effect="1">
      <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
      <RESOLUTION_TIME_ACTION>
         RSN_ClearProducedMana()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
   <AUTHOR><![CDATA[Tejahn]]></AUTHOR>
   <EDITORS><![CDATA[Tejahn, Xander9009]]></EDITORS>
   <DATE><![CDATA[24-03-15, 15-10-15]]></DATE>
</CARD_V2>
It also gave me a chance to test something I've been wondering about for awhile, now. linked_ability_group="1". Is this a boolean or an integer value? Given the other attributes these tags have, I assumed it was probably boolean, but that's wasn't necessarily the case. In fact, it turns our they're not boolean. Leaving the LinkedDC():Get_Int(0) alone (which interacts badly with the modal choice ability), I changed the attribute to linked_ability_group="2" and it worked as it was supposed to, with the two not interfering with one another. It appears a card can have multiple, isolated LinkedDC()'s. Not the most useful information ever, but certainly interesting. It could have been a fluke, and so it would need tested a bit more rigorously before relying heavily on it, but it's worth knowing.

The question from EDIT1 is still unanswered as of now. I haven't figured it out yet, so any insight would be much appreciated.
_______________________________
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: General DotP 2014 Coding Questions

Postby Rockenchick » 27 Oct 2015, 15:12

In trying to code Bog Down, I'm running into the issue of not being able to get the kicker to work. The non kicked ability works (although it does throw up the target tag text for the kicker ability straight after the non kicked tag) and choosing the kicked ability lets me pay the cost properly but it just does the same thing as the unkicked ability instead.

I can tell the code for the kicker ability is screwed up, just by looking at it, I simply don't get how to rectify it.

code condensed:
| Open
Code: Select all
<UTILITY_ABILITY qualifier="Kicker">
<COST type="Sacrifice" definition="0" compartment="1" query_tag="CHOOSE_2_LANDs_TO_SACRIFICE" item_count="2" />
      <COST_DEFINITION id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND)
      </COST_DEFINITION>
     <ABILITY_TEXT tag="KICKER_QUERY_BOG_DOWN_KICKED" secondary_tag="KICKER_QUERY_BOG_DOWN_UNKICKED" />
     </UTILITY_ABILITY>
  <SPELL_ABILITY>
  <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD_2" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:SetFilterType( FILTER_TYPE_PLAYERS )
         filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local filter = ClearFilter()
         local target = EffectDC():Get_Targets(0): Get_PlayerPtr(0)
         if target ~= nil then
            filter:SetZone( ZONE_HAND, target)
            target:SetItemCount( 2 )
            for i = 0,(2-1) do
               target:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
            end
            target:ChooseItems( EffectDC():Make_Targets(1) )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
         if player ~= nil then
            for i = 0,(2-1) do
               local target_card = EffectDC():Get_Targets(1):Get_CardPtr(i)
               if target_card ~= nil  then
                  target_card:Discard()
                                    end
            end
         end
  </SPELL_ABILITY>
  <SPELL_ABILITY>
 <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD_3" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:SetFilterType( FILTER_TYPE_PLAYERS )
         filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
                        if EffectSource():WasKicked() then
         local filter = ClearFilter()
         local target = EffectDC():Get_Targets(0): Get_PlayerPtr(0)
         if target ~= nil then
            filter:SetZone( ZONE_HAND, target)
            target:SetItemCount( 3 )
            for i = 0,(2-1) do
               target:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
            end
            target:ChooseItems( EffectDC():Make_Targets(1) )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
         if player ~= nil then
            for i = 0,(2-1) do
               local target_card = EffectDC():Get_Targets(1):Get_CardPtr(i)
               if target_card ~= nil  then
                  target_card:Discard()
                                    end
            end
         end
  </SPELL_ABILITY>
I'm aware the kicker ability generally (or maybe ever) isn't needed to be added as part of a seperate spell ability than the non kicked one. However, trying to merge it, so to speak, would have resulted in a resolution action inside another resolution.

So, if this a case of using an else command and if so, how would I go about doing so, whilst avoiding the resoltution inside a resolution?
Rockenchick
 
Posts: 21
Joined: 16 Oct 2015, 05:05
Has thanked: 4 times
Been thanked: 2 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 27 Oct 2015, 15:23

Make a variable that is set to 2 (maybe "local count = 2"). Then, if it was kicked, set that variable to 3. Use that variable when referring to the number of cards being discarded.

If the kicker is properly being paid, then it's not necessarily messed up (I see nothing wrong with it).

Untested | Open
Code: Select all
   <UTILITY_ABILITY qualifier="Kicker">
      <COST type="Sacrifice" definition="0" compartment="1" query_tag="CHOOSE_2_LANDs_TO_SACRIFICE" item_count="2" />
      <COST_DEFINITION id="0">
         local filter = ClearFilter()
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_LAND)
      </COST_DEFINITION>
      <ABILITY_TEXT tag="KICKER_QUERY_BOG_DOWN_KICKED" secondary_tag="KICKER_QUERY_BOG_DOWN_UNKICKED" />
   </UTILITY_ABILITY>
   <SPELL_ABILITY>
      <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
         filter:Add(FE_TEAM, OP_NOT, EffectController():GetTeam())
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local Target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
         if Target ~= nil then
            local Count = 2
            if EffectSource():WasKicked() then
               Count = 3
            end
            local filter = ClearFilter()
            filter:SetZone(ZONE_HAND, Target)
            Target:SetItemCount(Count)
            for i=0,Count-1 do
               Target:SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD")
            end
            Target:ChooseItems(EffectDC():Make_Targets(1))
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local Player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
         if Player ~= nil then
            local Count = 2
            if EffectSource():WasKicked() then
               Count = 3
            end
            for i=0,Count-1 do
               local Card = EffectDC():Get_Targets(1):Get_CardPtr(i)
               if Card ~= nil  then
                  Card:Discard()
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
   </SPELL_ABILITY>
I removed the second spell ability, and added a variable named Count which is set to 2. If it was kicked, it's set to 3. Then, both instances of "2" were replaced with "Count". (I also cleaned up the code a bit: removed unnecessary spaces and capitalized variables. All completely unnecessary changes, but I'm slightly neurotic, so I did it anyway lol.)
_______________________________
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: General DotP 2014 Coding Questions

Postby Rockenchick » 28 Oct 2015, 06:10

Xander9009 wrote:Make a variable that is set to 2 (maybe "local count = 2"). Then, if it was kicked, set that variable to 3. Use that variable when referring to the number of cards being discarded.

If the kicker is properly being paid, then it's not necessarily messed up (I see nothing wrong with it).

Untested | Open
Code: Select all
   <UTILITY_ABILITY qualifier="Kicker">
      <COST type="Sacrifice" definition="0" compartment="1" query_tag="CHOOSE_2_LANDs_TO_SACRIFICE" item_count="2" />
      <COST_DEFINITION id="0">
         local filter = ClearFilter()
         filter:Add(FE_TYPE, OP_IS, CARD_TYPE_LAND)
      </COST_DEFINITION>
      <ABILITY_TEXT tag="KICKER_QUERY_BOG_DOWN_KICKED" secondary_tag="KICKER_QUERY_BOG_DOWN_UNKICKED" />
   </UTILITY_ABILITY>
   <SPELL_ABILITY>
      <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
         filter:Add(FE_TEAM, OP_NOT, EffectController():GetTeam())
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local Target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
         if Target ~= nil then
            local Count = 2
            if EffectSource():WasKicked() then
               Count = 3
            end
            local filter = ClearFilter()
            filter:SetZone(ZONE_HAND, Target)
            Target:SetItemCount(Count)
            for i=0,Count-1 do
               Target:SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD")
            end
            Target:ChooseItems(EffectDC():Make_Targets(1))
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local Player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
         if Player ~= nil then
            local Count = 2
            if EffectSource():WasKicked() then
               Count = 3
            end
            for i=0,Count-1 do
               local Card = EffectDC():Get_Targets(1):Get_CardPtr(i)
               if Card ~= nil  then
                  Card:Discard()
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
   </SPELL_ABILITY>
I removed the second spell ability, and added a variable named Count which is set to 2. If it was kicked, it's set to 3. Then, both instances of "2" were replaced with "Count". (I also cleaned up the code a bit: removed unnecessary spaces and capitalized variables. All completely unnecessary changes, but I'm slightly neurotic, so I did it anyway lol.)
Thanks a lot, that worked brillantly!

I've run into an issue with coding Chameleon Blur.
I've been able to get the part where for the turn creatures do no damage to any player. However, I can't find a way to add in the qualifier that the ability should only affect players rather than any damage done by creatures. So, basically it's preventing damage to creatures as well. How would one add in the qualifer that damage prevention only applies to players?

I've tried alterations of code from Bubble Matrix but just can't find a way to add in only to players bit. It seems if I added some kind of target it might work but a target wouldn't make any sense here, since it affects all players.

Code: Select all
<FILTER filter_id="1" reevaluates="1">
         local Player = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
         if Player ~= nil then
            local filter = ClearFilter()
            filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
         end
      </FILTER>
      <CONTINUOUS_ACTION layer="8" filter_id="1">
         if FilteredCard() ~= nil then
            FilteredCard():GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_DOESNT_DEAL_COMBAT_DAMAGE, 1)
         end
      </CONTINUOUS_ACTION>
      <DURATION simple_duration="UntilEOT" />/>
Rockenchick
 
Posts: 21
Joined: 16 Oct 2015, 05:05
Has thanked: 4 times
Been thanked: 2 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 28 Oct 2015, 11:49

That method probably won't work. Since there's no characteristic specifically for that type of ability, you'll need to do it another way. This page lists the characteristics (and all other constants). You can find that by going to Wiki at the top left of this forum->2014->Decompilable LOL contents. Other links from that page are useful too, especially the functions.

What you'll need to do is make a delayed trigger for damage being dealt. Creating a delayed trigger is pretty easy. In the spell ability, just make a single RTA. In that RTA, put "MTG():CreateDelayedTrigger(0, nil)". "0" in this line refers to the "resource_id="0"" which you'll find on various mana abilities and triggered abilities on cards. It's just a reference number and tells the game not to make that ability active initially. "nil" is a datachest. Whatever chest you pass in will become the resource ability's EffectDC().

To make the second bit, you need to make a triggered ability with resource_id="0" (change the number if needed). Delayed triggered abilities have a special tag called "<CLEANUP>". The triggered ability, once created, will be able to be triggered until the cleanup tag returns true (this is my understanding of it and may not be wholly correct). It has special attributes you can assign for various common circumstances such as fire_once="1" and simple_cleaup="EndOfTurn". Obviously, you'll want the latter in this case.

<CLEANUP simple_cleanup="EndOfTurn" />

Aside from that, it's a normal triggered ability. So, make it trigger whenever a creature is about to deal damage to a player, and then prevent that damage with Damage():PreventAll(). Keep in mind that to catch something about to happen, it needs to have replacement_effect="1" in teh ability tag and pre_trigger="1" in the trigger tag.

Aegis of Honor is coded and does most of what you need. It triggers for any spell dealing damage to you, whereas you need creatures dealing damage to players, and it only fires once whereas you need it to trigger as many times as necessary until end of turn. But the basic structure is there for you to look at.
_______________________________
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: General DotP 2014 Coding Questions

Postby Rockenchick » 29 Oct 2015, 02:57

Xander9009 wrote:That method probably won't work. Since there's no characteristic specifically for that type of ability, you'll need to do it another way. This page lists the characteristics (and all other constants). You can find that by going to Wiki at the top left of this forum->2014->Decompilable LOL contents. Other links from that page are useful too, especially the functions.

What you'll need to do is make a delayed trigger for damage being dealt. Creating a delayed trigger is pretty easy. In the spell ability, just make a single RTA. In that RTA, put "MTG():CreateDelayedTrigger(0, nil)". "0" in this line refers to the "resource_id="0"" which you'll find on various mana abilities and triggered abilities on cards. It's just a reference number and tells the game not to make that ability active initially. "nil" is a datachest. Whatever chest you pass in will become the resource ability's EffectDC().

To make the second bit, you need to make a triggered ability with resource_id="0" (change the number if needed). Delayed triggered abilities have a special tag called "<CLEANUP>". The triggered ability, once created, will be able to be triggered until the cleanup tag returns true (this is my understanding of it and may not be wholly correct). It has special attributes you can assign for various common circumstances such as fire_once="1" and simple_cleaup="EndOfTurn". Obviously, you'll want the latter in this case.

<CLEANUP simple_cleanup="EndOfTurn" />

Aside from that, it's a normal triggered ability. So, make it trigger whenever a creature is about to deal damage to a player, and then prevent that damage with Damage():PreventAll(). Keep in mind that to catch something about to happen, it needs to have replacement_effect="1" in teh ability tag and pre_trigger="1" in the trigger tag.

Aegis of Honor is coded and does most of what you need. It triggers for any spell dealing damage to you, whereas you need creatures dealing damage to players, and it only fires once whereas you need it to trigger as many times as necessary until end of turn. But the basic structure is there for you to look at.
I'm not much of a coder, so my understanding is rudimentary at best, but having looked at that card and similar cards, my understanding would be that for the effect to take place for all players the code: SecondaryPlayer() == EffectController() needs to be changed in some manner. However, I just can't work out what it needs to be changed to. SecondaryPlayer seems to be the player (or players) being affected. There's no LOL that seem to directly refer to all players in this case, so maybe it's the EffectController that needs to be altered? Either way, I'm still at a loss as to how to add in that all players are affected.

My best estimate at how to code it would be something like this:
Code: Select all
<RESOLUTION_TIME_ACTION>
         MTG():CreateDelayedTrigger(1, nil)
    <TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
      <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" pre_trigger="1" damage_type="all">
         return SecondaryPlayer(maybe)() == Unsure() and (TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE)
      </TRIGGER>
      <CLEANUP simple_cleanup="EndOfTurn" />
      <RESOLUTION_TIME_ACTION>
         EffectSourceLKI():Damage():PreventAll(), TriggerObject():GetPlayer())
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
Rockenchick
 
Posts: 21
Joined: 16 Oct 2015, 05:05
Has thanked: 4 times
Been thanked: 2 times

Re: General DotP 2014 Coding Questions

Postby RiiakShiNal » 29 Oct 2015, 10:37

You would just take out the check for SecondaryPlayer() since you don't care which player is being dealt damage since you want to prevent it for all players. Also there is a stray parenthesis that will cause problems just before TriggerObject().
Code: Select all
return TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE)
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: General DotP 2014 Coding Questions

Postby Rockenchick » 30 Oct 2015, 03:55

RiiakShiNal wrote:You would just take out the check for SecondaryPlayer() since you don't care which player is being dealt damage since you want to prevent it for all players. Also there is a stray parenthesis that will cause problems just before TriggerObject().
Code: Select all
return TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE)
I really don't get this, I understand what you meant and modified the card but now it seems to not like something else. The following code makes the card do nothing as far as I can see.
code:
| Open
Code: Select all
<SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Prevent all damage that creatures would deal to players this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Prévenez toutes les blessures que les créatures devraient infliger aux joueurs ce tour-ci.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Prevén todo el daño que las criaturas fueran a hacer a los jugadores este turno.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Verhindere allen Schaden, den Kreaturen in diesem Zug Spielern zufügen würden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Previeni tutto il danno che le creature infliggerebbero ai giocatori in questo turno.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[このターン、クリーチャーがプレイヤーに与えるダメージをすべて軽減し、0にする。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Prevent all damage that creatures would deal to players this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Предотвратите все повреждения, которые существа будут наносить игрокам в этом ходу.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Previna todo o dano que as criaturas causariam aos jogadores neste turno.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>
         MTG():CreateDelayedTrigger(1, nil)
     </RESOLUTION_TIME_ACTION>
    </SPELL_ABILITY>
    <TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
    <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" pre_trigger="1" damage_type="all">
         return TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE)
      </TRIGGER>
      <CLEANUP simple_cleanup="EndOfTurn" />
      <RESOLUTION_TIME_ACTION>
       EffectSourceLKI():Damage():PreventAll(), TriggerObject():GetPlayer())
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
It throws up this message upon exit:
Code: Select all
[lua] [string "CHAMELEON_BLUR_118925_TITLE (0, RESOLUTION_TIME_ACTION)~0x00000..."]:2: unexpected symbol near ','
Given that that error is the only clue I can see as to the issue I removed the space between , and nil, making it:
Code: Select all
MTG():CreateDelayedTrigger(1,nil)
That doesn't work either (and I doubted it would, it was about testing the error part in general) but it gets rid of the error and it causes the card when used, whilst in the graveyard, to have a sparkling effect and the end of the turn, like it's trying to do something. I only mention this because that simply doesn't even happen with the code I posted.

Secondly, since I used a sizeable amount of the code from a card that redirects damage, I suspect that might cause an issue. In testing with trying to remove the error I removed , nil entirely and the card functioned but redirected damage.
Rockenchick
 
Posts: 21
Joined: 16 Oct 2015, 05:05
Has thanked: 4 times
Been thanked: 2 times

Re: General DotP 2014 Coding Questions

Postby RiiakShiNal » 30 Oct 2015, 10:46

The problem is on this line:
Code: Select all
EffectSourceLKI():Damage():PreventAll(), TriggerObject():GetPlayer())
The line should be:
Code: Select all
Damage():PreventAll()
  • Damage() is a global function (not part of the card object).
  • Parenthesis are mismatched (extra close at the end of the line).
  • PreventAll() does not take any parameters and you can't separate statements using ",".
  • There is no point in having TriggerObject():GetPlayer() there since we don't need the source's controller for anything.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

PreviousNext

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 21 guests


Who is online

In total there are 21 users online :: 0 registered, 0 hidden and 21 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 21 guests

Login Form