It is currently 19 Jul 2025, 21:36
   
Text Size

Community Wad

Moderator: CCGHQ Admins

Re: Community Wad - Updated Dec-12-15

Postby Xander9009 » 02 Feb 2016, 16:27

Sorry. That WAS a bit ambiguous. Jötun Grunt - When you choose a player (before choosing the cards in that player's graveyard) you can cancel and cause the game to get stuck.

Do you think it would be better to just select cards from graveyards without restricting whose graveyard you're looking in, and then just make sure they're both from the same graveyard before continuing (and repeating the choice if they're not)?
_______________________________
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 - Updated Dec-12-15

Postby RiiakShiNal » 03 Feb 2016, 11:29

Xander9009 wrote:Sorry. That WAS a bit ambiguous. Jötun Grunt - When you choose a player (before choosing the cards in that player's graveyard) you can cancel and cause the game to get stuck.
Is this during play time or resolution time? If it is during resolution time then you shouldn't be able to cancel.

Xander9009 wrote:Do you think it would be better to just select cards from graveyards without restricting whose graveyard you're looking in, and then just make sure they're both from the same graveyard before continuing (and repeating the choice if they're not)?
If you are forcing the player to choose two cards with a single selection query then if I remember correctly it forces you to choose both from the same graveyard even if you haven't restricted the query to a single player (because if you back out from the graveyard it clears any selection you have already made).
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Community Wad - Updated Dec-12-15

Postby Xander9009 » 03 Feb 2016, 16:13

RiiakShiNal wrote:
Xander9009 wrote:Sorry. That WAS a bit ambiguous. Jötun Grunt - When you choose a player (before choosing the cards in that player's graveyard) you can cancel and cause the game to get stuck.
Is this during play time or resolution time? If it is during resolution time then you shouldn't be able to cancel.
It's during resolution time. It's part of a utility cost which is called for payment in an RTA if the player decides to pay.

RiiakShiNal wrote:
Xander9009 wrote:Do you think it would be better to just select cards from graveyards without restricting whose graveyard you're looking in, and then just make sure they're both from the same graveyard before continuing (and repeating the choice if they're not)?
If you are forcing the player to choose two cards with a single selection query then if I remember correctly it forces you to choose both from the same graveyard even if you haven't restricted the query to a single player (because if you back out from the graveyard it clears any selection you have already made).
Just tested it and you're right. Unfortunately, the cancel button still exists on the player selection screen and pressing it does the same thing.

Upkeep begins
Card triggers (Timer starts)
(Timer ends) Prompts for payment
(Assuming you choose to pay) Player choice appears (with cancel button)
Choose a player -> Graveyard appears (with back button)
Choose two cards and confirm -> works properly
Choose "Back" button -> works properly (goes back to player decision)
Choose "Cancel" button -> Resolution timer begins -> Timer ends but current phase stays upkeep and never changes.

I tried making it a target tag, but when I do that, it simply doesn't even ask for the card choice at all. You choose the pay option and the card immediately moves on. I think it might be the fact that the cost is being called from within an RTA. But, for cumulative upkeep, I think that's right, isn't it?

Old code | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="JOTUN_GRUNT_CW_247182" />
   <CARDNAME text="JOTUN_GRUNT" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Jötun Grunt]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Grognard jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Soldado raso jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Jötun-Geiferer]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Energumeno Jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[ヨツンの兵卒]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Jötun Grunt]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Йотун-пехотинец]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Soldado Raso Jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[尤屯大兵]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[Jötun Grunt]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="247182" />
   <ARTID value="JOTUN_GRUNT" />
   <ARTIST name="Franz Vohwinkel" />
   <CASTING_COST cost="{1}{W}" />
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Giant" />
   <SUB_TYPE metaname="Soldier" />
   <EXPANSION value="CMD" />
   <RARITY metaname="U" />
   <POWER value="4" />
   <TOUGHNESS value="4" />
    <TRIGGERED_ABILITY priority="-20">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Cumulative upkeep—Put two cards from a single graveyard on the bottom of their owner’s library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Entretien cumulatif — Mettez deux cartes d’un cimetière unique au-dessous de la bibliothèque de leur propriétaire.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Mantenimiento acumulativo—Pon dos cartas de un mismo cementerio en el fondo de la biblioteca de su propietario.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kumulative Versorgung — Lege zwei Karten aus genau einem Friedhof unter die Bibliothek ihres Besitzers.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Mantenimento cumulativo—Metti due carte da un singolo cimitero in fondo al grimorio del loro proprietario.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[累加アップキープ ― 単一の墓地にある2枚のカードをオーナーのライブラリーの一番下に置く。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Cumulative upkeep—Put two cards from a single graveyard on the bottom of their owner’s library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Накопительная поддержка — Поместите две карты с одного кладбища в низ библиотеки их владельца.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Manutenção cumulativa Coloque dois cards em um único cemitério no fundo do grimório de seus donos.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[累积维持~将两张在同一坟墓场中的牌置于其拥有者的牌库底。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[Cumulative upkeep—Put two cards from a single graveyard on the bottom of their owner’s library.]]></LOCALISED_TEXT>
      <COUNTER_REGISTRATION name="Age" proliferate="00" />
      <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
         return MTG():GetStep() == STEP_UPKEEP
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         if EffectSource() ~= nil then
            EffectSource():AddCounters(MTG():GetCountersType("Age"), 1)
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local EffectController = EffectController()
         if EffectController ~= nil and EffectSource() ~= nil then
            local CountGoal = EffectSource():CountCounters(MTG():GetCountersType("Age"))*2
            for i=0,MTG():GetNumberOfPlayers()-1 do
               local filter = ClearFilter()
               filter:SetZone(ZONE_GRAVEYARD, MTG():GetNthPlayer(i))
               local Count = filter:CountStopAt(CountGoal)
               if Count%2 == 1 then
                  Count = Count - 1
               end
               CountGoal = CountGoal - Count
            end
            if CountGoal == 0 then
               EffectController:BeginNewMultipleChoice()
                  EffectController:AddMultipleChoiceAnswer("CARD_QUERY_OPTION_PAY_CUMULATIVE")
                  EffectController:AddMultipleChoiceAnswer("CARD_QUERY_INTET_DO_NOT_PAY_MANA")
               EffectController:AskMultipleChoiceQuestion("CARD_QUERY_INTET_QUESTION", EffectSource())
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local EffectController = EffectController()
         if EffectController ~= nil and EffectSource() ~= nil then
            local NumCounters = EffectSource():CountCounters(MTG():GetCountersType("Age"))
            local CountGoal = NumCounters*2
            for i=0,MTG():GetNumberOfPlayers()-1 do
               local filter = ClearFilter()
               filter:SetZone(ZONE_GRAVEYARD, MTG():GetNthPlayer(i))
               local Count = filter:CountStopAt(CountGoal)
               if Count%2 == 1 then
                  Count = Count - 1
               end
               CountGoal = CountGoal - Count
            end
            if CountGoal == 0 and EffectController:GetMultipleChoiceResult() == 0 then
               for i=0,NumCounters-1 do
                  EffectController:PayResourceCost(1)
               end
            else
               EffectController:Sacrifice(EffectSource())
            end
         end
      </RESOLUTION_TIME_ACTION>
      <AUTO_SKIP no_effect_source="1" />
   </TRIGGERED_ABILITY>
   <UTILITY_ABILITY resource_id="1">
      <COST type="generic">
         <PREREQUISITE>
            for i=0,MTG():GetNumberOfPlayers()-1 do
               local filter = ClearFilter()
               filter:SetZone(ZONE_GRAVEYARD, MTG():GetNthPlayer(i))
               if filter:CountStopAt(2) == 2 then
                  return true
               end
            end
            return false
         </PREREQUISITE>
         <PLAY_TIME_ACTION>
            local EffectController = EffectController()
            if EffectController ~= nil then
               local filter = ClearFilter()
               filter:SetZone(ZONE_GRAVEYARD)
               if filter:CountStopAt(2) == 2 then
                  EffectController:SetItemCount(2)
                  EffectController:SetItemPrompt(0, "CARD_QUERY_CHOOSE_CARD_PUT_ONTO_BOTTOM_OF_LIBRARY")
                  EffectController:SetItemPrompt(1, "CARD_QUERY_CHOOSE_CARD_PUT_ONTO_BOTTOM_OF_LIBRARY")
                  EffectController:ChooseItems(EffectDC():Make_Targets(1))
               end
            end
         </PLAY_TIME_ACTION>
         <RESOLUTION_TIME_ACTION>
            local Card1 = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
            local Card2 = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(1)
            if Card1 ~= nil and Card2 ~= nil then
               Card1:PutOnBottomOfLibrary()
               Card2:PutOnBottomOfLibrary()
            end
         </RESOLUTION_TIME_ACTION>
      </COST>
   </UTILITY_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[Xander9009]]></AUTHOR>
   <EDITORS><![CDATA[Xander9009]]></EDITORS>
   <DATE><![CDATA[31-01-16]]></DATE>
</CARD_V2>
EDIT:
I decided that if I was right about calling the cost from the RTA being the source of the problem, then moving the cost code into a repeating action in the ability itself should solve the problem and it did. Now, it works the same, but the player decision screen has no cancel button. I tested it with up to 2 age counters and it worked as expected, so hopefully that continues into additional iterations. I also tested it with one card in my opponent's graveyard and none in mine with three Jotun Giants on the battlefield. The first two were sacced without any option (which is correct), and the third gave me the option to pay or not. I think that's 100% working, then. Thanks for the tip about the choices auto-resetting when you press "back". I wasn't aware of that and it simplified the code quite a bit.

New code | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="JOTUN_GRUNT_CW_247182" />
   <CARDNAME text="JOTUN_GRUNT" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Jötun Grunt]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Grognard jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Soldado raso jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Jötun-Geiferer]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Energumeno Jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[ヨツンの兵卒]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Jötun Grunt]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Йотун-пехотинец]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Soldado Raso Jötun]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[尤屯大兵]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[Jötun Grunt]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="247182" />
   <ARTID value="JOTUN_GRUNT" />
   <ARTIST name="Franz Vohwinkel" />
   <CASTING_COST cost="{1}{W}" />
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Giant" />
   <SUB_TYPE metaname="Soldier" />
   <EXPANSION value="CMD" />
   <RARITY metaname="U" />
   <POWER value="4" />
   <TOUGHNESS value="4" />
    <TRIGGERED_ABILITY priority="-20">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Cumulative upkeep—Put two cards from a single graveyard on the bottom of their owner’s library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Entretien cumulatif — Mettez deux cartes d’un cimetière unique au-dessous de la bibliothèque de leur propriétaire.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Mantenimiento acumulativo—Pon dos cartas de un mismo cementerio en el fondo de la biblioteca de su propietario.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kumulative Versorgung — Lege zwei Karten aus genau einem Friedhof unter die Bibliothek ihres Besitzers.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Mantenimento cumulativo—Metti due carte da un singolo cimitero in fondo al grimorio del loro proprietario.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[累加アップキープ ― 単一の墓地にある2枚のカードをオーナーのライブラリーの一番下に置く。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Cumulative upkeep—Put two cards from a single graveyard on the bottom of their owner’s library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Накопительная поддержка — Поместите две карты с одного кладбища в низ библиотеки их владельца.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Manutenção cumulativa Coloque dois cards em um único cemitério no fundo do grimório de seus donos.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[累积维持~将两张在同一坟墓场中的牌置于其拥有者的牌库底。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[Cumulative upkeep—Put two cards from a single graveyard on the bottom of their owner’s library.]]></LOCALISED_TEXT>
      <COUNTER_REGISTRATION name="Age" proliferate="00" />
      <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
         return MTG():GetStep() == STEP_UPKEEP
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         if EffectSource() ~= nil then
            EffectSource():AddCounters(MTG():GetCountersType("Age"), 1)
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         if EffectController() ~= nil and EffectSource() ~= nil then
            local CountGoal = EffectSource():CountCounters(MTG():GetCountersType("Age"))*2
            for i=0,MTG():GetNumberOfPlayers()-1 do
               local filter = ClearFilter()
               filter:SetZone(ZONE_GRAVEYARD, MTG():GetNthPlayer(i))
               local Count = filter:CountStopAt(CountGoal)
               if Count%2 == 1 then
                  Count = Count - 1
               end
               CountGoal = CountGoal - Count
            end
            if CountGoal == 0 then
               EffectController():BeginNewMultipleChoice()
                  EffectController():AddMultipleChoiceAnswer("CARD_QUERY_OPTION_PAY_CUMULATIVE")
                  EffectController():AddMultipleChoiceAnswer("CARD_QUERY_INTET_DO_NOT_PAY_MANA")
               EffectController():AskMultipleChoiceQuestion("CARD_QUERY_INTET_QUESTION", EffectSource())
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         if EffectController() ~= nil and EffectSource() ~= nil then
            local NumCounters = EffectSource():CountCounters(MTG():GetCountersType("Age"))
            local CountGoal = NumCounters*2
            for i=0,MTG():GetNumberOfPlayers()-1 do
               local filter = ClearFilter()
               filter:SetZone(ZONE_GRAVEYARD, MTG():GetNthPlayer(i))
               local Count = filter:CountStopAt(CountGoal)
               if Count%2 == 1 then
                  Count = Count - 1
               end
               CountGoal = CountGoal - Count
            end
            if CountGoal == 0 and EffectController():GetMultipleChoiceResult() == 0 then
               EffectDC():Set_Int(0, NumCounters)
            else
               EffectController():Sacrifice(EffectSource())
               EffectDC():Set_Int(0, 0)
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION repeating="1">
         local RepCount = MTG():GetActionRepCount()
         local Parity = RepCount % 2
         if Parity == 0 and EffectDC():Get_Int(0) ~= 0 then
            EffectDC():Int_Dec(0)
            if EffectController() ~= nil then
               local filter = ClearFilter()
               filter:SetZone(ZONE_GRAVEYARD)
               if filter:CountStopAt(2) == 2 then
                  EffectController():SetItemCount(2)
                  EffectController():SetItemPrompt(0, "CARD_QUERY_CHOOSE_CARD_PUT_ONTO_BOTTOM_OF_LIBRARY")
                  EffectController():SetItemPrompt(1, "CARD_QUERY_CHOOSE_CARD_PUT_ONTO_BOTTOM_OF_LIBRARY")
                  EffectController():ChooseItems(EffectDC():Make_Targets(1))
               end
            end
            return true
         elseif Parity == 1 then
            local Card1 = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
            local Card2 = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(1)
            if Card1 ~= nil and Card2 ~= nil then
               Card1:PutOnBottomOfLibrary()
               Card2:PutOnBottomOfLibrary()
            end
            return EffectDC():Get_Int(0) ~= 0
         end
         return false         
      </RESOLUTION_TIME_ACTION>
      <AUTO_SKIP no_effect_source="1" />
   </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[Xander9009]]></AUTHOR>
   <EDITORS><![CDATA[Xander9009, Xander9009]]></EDITORS>
   <DATE><![CDATA[31-01-16, 03-02-16]]></DATE>
</CARD_V2>
_______________________________
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 - Updated Dec-12-15

Postby RiiakShiNal » 04 Feb 2016, 01:04

I'm glad you got it working with the plus that you were able to simplify the code. Putting the cost into the ability's RTAs is the correct way to do it because as long as a query is in either a COST block or a PLAY_TIME_ACTION block it will have the cancel option (because of the way the engine is coded). You should always avoid triggering other abilities from within an ability block as it screws up the MtG ability resolution stack (queuing up other abilities by using fire trigger or creating delayed triggers is fine).
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Community Wad - Updated Dec-12-15

Postby Xander9009 » 04 Feb 2016, 17:36

Migookman, you marked Void and Upwelling as impossible, but they should be possible, I think.

Void: The number could be chosen with numerical choices:
  • GetNumericalChoiceResult
  • AskNumericalChoiceQuestion
  • AddNumericalChoiceAnswer
  • BeginNewNumericalChoice

Upwelling should be possible, as well. The way I'm thinking of might not work but, RiiakShiNal, you'd know for sure. I know /some/ mana can be prevented from emptying. Can that apply to simply all mana? I imagine it should work as expected to use Kruphix, God of Horizons and simply add the names of all of the mana tokens rather than only preventing colorless mana, yeah?

Code: Select all
<TRIGGERED_ABILITY replacement_effect="1">
   <TRIGGER value="ZONECHANGE_CONSIDERED" simple_qualifier="objectyoucontrol" to_zone="ZONE_ANY" from_zone="ZONE_BATTLEFIELD" pre_trigger="1">
      if (TriggerObject() ~= nil) and (TriggerObject():IsTapped() == false) and
         (
         TriggerObject():GetCardName() == "TOKEN_MANA_C" or
         TriggerObject():GetCardName() == "TOKEN_MANA_W" or
         TriggerObject():GetCardName() == "TOKEN_MANA_U" or
         TriggerObject():GetCardName() == "TOKEN_MANA_B" or
         TriggerObject():GetCardName() == "TOKEN_MANA_R" or
         TriggerObject():GetCardName() == "TOKEN_MANA_G"
         ) then   --Linebreaks for readability only
         MTG():OverrideEvent()
         return true
      end
      return false
   </TRIGGER>
</TRIGGERED_ABILITY>
Of course, it would be more efficient with the card name stored in a variable rather than calling TriggerObject():GetCardName() multiple times...

I imagine this, however, would be more efficient overall, making that moot.
Code: Select all
if strfind(TriggerObject():GetCardName(), "TOKEN_MANA_") ~= nil)
I'm only really worried about efficiency because of the fact that it will trigger on EVERY zonechange from the battlefield, including MANY mana tokens at once.

Alternatively, do you think it would be better to give the mana tokens themselves a slight alteration so they check their own RSN_ObjectDC() for an int, and only make themselves leave the battlefield at the end of steps if it's 0? This way, cards that produce non-emptying mana could do so quite easily. Cards the produce non-emptying mana would set it to 1 while cards like Upwelling could increment it. I don't like the idea of changing the mana tokens, though, so that would only happen if you updated the MM mod, making it 100% up to you.
_______________________________
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 - Updated Dec-12-15

Postby RiiakShiNal » 05 Feb 2016, 11:52

Upwelling is indeed possible though your TRIGGER is wrong as Upwelling is not limited to just your mana pool (need to remove simple_qualifier="objectyoucontrol"). Using string find would probably be the most efficient method as you only do one string operation rather than multiple.

I had considered using an ObjectDC on the tokens for whether they would be allowed to leave play or not, but considering the complexity of managing those ObjectDCs, the extra overhead, added delay, and the logic necessary to avoid problems it was simply better to use the current method. There are issues with both methods, for example Shizuko, Caller of Autumn, if it loses its ability then the mana it generated should remain, but under the current system won't. Or if you consider Upwelling, under the ObjectDC system the mana would remain if Upwelling loses its abilities or leaves play even though it shouldn't.

Given the various downsides of both methods, the current method is the better choice (less overhead, less computational delay, less complexity, fewer rule problems).
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Community Wad - Updated Dec-12-15

Postby migookman » 07 Feb 2016, 01:21

Xander9009 wrote:Migookman, you marked Void and Upwelling as impossible, but they should be possible, I think.
Updated to my list as possible. Just uploaded 21 more cards to the CW. If anyone else sees possible/impossible cards in my list please let me know.
User avatar
migookman
 
Posts: 135
Joined: 05 Aug 2014, 06:37
Has thanked: 22 times
Been thanked: 28 times

Re: Community Wad - Updated Dec-12-15

Postby Xander9009 » 11 Feb 2016, 22:54

I've added a new function file. It only has two functions currently, but they might be rather useful. They're for storing global variables. They haven't been particularly thoroughly tested, so they may not work as true global variables, but they should as far as I know.

They are:
CW_Globals_Store(iosInput, isIndex)
CW_Globals_Retrieve(isIndex)

When storing a value, isIndex is optional. If it's not provided, then the value will be stored in the next available numeric index. If a number of string is provided, then that number or string can be used to retrieve the value. In either case, the index used (whether it's a provided number/string or simply the next available one) will be returned.

To retrieve the value, the same index is fed into the retrieval function.

Code: Select all
local SomeString = "Some string we need to pass to another ability"
EffectDC():Set_Int(0, CW_Globals_Store(SomeString))              --EffectDC register 0 now contains the index. Use it to retrieve the string.
local ThatString = CW_Globals_Retrieve(EffectDC():Get_Int(0))    --ThatString now contains the same information as SomeString above.
The reason I made this was to more easily pass card names to other abilities (specifically for use on Reflector Mage, which needs the card's name passed to a delayed trigger). Rather than passing the card itself and risking it possibly becoming nil and worrying about having to protect the pointer and whatnot. The ability to store integers and card pointers is really just happenstance. It was meant for strings, since they can't be stored in data chests like the others.

It should be able to handle any variable lua can handle: integers, strings, object pointers (cards and players), and arrays.

Here's the full code for the functions (which are really simple). If someone (RSN, I'm looking at you haha) sees a reason this won't work on other cards, let me know. (I've already tested Reflector Mage and it works fine there).

Code | Open
Code: Select all
CW_Globals = {}
CW_Globals_Count = 0

CW_Globals_Store = function(Input, Index)
   if Input ~= nil then
      if Index ~= nil and ((type(Index) == "number" and Index >= 0) or (type(Index) == "string" and Index ~= "")) then
         CW_Globals[Index] = Input
         return Index
      else
         CW_Globals[CW_Globals_Count] = Input
         return CW_Globals_Count
      end
   end
   return -1
end

CW_Globals_Retrieve = function(Index)
   if Index ~= nil and ((type(Index) == "number" and Index >= 0) or (type(Index) == "string" and Index ~= "")) then
      return CW_Globals[Index]
   end
   return ""
end
EDIT:
Also, in addition to the above, there are a few other new functions. Note that parameters in {} are optional. Their defaults are listed.

CW_General_GetStartingLifeTotal({Player = EffectController()})
CW_General_Error({sError = "An unknown error has occured."})
CW_Mana_CanPayColorlessCost(iAmount{, oPlayer = EffectController()})
CW_Mana_CanPayManaCost(sCost{, oPlayer = EffectController()})

For CW_General_Error, it'll display the error message you provide and the name of the card calling the function if it can.

CW_Mana_CanPayColorlessCost checks if the player can pay an amount of waste mana for cards like Endbringer. It only takes a number, not the actual cost.

CW_Mana_CanPayManaCost works much like the normal CanPayManaCost function, except that waste mana is also allowed. Note that waste mana must be (ignore spaces) { Q } or { C }. It's on gatherer as { C }, but the cards here use { Q } because { C } doesn't display anything in-game.

This is really only useful so far on auto-tap lands with abilities that cost tap and mana, such as Mirrorpool or Sea Gate Wreckage. Because the game will try to use its own mana, you need to make sure they can pay the cost plus its own mana production, which this function lets you do properly. So far, no cards technically need it because Mirrorpool Sea Gate Wreckage both produce colorless mana, so they can definitely fill the colorless mana requirement, meaning the normal CanPayManaCost function would do just as well. However, it's 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 - Updated Dec-12-15

Postby Chakan » 14 Feb 2016, 22:58

I have a bunch of cards that I've coded over the course of the past few months, Xander. I'll upload the cards to Mediafire or something and send them over to you in a PM. I'm going to leave out the artwork, there's waaaaaay too much to upload. Some of them are untested so they might not work properly, though I'm not sure which ones they would be. I also took note of some cards that were erroneous:

Dong Zhou, the Tyrant: Taps the creature it targets.
Fire Bowman: Ability can be activated on other players turn.
Nissa, Wildwood Sage: Doesn't transform properly.
Psychic Miasma: Nothing was discarded.
Cao Cao, Lord of Wei: Ability can be activated on other players turn.
Sewer Nemesis: Faulty enter the battlefield trigger.

Forgot to include Magus of the Wheel that I did earlier so I'll attach it here.
Attachments
Magus of the Wheel.zip
(1.15 MiB) Downloaded 262 times
User avatar
Chakan
 
Posts: 166
Joined: 07 Jun 2014, 23:08
Has thanked: 11 times
Been thanked: 10 times

Re: Community Wad - Updated Dec-12-15

Postby Xander9009 » 15 Feb 2016, 00:16

Chakan wrote:I have a bunch of cards that I've coded over the course of the past few months, Xander. I'll upload the cards to Mediafire or something and send them over to you in a PM. I'm going to leave out the artwork, there's waaaaaay too much to upload. Some of them are untested so they might not work properly, though I'm not sure which ones they would be. I also took note of some cards that were erroneous:

Dong Zhou, the Tyrant: Taps the creature it targets.
Fire Bowman: Ability can be activated on other players turn.
Nissa, Wildwood Sage: Doesn't transform properly.
Psychic Miasma: Nothing was discarded.
Cao Cao, Lord of Wei: Ability can be activated on other players turn.
Sewer Nemesis: Faulty enter the battlefield trigger.
All fixed. Except for Nissa. For Sewer Nemesis, I just overwrote the CW copy with the one you made.

For Nissa, I assume you meant Nissa, Vastwood Seer//Nissa, Sage Animist? It's the only transforming Nissa in the CW (or in existence, as far as I know). I'll look into her.
_______________________________
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 - Updated Dec-12-15

Postby Chakan » 15 Feb 2016, 00:56

Yeah, my bad, I get the cards messed up a lot. :D

Just to note, I have Magus of the Wheel as an upload on my previous post. I updated it earlier. In case you didn't see it. Artwork for it included in the zip.
User avatar
Chakan
 
Posts: 166
Joined: 07 Jun 2014, 23:08
Has thanked: 11 times
Been thanked: 10 times

Re: Community Wad - Updated Dec-12-15

Postby Xander9009 » 15 Feb 2016, 01:02

Chakan wrote:Yeah, my bad, I get the cards messed up a lot. :D

Just to note, I have Magus of the Wheel as an upload on my previous post. I updated it earlier. In case you didn't see it. Artwork for it included in the zip.
Added. And good thing you pointed it out. I had not, in fact, noticed.
_______________________________
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 - Updated Dec-12-15

Postby nivmizzet1 » 20 Feb 2016, 14:10

21/02/2016 12:37:47 AM: Low: System.Xml - The 'CARD_V2' start tag on line 2 position 2 does not match the end tag of 'SPELL_ABILITY'. Line 71, position 4.:
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at RSN.DotP.CardInfo.ParseXML(String strXML)
at RSN.DotP.CardInfo..ctor(String strFilename, String strXML, String strWad, GameDirectory gdData)
at RSN.DotP.WadWrapper.LoadCards(FileStream fsInput, GameDirectory gdData)
Extra Information:
Unable to load card: THOUGHTWEFT_GAMBIT_CW_146024.xml in DATA_DLC_COMMUNITY_CORE

21/02/2016 12:37:48 AM: Low: System.Xml - The 'CARD_V2' start tag on line 2 position 2 does not match the end tag of 'SPELL_ABILITY'. Line 117, position 4.:
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at RSN.DotP.CardInfo.ParseXML(String strXML)
at RSN.DotP.CardInfo..ctor(String strFilename, String strXML, String strWad, GameDirectory gdData)
at RSN.DotP.WadWrapper.LoadCards(FileStream fsInput, GameDirectory gdData)
Extra Information:
Unable to load card: THUNDERCLOUD_ELEMENTAL_CW_43606.xml in DATA_DLC_COMMUNITY_CORE



Also, after a crash (maybe due to the above and not the following) I checked my script_log and found these:

[lua] [string "Content\Functions\CW_GENERAL.LOL"]:128: 'then' expected near '&'

[lua] lua_dofile error parsing file Content\Functions\CW_GENERAL.LOL

[lua] [string "WOODLAND_CEMETERY_MM_CW_241983_TITLE (RESOLUTION_TIME_ACTION)~0x000004b2"]:5: attempt to call global 'CW_General_SwampFilter' (a nil value)
nivmizzet1
 
Posts: 617
Joined: 21 Mar 2013, 10:10
Has thanked: 100 times
Been thanked: 25 times

Re: Community Wad - Updated Dec-12-15

Postby Xander9009 » 20 Feb 2016, 18:35

nivmizzet1 wrote:21/02/2016 12:37:47 AM: Low: System.Xml - The 'CARD_V2' start tag on line 2 position 2 does not match the end tag of 'SPELL_ABILITY'. Line 71, position 4.:
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at RSN.DotP.CardInfo.ParseXML(String strXML)
at RSN.DotP.CardInfo..ctor(String strFilename, String strXML, String strWad, GameDirectory gdData)
at RSN.DotP.WadWrapper.LoadCards(FileStream fsInput, GameDirectory gdData)
Extra Information:
Unable to load card: THOUGHTWEFT_GAMBIT_CW_146024.xml in DATA_DLC_COMMUNITY_CORE

21/02/2016 12:37:48 AM: Low: System.Xml - The 'CARD_V2' start tag on line 2 position 2 does not match the end tag of 'SPELL_ABILITY'. Line 117, position 4.:
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at RSN.DotP.CardInfo.ParseXML(String strXML)
at RSN.DotP.CardInfo..ctor(String strFilename, String strXML, String strWad, GameDirectory gdData)
at RSN.DotP.WadWrapper.LoadCards(FileStream fsInput, GameDirectory gdData)
Extra Information:
Unable to load card: THUNDERCLOUD_ELEMENTAL_CW_43606.xml in DATA_DLC_COMMUNITY_CORE



Also, after a crash (maybe due to the above and not the following) I checked my script_log and found these:

[lua] [string "Content\Functions\CW_GENERAL.LOL"]:128: 'then' expected near '&'

[lua] lua_dofile error parsing file Content\Functions\CW_GENERAL.LOL

[lua] [string "WOODLAND_CEMETERY_MM_CW_241983_TITLE (RESOLUTION_TIME_ACTION)~0x000004b2"]:5: attempt to call global 'CW_General_SwampFilter' (a nil value)
I fixed the first two. They're errors I'd already caught and fixed in many other cards. I may have overlooked those two. It's also possible Google Drive magic reverted my corrections, but considering it only affected two out of about 15 with that issue, it's probably on me. Oops lol.

However, the "'then' expected near '&'" error is very confusing. I checked the file on line 128 and there wasn't a problem. I checked the entire file for an ampersand and found none. I checked every 'if', and each had a 'then'. The script_log file, I suspect, is simply the last time the log was generated. So, the error existed before (I remember it) but was since fixed. However, since no new errors have been generated by the game, the file was never destroyed. That's my guess, and it's what I'm going with. Delete the file and check it again if you crash. If the same error appears, then something's definitely wrong with either the file or your copy of it. Until then, I can't do anything about it except hope for the best. Sorry.

It's possible a corrupt XML like the two other errors could have crashed the game, but only if the cards were in decks. And even then it's unlikely.
_______________________________
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 - Updated Dec-12-15

Postby nivmizzet1 » 20 Feb 2016, 19:36

Xander9009 wrote:However, the "'then' expected near '&'" error is very confusing. I checked the file on line 128 and there wasn't a problem. I checked the entire file for an ampersand and found none. I checked every 'if', and each had a 'then'. The script_log file, I suspect, is simply the last time the log was generated. So, the error existed before (I remember it) but was since fixed. However, since no new errors have been generated by the game, the file was never destroyed. That's my guess, and it's what I'm going with. Delete the file and check it again if you crash. If the same error appears, then something's definitely wrong with either the file or your copy of it. Until then, I can't do anything about it except hope for the best. Sorry.
I think you're right. Cheers.
nivmizzet1
 
Posts: 617
Joined: 21 Mar 2013, 10:10
Has thanked: 100 times
Been thanked: 25 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: No registered users and 3 guests

Main Menu

User Menu

Our Partners


Who is online

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

Users browsing this forum: No registered users and 3 guests

Login Form