It is currently 06 Sep 2025, 08:02
   
Text Size

Formal Request Thread

Moderator: CCGHQ Admins

Re: Formal Request Thread

Postby MC Brodie » 24 Jul 2013, 13:07

I tested my broken code last night with geths verdict and pre core fix annihilator and got the responses I expected. I'll include the override though anyway incase there is a situation we aren't thinking of.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

Re: Formal Request Thread

Postby BloodReyvyn » 24 Jul 2013, 14:41

I am trying to code Return to Dust, but hit a snag when trying to code the "If you played this spell during your main phase..." part as there is no cards that I am aware of with this option already made. Suggestions? :)
"There's an experience worse than blindness - it's the certainty that your vision is perfect and the horror that there's no world around you to see."
User avatar
BloodReyvyn
 
Posts: 421
Joined: 19 May 2013, 13:29
Has thanked: 53 times
Been thanked: 40 times

Re: Formal Request Thread

Postby Xander9009 » 24 Jul 2013, 15:01

BloodReyvyn wrote:I am trying to code Return to Dust, but hit a snag when trying to code the "If you played this spell during your main phase..." part as there is no cards that I am aware of with this option already made. Suggestions? :)
In the resolution block, put in an if and check test if the current phase is PHASE_MAIN_1 or PHASE_MAIN_2 AND if it's the EffectController's turn. Something like
Code: Select all
<TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_OR_ENCHANTMENT_TO_EXILE" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    local subfilter = filter:AddSubFilter_Or()
       subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
       subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ENCHANTMENT)
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then   
       target:Exile() 
    end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
   if EffectController():MyTurn() == true and ( GetPhase():Test( "PHASE_MAIN_1" ) == true or GetPhase():Test( "PHASE_MAIN_2" ) == true ) then
   local filter = ClearFilter()
    local subfilter = filter:AddSubFilter_Or()
       subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
       subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ENCHANTMENT)
   EffectController():SetItemCount( 1 )
    EffectController():SetItemPrompt (1, "CARD_QUERY_CHOOSE_ARTIFACT_OR_ENCHANTMENT_TO_EXILE" )
    EffectController():ChooseItems( EffectDC():Make_Targets(1) )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(1):Get_CardPtr(0)
    if target_card ~= nil  then
       target_card:Exile()
    end
</RESOLUTION_TIME_ACTION>
This is, of course, untested.
_______________________________
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: Formal Request Thread

Postby BloodReyvyn » 24 Jul 2013, 15:13

Awesome, thanks I will give it a try.

Got a problem card as well that only one person has reported a bug, it's my Necromancer's Covenant.

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="NECROMANCERS_COVENANT_183011" />
  <CARDNAME text="NECROMANCERS_COVENANT" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Necromancer’s Covenant]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Pacte du nécromancien]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Pacto de nigromantes]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Abkommen des Nekromagiers]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Patto del Necromante]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[屍術士の誓約]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Necromancer’s Covenant]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Договор Некроманта]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Pacto dos Necromantes]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="183011" />
  <ARTID value="183011" />
  <ARTIST name="Thomas M. Baxa" />
  <CASTING_COST cost="{3}{W}{B}{B}" />
  <TYPE metaname="Enchantment" />
  <EXPANSION value="ARB" />
  <RARITY metaname="R" />
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Necromancer’s Covenant enters the battlefield, exile all creature cards from target player’s graveyard, then put a 2/2 black Zombie creature token onto the battlefield for each card exiled this way.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Quand le Pacte du nécromancien arrive en jeu, retirez de la partie toutes les cartes de créature du cimetière du joueur ciblé et mettez ensuite en jeu un jeton de créature 2/2 noire Zombie pour chaque carte retirée de cette manière.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Cuando el Pacto de nigromantes entre en juego, remueve del juego todas las cartas de criatura en el cementerio del jugador objetivo, luego pon en juego una ficha de criatura Zombie negra 2/2 por cada carta removida de esta manera.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Wenn das Abkommen des Nekromagiers ins Spiel kommt, entferne alle Kreaturenkarten im Friedhof eines Spielers deiner Wahl ganz aus dem Spiel und bringe dann für jede auf diese Weise entfernte Karte einen 2/2 schwarzen Zombie-Kreaturenspielstein ins Spiel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Quando il Patto del Necromante entra nel campo di battaglia, esilia tutte le carte creatura dal cimitero di un giocatore bersaglio, poi metti sul campo di battaglia una pedina creatura Zombie 2/2 nera per ogni carta esiliata in questo modo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[屍術士の誓約が場に出たとき、プレイヤー1人を対象とする。そのプレイヤーの墓地にあるすべてのクリーチャー・カードをゲームから取り除き、その後これにより取り除かれたカード1枚につき、黒の2/2のゾンビ・クリーチャー・トークンを1体場に出す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[When Necromancer’s Covenant enters the battlefield, exile all creature cards from target player’s graveyard, then put a 2/2 black Zombie creature token onto the battlefield for each card exiled this way.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Когда Договор Некроманта входит в игру, удалите из игры все карты существ на кладбище целевого игрока, а затем положите в игру одну фишку существа 2/2 черный Зомби за каждую удаленную таким образом карту.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Quando Pacto dos Necromantes entrar em jogo, remova do jogo todos os cards de criatura no cemitério do jogador alvo, depois coloque em jogo uma ficha de criatura preta 2/2 do tipo Zumbi para cada card removido desta maneira.]]></LOCALISED_TEXT>
    <SFX text="CASTER_RETETHER_PLAY" />
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_TO_EXILE_GRAVEYARD" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
      local target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      if target ~= nil then
        local number = 0
        local filter = ClearFilter()
        filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
        filter:SetZone( ZONE_GRAVEYARD, target )
        local numCards = filter:EvaluateObjects()
        for i=0,(numCards-1) do
         local card = filter:GetNthEvaluatedObject(i)
         if card ~= nil then
           card:Exile()
            number = number + 1
         end
        end
        MTG():PutTokensOntoBattlefield( "TOKEN_ZOMBIE_2_2_B_350768", number, EffectController() )
      end
    </RESOLUTION_TIME_ACTION>
    <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY" />
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Zombies you control have lifelink.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les zombies que vous contrôlez ont le lien de vie.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los Zombies que controlas tienen la habilidad de vínculo vital.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Zombies, die du kontrollierst, haben Lebensverknüpfung.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli Zombie che controlli hanno legame vitale.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたがコントロールするゾンビは絆魂を持つ。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Zombies you control have lifelink.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Зомби под вашим контролем имеют Цепь жизни.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os Zumbis que você controla têm vínculo com a vida.]]></LOCALISED_TEXT>
    <FILTER filter_id="0">
      local filter = ClearFilter()
      filter:Add(FE_SUBTYPE, OP_IS, CREATURE_TYPE_ZOMBIE)
      filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </FILTER>
    <CONTINUOUS_ACTION layer="6" filter_id="0">
      if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_LIFELINK, 1 )
      end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_ZOMBIE_2_2_B_350768" />
  <HELP title="MORE_INFO_BADGE_TITLE_4" body="MORE_INFO_BADGE_BODY_4" zone="ZONE_ANY" />
</CARD_V2>
Apparently it only exiles the top-most creature and gives you only one token. However, I have yet to personally run into the bug and it seems to work just fine for me, but I figured maybe somehow I am just lucking out somehow and there is just a minor error I am missing.
"There's an experience worse than blindness - it's the certainty that your vision is perfect and the horror that there's no world around you to see."
User avatar
BloodReyvyn
 
Posts: 421
Joined: 19 May 2013, 13:29
Has thanked: 53 times
Been thanked: 40 times

Re: Formal Request Thread

Postby Xander9009 » 24 Jul 2013, 15:20

I don't see anything wrong with it. Nothing that would make it stop at 1. Maybe someone else can spot what's wrong. Since only one person reported it, maybe it's something on their end.
_______________________________
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: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 15:28

Xander9009 wrote:
BloodReyvyn wrote:I am trying to code Return to Dust, but hit a snag when trying to code the "If you played this spell during your main phase..." part as there is no cards that I am aware of with this option already made. Suggestions? :)
In the resolution block, put in an if and check test if the current phase is PHASE_MAIN_1 or PHASE_MAIN_2 AND if it's the EffectController's turn. Something like
[...]
This is, of course, untested.
This would be wrong because the second target would be chosen at resolution time and wouldn't be targetted.
The solution is easy because, according to Gatherer,
Gatherer wrote:Regardless of when Return to Dust is cast, its controller may choose one target or two targets. It can always be cast even if there's only one legal target. If it's cast at a time other than its controller's main phase and a second target is chosen, nothing will happen to that target.
so:
Code: Select all
    <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_OR_ENCHANTMENT_TO_EXILE" definition="0" compartment="0" count="1" />
    <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_OR_ENCHANTMENT_TO_EXILE" definition="0" compartment="1" count="1" up_to="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    local subfilter = filter:AddSubFilter_Or()
        subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
        subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ENCHANTMENT )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target_a = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target_a ~= nil then
        target_a:Exile()
    end
    if EffectController():MyTurn() and ( MTG():GetPhase() == PHASE_MAIN_1 or MTG():GetPhase() == PHASE_MAIN_2 ) then
        local target_b = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
        if target_b ~= nil then
            target_b:Exile()
        end
    end
    </RESOLUTION_TIME_ACTION>
Choosing the second target even if it's not your main phase could be relevant in some scenarios, for example you could get rid of a Phantasmal Image copying an artifact creature.

BloodReyvyn wrote:Got a problem card as well that only one person has reported a bug, it's my Necromancer's Covenant.
[...]
Apparently it only exiles the top-most creature and gives you only one token. However, I have yet to personally run into the bug and it seems to work just fine for me, but I figured maybe somehow I am just lucking out somehow and there is just a minor error I am missing.
I can't see anything that's surely wrong, either. But when I make a loop and I'm unsure of the result, I use a temporary array to save the cards before processing them:
Code: Select all
    <RESOLUTION_TIME_ACTION>
      local target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      if target ~= nil then
        local number = 0
        local array = {}
        local filter = ClearFilter()
        filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
        filter:SetZone( ZONE_GRAVEYARD, target )
        local numCards = filter:EvaluateObjects()
        if numCards &gt; 0 then
          for i=0,(numCards-1) do
            array[i] = filter:GetNthEvaluatedObject(i)
          end
          for i=0,(numCards-1) do
            if array[i] ~= nil then
             array[i]:Exile()
              number = number + 1
           end
          end
        end
        MTG():PutTokensOntoBattlefield( "TOKEN_ZOMBIE_2_2_B_350768", number, EffectController() )
      end
    </RESOLUTION_TIME_ACTION>
The functionality should be totally equivalent, but trying doesn't hurt. :)
P.S.: sorry for the confusing indentation, but the code was long and I didn't feel like adjusting it on the whole code.

--------------------------

EDIT: I have another testing request. I'm having a problem with transform cards and I'd like to know if it's because of transform or if it's an engine bug. Could someone try to make a creature that has both CHARACTERISTIC_MUST_BE_BLOCKED_IF_ABLE and CHARACTERISTIC_CANT_BE_BLOCKED_EXCEPT_BY_TWO_OR_MORE_CREATURES, and see if this allows the AI to cheat on the latter characteristic (i.e. block it with just one creature)?
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 722 times

Re: Formal Request Thread

Postby Master Necro » 24 Jul 2013, 20:01

The Extort code from the first page does not work:

Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Extort]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Extorsion]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Extorsionar.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Abnötigen]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Estorsione]]></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[Extorquir]]></LOCALISED_TEXT>
    <TRIGGER value="SPELL_PLAYED" simple_qualifier="objectyoucontrol" />
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       controller:BeginNewMultipleChoice()
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_W", controller:CanPayManaCost("{W}") )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_B", controller:CanPayManaCost("{B}") )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_DO_NOTHING" )
       controller:AskMultipleChoiceQuestion( "OPTIONAL_ABILITY_QUESTION", Object() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       local decision = controller:GetMultipleChoiceResult()
       if decision ~= 2 then
          if decision == 0 then
             controller:PayManaCost("{W}")
          elseif decision == 1 then
             controller:PayManaCost("{B}")
          end
          local lifeloss = 0
          local myTeam = controller:GetTeam()
          for i=0,MTG():GetNumberOfPlayers()-1 do
             local nthPlayer = MTG():GetNthPlayer(i)
             if nthPlayer ~= nil and nthPlayer:GetTeam() ~= myTeam then
                currentPlayer:LoseLife(1)
                lifeloss = lifeloss + 1
             end
          end
          controller:GainLife(lifeloss)
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
It triggers asks for payment taps land cards that where used for payment but does not take and give life.
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby Xander9009 » 24 Jul 2013, 20:05

Master Necro wrote:The Extort code from the first page does not work:

Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Extort]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Extorsion]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Extorsionar.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Abnötigen]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Estorsione]]></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[Extorquir]]></LOCALISED_TEXT>
    <TRIGGER value="SPELL_PLAYED" simple_qualifier="objectyoucontrol" />
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       controller:BeginNewMultipleChoice()
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_W", controller:CanPayManaCost("{W}") )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_B", controller:CanPayManaCost("{B}") )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_DO_NOTHING" )
       controller:AskMultipleChoiceQuestion( "OPTIONAL_ABILITY_QUESTION", Object() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       local decision = controller:GetMultipleChoiceResult()
       if decision ~= 2 then
          if decision == 0 then
             controller:PayManaCost("{W}")
          elseif decision == 1 then
             controller:PayManaCost("{B}")
          end
          local lifeloss = 0
          local myTeam = controller:GetTeam()
          for i=0,MTG():GetNumberOfPlayers()-1 do
             local nthPlayer = MTG():GetNthPlayer(i)
             if nthPlayer ~= nil and nthPlayer:GetTeam() ~= myTeam then
                currentPlayer:LoseLife(1)
                lifeloss = lifeloss + 1
             end
          end
          controller:GainLife(lifeloss)
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
It triggers asks for payment taps land cards that where used for payment but does not take and give life.
Try changing currentPlayer:LoseLife(1) to nthPlayer:LoseLife(1).
_______________________________
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: Formal Request Thread

Postby Master Necro » 24 Jul 2013, 20:23

Xander9009 wrote:
Master Necro wrote:The Extort code from the first page does not work:

Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Extort]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Extorsion]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Extorsionar.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Abnötigen]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Estorsione]]></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[Extorquir]]></LOCALISED_TEXT>
    <TRIGGER value="SPELL_PLAYED" simple_qualifier="objectyoucontrol" />
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       controller:BeginNewMultipleChoice()
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_W", controller:CanPayManaCost("{W}") )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_B", controller:CanPayManaCost("{B}") )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_DO_NOTHING" )
       controller:AskMultipleChoiceQuestion( "OPTIONAL_ABILITY_QUESTION", Object() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       local decision = controller:GetMultipleChoiceResult()
       if decision ~= 2 then
          if decision == 0 then
             controller:PayManaCost("{W}")
          elseif decision == 1 then
             controller:PayManaCost("{B}")
          end
          local lifeloss = 0
          local myTeam = controller:GetTeam()
          for i=0,MTG():GetNumberOfPlayers()-1 do
             local nthPlayer = MTG():GetNthPlayer(i)
             if nthPlayer ~= nil and nthPlayer:GetTeam() ~= myTeam then
                currentPlayer:LoseLife(1)
                lifeloss = lifeloss + 1
             end
          end
          controller:GainLife(lifeloss)
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
It triggers asks for payment taps land cards that where used for payment but does not take and give life.
Try changing currentPlayer:LoseLife(1) to nthPlayer:LoseLife(1).
Yes that was it.
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby gorem2k » 24 Jul 2013, 21:04

thefiremind wrote:EDIT: I have another testing request. I'm having a problem with transform cards and I'd like to know if it's because of transform or if it's an engine bug. Could someone try to make a creature that has both CHARACTERISTIC_MUST_BE_BLOCKED_IF_ABLE and CHARACTERISTIC_CANT_BE_BLOCKED_EXCEPT_BY_TWO_OR_MORE_CREATURES, and see if this allows the AI to cheat on the latter characteristic (i.e. block it with just one creature)?
I've tested. OP had 8 life remaining with one creature left. I attacked with a 9/5, Must-be-blocked-can't-be-blocked creature and he couldn't block (or didn't try to which is unlikely to happen..)

about my previous message regarding {X} {X} cost in abilities. I think it's an engine limitation. I guess it recognize this cost only for casting.
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 22:59

gorem2k wrote:I've tested. OP had 8 life remaining with one creature left. I attacked with a 9/5, Must-be-blocked-can't-be-blocked creature and he couldn't block (or didn't try to which is unlikely to happen..)
OK, thanks. Then it's a problem given by how I implemented transform... I guess I'll have to leave Kruin Outlaw aside, at least for now.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 722 times

Re: Formal Request Thread

Postby BloodReyvyn » 25 Jul 2013, 07:05

thefiremind wrote:
Xander9009 wrote:
BloodReyvyn wrote:I am trying to code Return to Dust, but hit a snag when trying to code the "If you played this spell during your main phase..." part as there is no cards that I am aware of with this option already made. Suggestions? :)
In the resolution block, put in an if and check test if the current phase is PHASE_MAIN_1 or PHASE_MAIN_2 AND if it's the EffectController's turn. Something like
[...]
This is, of course, untested.
This would be wrong because the second target would be chosen at resolution time and wouldn't be targetted.
The solution is easy because, according to Gatherer,
Gatherer wrote:Regardless of when Return to Dust is cast, its controller may choose one target or two targets. It can always be cast even if there's only one legal target. If it's cast at a time other than its controller's main phase and a second target is chosen, nothing will happen to that target.
so:
Code: Select all
    <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_OR_ENCHANTMENT_TO_EXILE" definition="0" compartment="0" count="1" />
    <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_OR_ENCHANTMENT_TO_EXILE" definition="0" compartment="1" count="1" up_to="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    local subfilter = filter:AddSubFilter_Or()
        subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
        subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ENCHANTMENT )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target_a = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target_a ~= nil then
        target_a:Exile()
    end
    if EffectController():MyTurn() and ( MTG():GetPhase() == PHASE_MAIN_1 or MTG():GetPhase() == PHASE_MAIN_2 ) then
        local target_b = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
        if target_b ~= nil then
            target_b:Exile()
        end
    end
    </RESOLUTION_TIME_ACTION>
Choosing the second target even if it's not your main phase could be relevant in some scenarios, for example you could get rid of a Phantasmal Image copying an artifact creature.

BloodReyvyn wrote:Got a problem card as well that only one person has reported a bug, it's my Necromancer's Covenant.
[...]
Apparently it only exiles the top-most creature and gives you only one token. However, I have yet to personally run into the bug and it seems to work just fine for me, but I figured maybe somehow I am just lucking out somehow and there is just a minor error I am missing.
I can't see anything that's surely wrong, either. But when I make a loop and I'm unsure of the result, I use a temporary array to save the cards before processing them:
Code: Select all
    <RESOLUTION_TIME_ACTION>
      local target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      if target ~= nil then
        local number = 0
        local array = {}
        local filter = ClearFilter()
        filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
        filter:SetZone( ZONE_GRAVEYARD, target )
        local numCards = filter:EvaluateObjects()
        if numCards &gt; 0 then
          for i=0,(numCards-1) do
            array[i] = filter:GetNthEvaluatedObject(i)
          end
          for i=0,(numCards-1) do
            if array[i] ~= nil then
             array[i]:Exile()
              number = number + 1
           end
          end
        end
        MTG():PutTokensOntoBattlefield( "TOKEN_ZOMBIE_2_2_B_350768", number, EffectController() )
      end
    </RESOLUTION_TIME_ACTION>
The functionality should be totally equivalent, but trying doesn't hurt. :)
P.S.: sorry for the confusing indentation, but the code was long and I didn't feel like adjusting it on the whole code.

--------------------------

EDIT: I have another testing request. I'm having a problem with transform cards and I'd like to know if it's because of transform or if it's an engine bug. Could someone try to make a creature that has both CHARACTERISTIC_MUST_BE_BLOCKED_IF_ABLE and CHARACTERISTIC_CANT_BE_BLOCKED_EXCEPT_BY_TWO_OR_MORE_CREATURES, and see if this allows the AI to cheat on the latter characteristic (i.e. block it with just one creature)?
Thanks man, I am about to go test those. Had company so I been away from the computer for a while.

As far as the test request, I added those two abilities to a Watchwolf for testing purposes. Not only does the AI block with only one creature most of the time, but if I cast Irresistible Prey on it, the AI will sometimes choose not to block at all. Maybe redundant instances of the ability will cancel each other out or one ability supersedes another depending on when it's played? Dunno, it's weird, but we always find weird crap with the DotP engines. :P
"There's an experience worse than blindness - it's the certainty that your vision is perfect and the horror that there's no world around you to see."
User avatar
BloodReyvyn
 
Posts: 421
Joined: 19 May 2013, 13:29
Has thanked: 53 times
Been thanked: 40 times

Re: Formal Request Thread

Postby BloodReyvyn » 25 Jul 2013, 07:32

I am just wondering if I am just trying to use ChromaCount() incorrectly. The only examples I have to go off off are used with a filter, so I am assuming I will probably need to make card pointers for each card and use a filter to find the instance of the card, then use ChromaCount on the filter instead of an individual card?

I kind of had hopes this code would work as is (only because it would be simple and to the point), but it keeps telling me that ChromaCount(COLOUR_WHITE) is a nil value. So, therefore I am currently under the impression that it can only be used with a filter. Hopefully I am wrong though. :lol:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="LIGHT_FROM_WITHIN_151139" />
  <CARDNAME text="LIGHT_FROM_WITHIN" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Light from Within]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Lumière du dedans]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Luz interior]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Licht von innen]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Luce Interiore]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[内面からの光]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Light from Within]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Свет Изнутри]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Luz Interior]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="151139" />
  <ARTID value="151139" />
  <ARTIST name="Aleksi Briclot" />
  <CASTING_COST cost="{2}{W}{W}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“Muscle does not make one strong. It only masks the soul’s light. True strength lies in purity of purpose.”
—Donal Alloway, cenn of Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[« Le muscle ne fait pas la force. Il ne fait que masquer la lumière de l’âme. La force véritable vient de la pureté de la motivation. »
—Donal Alloway, cenn de Kinscaër]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“El músculo no te hace fuerte. Sólo enmascara la luz del alma. La verdadera fuerza está en la pureza de la voluntad.”
—Donal Alloway, cenn de Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[„Muskelberge machen niemanden stark. Sie verbergen nur das Leuchten der Seele. Wahre Stärke liegt in der Reinheit des Zwecks.”
—Donal Alloway, Schulze von Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“I muscoli non ti rendono forte. Servono solo a velare la luce dell’anima. La vera forza sta nella purezza degli intenti.”
—Donal Alloway, cenn di Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[「筋肉では強くはなれん。 それは魂の光を隠してしまう。 真の力は目的の純潔さの中にあるのだ。」
――キンザーの主、ドナル・アロウェイ]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“Muscle does not make one strong. It only masks the soul’s light. True strength lies in purity of purpose.”
—Donal Alloway, cenn of Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[«Стальные мускулы не делают сильным. Они лишь прикрывают свет души. Истинная сила в чистоте помыслов».
— Донал Аллоуэй, городской староста Кинсара]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“Não são os músculos que tornam alguém forte. Eles apenas mascaram a luz da alma. A verdadeira força está na pureza de propósito.”
— Donal Alloway, cenn de Kinscaer]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Enchantment" />
  <EXPANSION value="EVE" />
  <RARITY metaname="R" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Chroma — Each creature you control gets +1/+1 for each white mana symbol in its mana cost.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Chromatique — Chaque créature que vous contrôlez gagne +1/+1 pour chaque symbole de mana blanc dans son coût de mana.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Croma Cada criatura que controlas obtiene +1/+1 por cada símbolo de maná blanco en su coste de maná.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Farbwert Jede Kreatur, die du kontrollierst, erhält +1/+1 für jedes weiße Manasymbol in ihren Manakosten.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Cromia — Ogni creatura che controlli prende +1/+1 per ogni simbolo di mana bianco nel suo costo di mana.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[彩色 ― あなたがコントロールする各クリーチャーは、それのマナ・コストの白マナ・シンボル1つにつき+1/+1の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Chroma — Each creature you control gets +1/+1 for each white mana symbol in its mana cost.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Хроматичность каждое существо под вашим контролем получает +1/+1 за каждый символ белой маны в своей мана-стоимости.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Croma Cada criatura que você controla recebe +1/+1 para cada símbolo de mana branco em seu custo de mana.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION layer="7C">
      local filter = ClearFilter()
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      filter:Add(FE_CONTROLLER, OP_IS, EffectController() )
      local numcreatures = filter:EvaluateObjects()
      if numcreatures &gt; 0 then
       for i = 0, (numcreatures - 1 ) do
          local creature = filter:GetNthEvaluatedObject(i)
          local characteristics = creature:GetCurrentCharacteristics()
          local ptadd = creature:ChromaCount(COLOUR_WHITE)
         characteristics:Power_Add( ptadd )
         characteristics:Toughness_Add( ptadd )
        end
      end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
</CARD_V2>
"There's an experience worse than blindness - it's the certainty that your vision is perfect and the horror that there's no world around you to see."
User avatar
BloodReyvyn
 
Posts: 421
Joined: 19 May 2013, 13:29
Has thanked: 53 times
Been thanked: 40 times

Re: Formal Request Thread

Postby Xander9009 » 25 Jul 2013, 08:17

BloodReyvyn wrote:I am just wondering if I am just trying to use ChromaCount() incorrectly. The only examples I have to go off off are used with a filter, so I am assuming I will probably need to make card pointers for each card and use a filter to find the instance of the card, then use ChromaCount on the filter instead of an individual card?

I kind of had hopes this code would work as is (only because it would be simple and to the point), but it keeps telling me that ChromaCount(COLOUR_WHITE) is a nil value. So, therefore I am currently under the impression that it can only be used with a filter. Hopefully I am wrong though. :lol:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="LIGHT_FROM_WITHIN_151139" />
  <CARDNAME text="LIGHT_FROM_WITHIN" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Light from Within]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Lumière du dedans]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Luz interior]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Licht von innen]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Luce Interiore]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[内面からの光]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Light from Within]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Свет Изнутри]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Luz Interior]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="151139" />
  <ARTID value="151139" />
  <ARTIST name="Aleksi Briclot" />
  <CASTING_COST cost="{2}{W}{W}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“Muscle does not make one strong. It only masks the soul’s light. True strength lies in purity of purpose.”
—Donal Alloway, cenn of Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[« Le muscle ne fait pas la force. Il ne fait que masquer la lumière de l’âme. La force véritable vient de la pureté de la motivation. »
—Donal Alloway, cenn de Kinscaër]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“El músculo no te hace fuerte. Sólo enmascara la luz del alma. La verdadera fuerza está en la pureza de la voluntad.”
—Donal Alloway, cenn de Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[„Muskelberge machen niemanden stark. Sie verbergen nur das Leuchten der Seele. Wahre Stärke liegt in der Reinheit des Zwecks.”
—Donal Alloway, Schulze von Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“I muscoli non ti rendono forte. Servono solo a velare la luce dell’anima. La vera forza sta nella purezza degli intenti.”
—Donal Alloway, cenn di Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[「筋肉では強くはなれん。 それは魂の光を隠してしまう。 真の力は目的の純潔さの中にあるのだ。」
――キンザーの主、ドナル・アロウェイ]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“Muscle does not make one strong. It only masks the soul’s light. True strength lies in purity of purpose.”
—Donal Alloway, cenn of Kinscaer]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[«Стальные мускулы не делают сильным. Они лишь прикрывают свет души. Истинная сила в чистоте помыслов».
— Донал Аллоуэй, городской староста Кинсара]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“Não são os músculos que tornam alguém forte. Eles apenas mascaram a luz da alma. A verdadeira força está na pureza de propósito.”
— Donal Alloway, cenn de Kinscaer]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Enchantment" />
  <EXPANSION value="EVE" />
  <RARITY metaname="R" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Chroma — Each creature you control gets +1/+1 for each white mana symbol in its mana cost.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Chromatique — Chaque créature que vous contrôlez gagne +1/+1 pour chaque symbole de mana blanc dans son coût de mana.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Croma Cada criatura que controlas obtiene +1/+1 por cada símbolo de maná blanco en su coste de maná.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Farbwert Jede Kreatur, die du kontrollierst, erhält +1/+1 für jedes weiße Manasymbol in ihren Manakosten.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Cromia — Ogni creatura che controlli prende +1/+1 per ogni simbolo di mana bianco nel suo costo di mana.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[彩色 ― あなたがコントロールする各クリーチャーは、それのマナ・コストの白マナ・シンボル1つにつき+1/+1の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Chroma — Each creature you control gets +1/+1 for each white mana symbol in its mana cost.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Хроматичность каждое существо под вашим контролем получает +1/+1 за каждый символ белой маны в своей мана-стоимости.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Croma Cada criatura que você controla recebe +1/+1 para cada símbolo de mana branco em seu custo de mana.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION layer="7C">
      local filter = ClearFilter()
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      filter:Add(FE_CONTROLLER, OP_IS, EffectController() )
      local numcreatures = filter:EvaluateObjects()
      if numcreatures &gt; 0 then
       for i = 0, (numcreatures - 1 ) do
          local creature = filter:GetNthEvaluatedObject(i)
          local characteristics = creature:GetCurrentCharacteristics()
          local ptadd = creature:ChromaCount(COLOUR_WHITE)
         characteristics:Power_Add( ptadd )
         characteristics:Toughness_Add( ptadd )
        end
      end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
</CARD_V2>
If it's true that it can only be used with a filter, then it should still be possible to do fairly simply. Just make a filter block that constists of the effected creatures, then in the continuous block, refer to those creatures in a new filter which consists only of that one creature. I don't know if it can be done this way, but here's some code that may or may not work. I've never used FilteredCard() in a filter, but I see no reason it wouldn't work. We can use EffectSource() in the same way, so hopefully.

Code: Select all
<FILTER filter_id="0">
   local filter = ClearFilter()
   filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
   filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
   </FILTER>
   <CONTINUOUS_ACTION layer="7C" filter_id="0">
    if EffectSource() ~= nil and FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       local filter = ClearFilter()
       filter:Add( FE_CARD_INSTANCE, OP_IS, FilteredCard() )
       local total = filter:ChromaCount(COLOUR_WHITE)
       
       characteristics:Power_Add( total )
       characteristics:Toughness_Add( total )
    end
    </CONTINUOUS_ACTION>
-----

thefiremind wrote:
Xander9009 wrote:In the resolution block, put in an if and check test if the current phase is PHASE_MAIN_1 or PHASE_MAIN_2 AND if it's the EffectController's turn. Something like
[...]
This is, of course, untested.
This would be wrong because the second target would be chosen at resolution time and wouldn't be targetted.
The solution is easy because, according to Gatherer,
Gatherer wrote:Regardless of when Return to Dust is cast, its controller may choose one target or two targets. It can always be cast even if there's only one legal target. If it's cast at a time other than its controller's main phase and a second target is chosen, nothing will happen to that target.
I didn't realize you were always allowed to choose up to two targets. My only other solution (which would only target the second if it was the appropriate time), would be to have two spell abilities, each with its own intervening if. Still, that makes it simpler, so that's good :)

EDIT: Fixed the layer. I copied it from Primalcrux or something and forgot that bit. Thanks for pointing it out.
EDIT2: Added the missing slash. This is why I prefer copying from other cards rather than typing it out...
Last edited by Xander9009 on 25 Jul 2013, 09:56, edited 2 times 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: Formal Request Thread

Postby thefiremind » 25 Jul 2013, 08:38

Xander9009 wrote:If it's true that it can only be used with a filter, then it should still be possible to do fairly simply. Just make a filter block that constists of the effected creatures, then in the continuous block, refer to those creatures in a new filter which consists only of that one creature. I don't know if it can be done this way, but here's some code that may or may not work. I've never used FilteredCard() in a filter, but I see no reason it wouldn't work. We can use EffectSource() in the same way, so hopefully.
Your code should be OK, except for the layer, which must be 7C and not 7A (7A is for creatures with their own variable P/T).

BloodReyvyn wrote:As far as the test request, I added those two abilities to a Watchwolf for testing purposes. Not only does the AI block with only one creature most of the time, but if I cast Irresistible Prey on it, the AI will sometimes choose not to block at all. Maybe redundant instances of the ability will cancel each other out or one ability supersedes another depending on when it's played? Dunno, it's weird, but we always find weird crap with the DotP engines. :P
That's a relief because now I know it doesn't depend on how I coded transform. On the other hand, it's yet another example of developers' carelessness... oh well, I think I'll keep Kruin Outlaw / Terror of Kruin Pass rather than Hinterland Hermit / Hinterland Scourge, because it's much better. When it's all ready, I'll post on the "known bugs" to avoid using Enlarge or similar cards with Kruin Outlaw / Terror of Kruin Pass in the same deck.
EDIT: I think that my problem is still connected to transform: the AI can cheat on either characteristic even when there's only one. :(
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 722 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: No registered users and 21 guests

Main Menu

User Menu

Our Partners


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 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 21 guests

Login Form