It is currently 26 Apr 2024, 10:59
   
Text Size

Report cards error here

Moderator: CCGHQ Admins

Re: Report cards error here

Postby gorem2k » 02 Aug 2013, 04:32

Again, I need some help with Bala Ged Thief. I'm planning to make every Ally cards possible.

Here's an attachment. (xml with art for convenience)

Thank you.

EDIT: I think it's okay with...

Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Bala Ged Thief or another Ally enters the battlefield under your control, target player reveals a number of cards from his or her hand equal to the number of Allies you control. You choose one of them. That player discards that card.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY">
    return TriggerObject():GetSubType():Test( CREATURE_TYPE_ALLY ) and TriggerObject() ~= EffectSource()
    </TRIGGER>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD_1" 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()
    filter:Add( FE_SUBTYPE, OP_IS, CREATURE_TYPE_ALLY )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    local numAllies = filter:Count()
    EffectDC():Set_Int(2, numAllies)
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
    local numAllies = EffectDC():Get_Int(2)
    if target_player ~= nil then
       filter:SetZone( ZONE_HAND, target_player)
       target_player:SetItemCount( numAllies )
       for i = 0,(numAllies-1) do
          target_player:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_REVEAL" )
       end
       target_player:ChooseItems( EffectDC():Make_Targets(1) )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target_DC = EffectDC():Get_Targets(1)
    if target_DC ~= nil then
       EffectController():ChooseItemFromDC( "CARD_QUERY_CHOOSE_CARD_TO_DISCARD", target_DC, EffectDC():Make_Targets(2) )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
    if target_player ~= nil then
       local chosen_card = EffectDC():Get_Targets(2):Get_CardPtr(0)
       
       if chosen_card ~= nil then
          chosen_card:Discard()
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
But I'm not really sure.
Attachments
BALA_GED_THIEF_444197402.zip
(87.14 KiB) Downloaded 241 times
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Report cards error here

Postby thefiremind » 02 Aug 2013, 08:27

gorem2k wrote:EDIT: I think it's okay with...
But I'm not really sure.
From a very quick look I can't see any problem, anyway you can find Mire's Toll inside my mod, which is almost the same, you can compare your Ally with it if you need to.
< 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: 721 times

Re: Report cards error here

Postby gorem2k » 02 Aug 2013, 21:59

Okay, now I've finished doing every Ally creatures.

Only thing missing is the interrogate part in Tuktuk Scrapper.

Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Tuktuk Scrapper or another Ally enters the battlefield under your control, you may destroy target artifact. If that artifact is put into a graveyard this way, Tuktuk Scrapper deals damage to that artifact’s controller equal to the number of Allies you control.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY">
    return TriggerObject():GetSubType():Test( CREATURE_TYPE_ALLY ) and TriggerObject() ~= EffectSource()
    </TRIGGER>
    <MAY />
    <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_TO_DESTROY" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then   
       target:Destroy() 
    end
    </RESOLUTION_TIME_ACTION>
    <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY>
    <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD">
    if TriggerObject():GetCardType():Test( CARD_TYPE_ARTIFACT ) then
       local interrogation = MTG():ClearInterrogationQuery()
       
       interrogation:SetObject( EffectSource() )
       interrogation:SetSecondaryObject( TriggerObject() )
       if interrogation:Test( INTERROGATE_CARDS_MOVED_ZONE, INTERROGATE_THIS_TURN ) then
          return true
       else
          return false
       end
    end
    return false
    </TRIGGER>
    <MAY />
    <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:Add(FE_SUBTYPE, OP_IS, CREATURE_TYPE_ALLY )
    filter:Add(FE_CONTROLLER, OP_IS, EffectController() )
    local numAllies = filter:Count()
    local target_player = TriggerObjectLKI():GetOwner()
    if target_player ~= nil then
        EffectSourceLKI():DealDamageTo( numAllies, target_player )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
It works when Tuktuk enters first time, it deals damage to player, but it doesn't deal damage when other allies enter after him.

maybe a problem with EffectSourceLKI ??

this is not an easy task for me! any help appreciated... :)
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Report cards error here

Postby thefiremind » 03 Aug 2013, 00:04

You can't do that with interrogation because there's no way to check what's the source of a destruction. The most correct way to do that is with a delayed trigger. I think there are still some scenarios where it could fail, but they should be few enough to be not worth considering.
Here's how I coded Afflicted Desterter / Werewolf Ransacker:
Werewolf Ransacker's "shatter" ability | Open
Code: Select all
  <TRIGGERED_ABILITY>
    <TRIGGER value="TURNED_FACE_UP" simple_qualifier="self" />
    <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_TO_DESTROY" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add(FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_CardPtr(0, target)
       delayDC:Set_CardPtr( 1, EffectSourceLKI() )
       MTG():CreateDelayedTrigger(2, delayDC)
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:Destroy()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    MTG():RemoveDelayedTrigger(2)
    </RESOLUTION_TIME_ACTION>
    <MAY />
    <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <CLEANUP fire_once="1" />
    <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD">
    if TriggerObject() == EffectDC():Get_CardPtr(0) then
       EffectDC():Set_PlayerPtr( 2, TriggerObject():GetController() )
       return true
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_PlayerPtr(2)
    if player ~= nil then
       local sourceLKI = EffectDC():Get_CardPtr(1)
       if sourceLKI ~= nil then
          local damage = 3
          sourceLKI:DealDamageTo(damage, player)
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
You only need to change the trigger condition (of course) and calculate the right damage (Allies you control) instead of 3.
< 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: 721 times

Re: Report cards error here

Postby gorem2k » 03 Aug 2013, 00:13

Nice! thanks!!! I will try your method.. I just saw sumo did it for 2013 and he (or she? I don't know..) didn't use a delayed trigger, but this :

Code: Select all
if target ~= nil and target:GetZone() == ZONE_GRAVEYARD then
2013 Tuktuk | Open
Code: Select all
    <TRIGGER value="ZONECHANGE_END" to_zone="ZONE_IN_PLAY">
    return TriggerObject():GetSubType():Test( CREATURE_TYPE_ALLY ) ~= 0 and TriggerObject():GetPlayer() == EffectController()
    </TRIGGER>
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:May()
    filter:AIMay()
    filter:AddCardType( CARD_TYPE_ARTIFACT )
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_ARTIFACT_TO_DESTROY", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_NthCardPtr(0)
    if target ~= nil then
      local player = target:GetController()
       if player ~= nil then          
          ObjectDC():Set_PlayerPtr(1, player)
          ObjectDC():Set_CardPtr(2, target)
          ObjectDC():Protect_CardPtr(2)
      end
       target:Destroy()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = ObjectDC():Get_CardPtr(2)
    if target ~= nil and target:GetZone() == ZONE_GRAVEYARD then
      local player = ObjectDC():Get_PlayerPtr(1)
       if player ~= nil then
        local filter = Object():GetFilter()
        filter:Clear()
        filter:AddSubType( CREATURE_TYPE_ALLY )
        filter:SetZone( ZONE_IN_PLAY )
        filter:SetPlayer( EffectController() )
        filter:NotTargetted()
        local total = filter:Count()
        player:DealDamage(total, Object())
      end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
it use ObjectDC() so this means I will need RSN ObjectDC function. which one is more accurate?

EDIT: done! I replaced ObjectDC's with EffectDC's and this worked like a charm.

Code: Select all
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY">
    return TriggerObject():GetSubType():Test( CREATURE_TYPE_ALLY ) and TriggerObject() ~= EffectSource()
    </TRIGGER>
    <MAY />
    <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_TO_DESTROY" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then   
         local target_player = target:GetOwner()
            if target_player ~= nil then         
            EffectDC():Set_PlayerPtr(1, target_player)
            EffectDC():Set_CardPtr(2, target)
            EffectDC():Protect_CardPtr(2)
           end
       target:Destroy() 
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_CardPtr(2)
    if target ~= nil and target:GetZone() == ZONE_GRAVEYARD then
      local target_player = EffectDC():Get_PlayerPtr(1)
       if target_player ~= nil then
       local filter = ClearFilter()
       filter:Add(FE_SUBTYPE, OP_IS, CREATURE_TYPE_ALLY )
       filter:Add(FE_CONTROLLER, OP_IS, EffectController() )
       local numAllies = filter:Count()
        EffectSourceLKI():DealDamageTo( numAllies, target_player )
       end
    end
    </RESOLUTION_TIME_ACTION>
    <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
  </TRIGGERED_ABILITY>
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 11 Aug 2013, 19:02

Hey, I have a minor question.

I'm coding in a few cards, and I've been trying to code in a card called Mayael's Aria:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="TESTCARD2" />
  <CARDNAME text="TESTCARD2" />
   <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Mayael’s Aria]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Aria de Mayael]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Aria de Mayael]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mayaels Arie]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Aria di Mayael]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[メイエルのアリア]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Mayael’s Aria]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Ария Майел]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Aria de Mayael]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="180620" />
  <ARTID value="180620" />
  <ARTIST name="Steve Argyle" />
  <CASTING_COST cost="" />
  <TYPE metaname="Enchantment" />
  <EXPANSION value="ARB" />
  <RARITY metaname="R" />
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of your upkeep, put a +1/+1 counter on each creature you control if you control a creature with power 5 or greater. Then you gain 10 life if you control a creature with power 10 or greater. Then you win the game if you control a creature with power 20 or greater.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au début de votre entretien, mettez un marqueur +1/+1 sur chaque créature que vous contrôlez si vous contrôlez une créature de force supérieure ou égale à 5. Vous gagnez ensuite 10 points de vie si vous contrôlez une créature de force supérieure ou égale à 10. Vous gagnez ensuite la partie si vous contrôlez une créature de force supérieure ou égale à 20.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Al comienzo de tu mantenimiento, pon un contador +1/+1 sobre cada criatura que controlas si controlas una criatura con fuerza de 5 o más. Luego ganas 10 vidas si controlas una criatura con fuerza de 10 o más. Luego ganas el juego si controlas una criatura con fuerza de 20 o más.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Lege zu Beginn deines Versorgungssegments eine +1/+1-Marke auf jede Kreatur, die du kontrollierst, falls du eine Kreatur mit Stärke 5 oder mehr kontrollierst. Dann erhältst du 10 Lebenspunkte dazu, falls du eine Kreatur mit Stärke 10 oder mehr kontrollierst. Dann gewinnst du das Spiel, falls du eine Kreatur mit Stärke 20 oder mehr kontrollierst.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[All’inizio del tuo mantenimento, metti un segnalino +1/+1 su ogni creatura che controlli, se controlli una creatura con forza pari o superiore a 5. Poi guadagni 10 punti vita, se controlli una creatura con forza pari o superiore a 10. Poi vinci la partita, se controlli una creatura con forza pari o superiore a 20.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたのアップキープの開始時に、あなたがパワーが5以上のクリーチャーをコントロールしているなら、あなたがコントロールする各クリーチャーにそれぞれ+1/+1カウンターを1個置く。 その後、あなたがパワーが10以上のクリーチャーをコントロールしているなら、あなたは10点のライフを得る。 その後、あなたがパワーが20以上のクリーチャーをコントロールしているなら、あなたはこのゲームに勝利する。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[At the beginning of your upkeep, put a +1/+1 counter on each creature you control if you control a creature with power 5 or greater. Then you gain 10 life if you control a creature with power 10 or greater. Then you win the game if you control a creature with power 20 or greater.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[В начале вашего шага поддержки положите жетон +1/+1 на каждое существо под вашим контролем, если под вашим контролем есть существо с силой 5 или больше. Затем вы получаете 10 жизней, если под вашим контролем есть существо с силой 10 или больше. Затем вы одерживаете победу,  если под вашим контролем есть существо с силой 20 или больше.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[No início de sua manutenção, coloque um marcador +1/+1 em cada criatura que você controla se controlar uma criatura com poder maior ou igual a 5. Depois, você ganhará 10 pontos de vida se controlar uma criatura com poder maior ou igual a 10. Em seguida, você ganhará o jogo se controlar uma criatura com poder maior ou igual a 20.]]></LOCALISED_TEXT>
  <SFX text="GLOBAL_WARP_PLAY" />
  <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
  return MTG():GetStep() == STEP_UPKEEP
  </TRIGGER>
  <FILTER filter_id="0">
    local filter = ClearFilter()
    filter:SetZone( ZONE_BATTLEFIELD )
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
  </FILTER>
  <RESOLUTION_TIME_ACTION filter_id="0">
  local number = 0
  local filter2 = ClearFilter()
    filter2:SetZone( ZONE_BATTLEFIELD )
    filter2:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter2:Add( FE_IS_PERMANENT, true )
    filter2:Add( FE_CONTROLLER, OP_IS, EffectController() )
    local numPermanents = filter2:EvaluateObjects()
    for i=0,(numPermanents-1) do
      local power = filter2:GetNthEvaluatedObject(i):GetCurrentPower()
      if power &gt; number then
            number = power
      end
    end
    if number &gt; 4 then
       if FilteredCard() ~= nil then
           FilteredCard():AddCounters( MTG():PlusOnePlusOneCounters(), 1 )
        end
    end
    if number &gt; 9 then
       EffectController():GainLife( 10 )
    end
    if number &gt; 19 then
        EffectController():WinGame()
    end
  </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <AI_BASE_SCORE score="1200" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
Right now, everything works, except the life-gain section of code seems to repeat itself for each filtered creature. So, if you have 2 creatures out that meet the filter then you end up gaining 20 life, if you have 3 creatures out you gain 30 life. It's really odd, as not even the add-counters part of the code stack like that. Anyone know what's going on?
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 11 Aug 2013, 21:58

Have you ever wondered how the actions connected to a FILTER block actually work? The action is repeated as many times as the cards that meet the filter requirements, with FilteredCard() pointing to a different card everytime. This means that in an action connected to a FILTER block you should do only things that you need to repeat for each filtered card. Put the 3 different effects in 3 different RESOLUTION_TIME_ACTIONs, with only the first one connected to the filter, and you'll solve the problem. By the way, you don't need to do filter evaluation for those checks, for example this is how I would code the second:
Code: Select all
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    filter:Add( FE_POWER, OP_GREATER_THAN_OR_EQUAL_TO, 10 )
    if filter:CountStopAt(1) == 1 then
    -- ...then you are controlling a creature with power 10 or greater
    end
< 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: 721 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 12 Aug 2013, 13:49

Heh, thanks. I sorta figured that filters might repeat the code for each card that meets the filter requirements from another bug I fixed with the add-counters part of the card.

Another thing, I'm kinda unfamiliar with the line "filter:CountStopAt(1) == 1". Is the number in the parentheses the filter ID, because I thought filters in the RESOLUTION_TIME_ACTIONs don't have IDs (or if they do, you don't know what they are).
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 12 Aug 2013, 14:07

CountStopAt(1) means that the count will stop at 1 even if there are 2 or more cards that the filter is including, so the returning value can be only 0 or 1. In my code, filter:Count() &gt; 0 would achieve the same result, but I think you get a slight performance boost by limiting the count, and I got used to use CountStopAt everytime I can anyway.
< 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: 721 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 31 Aug 2013, 18:20

Hey, I have a little question.

My code for Bant Charm works perfectly, but for some reason the query strings [MODE_BANT_ARTIFACT, MODE_BANT_CONDEMN, MODE_BANT_COUNTER] aren't showing up.

The code as follows is:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="BANT_CHARM_99137931" />
  <CARDNAME text="BANT_CHARM" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Bant Charm]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Charme de Bant]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Amuleto bantiano]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Amulett aus Bant]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Monile di Bant]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[バントの魔除け]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Bant Charm]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Талисман Бэнта]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Medalhão de Bant]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="137931" />
  <ARTID value="137931" />
  <ARTIST name="Randy Gallegos" />
  <CASTING_COST cost="{G}{W}{U}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Bant is a world where death and chaos hold no sway.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Bant est un monde où la mort et le chaos n’ont pas prise.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Bant es un mundo donde la muerte y el caos no tienen lugar.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bant ist eine Welt, in der Tod und Chaos keinerlei Macht haben.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Bant è un mondo in cui morte e caos non hanno alcun potere.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[バントは死と混沌が揺らがない世界。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Bant is a world where death and chaos hold no sway.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Бэнт это мир, над которым не властны смерть и хаос.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Bant é um mundo onde a morte e o caos não têm vez.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Instant" />
  <EXPANSION value="ALA" />
  <RARITY metaname="U" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Choose one — Destroy target artifact; or put target creature on the bottom of its owner’s library; or counter target instant spell.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Choisissez l’un — Détruisez l’artefact ciblé ; ou mettez la créature ciblée au-dessous de la bibliothèque de son propriétaire ; ou contrecarrez le sort d’éphémère ciblé.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Elige uno: Destruye el artefacto objetivo; o pon la criatura objetivo en el fondo de la biblioteca de su propietario; o contrarresta el hechizo instantáneo objetivo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bestimme eines Zerstöre ein Artefakt deiner Wahl; oder lege eine Kreatur deiner Wahl unter die Bibliothek ihres Besitzers; oder neutralisiere einen Spontanzauber deiner Wahl.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Scegli uno — Distruggi un artefatto bersaglio; oppure metti una creatura bersaglio in fondo al grimorio del suo proprietario; oppure neutralizza una magia istantaneo bersaglio.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[以下の3つから1つを選ぶ。「アーティファクト1つを対象とし、それを破壊する。」「クリーチャー1体を対象とし、それをオーナーのライブラリーの一番下に置く。」「インスタント呪文1つを対象とし、それを打ち消す。」]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Choose one — Destroy target artifact; or put target creature on the bottom of its owner’s library; or counter target instant spell.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Выберите одно уничтожьте целевой артефакт; или положите целевое существо в низ библиотеки его владельца; или отмените целевое мгновенное заклинание.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Escolha um Destrua o artefato alvo; ou coloque a criatura alvo no fundo do grimório de seu dono; ou anule a mágica instantânea alvo.]]></LOCALISED_TEXT>
  <SFX text="GLOBAL_SUNBLAST_PLAY" />
  <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="MODE_BANT_ARTIFACT" index="1" />
      <MODE tag="MODE_BANT_CONDEMN" index="2" />
      <MODE tag="MODE_BANT_COUNTER" index="3" />
  </MODE_SELECT>
  <TARGET tag="CARD_QUERY_CHOOSE_ARTIFACT_TO_DESTROY" definition="0" compartment="0" mode="1" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="1">
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then   
       target:Destroy() 
    end
    </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_PUT_ONTO_BOTTOM_LIBRARY" definition="1" compartment="1" mode="2" count="1" />
    <TARGET_DEFINITION id="1">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="2" >
    local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
    if target ~= nil then
       target:PutOnBottomOfLibrary()
    end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="2" compartment="2" mode="3" count="1" />
    <TARGET_DEFINITION id="2">
    local filter = ClearFilter()
    filter:SetZone( ZONE_STACK )
    filter:Add (FE_TYPE, OP_IS, CARD_TYPE_INSTANT)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="3">
    local target = EffectDC():Get_Targets(2):Get_CardPtr(0)
    if target ~= nil then
       target:CounterSpell()
    end
    </RESOLUTION_TIME_ACTION>
  <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
<AI_SIMPLIFIED_TARGETING compartment="1" hint="HINT_ENEMY_ONLY" />
<AI_SIMPLIFIED_TARGETING compartment="2" hint="HINT_ENEMY_ONLY" />
  </SPELL_ABILITY>
 <AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
  <AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
  <AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
  <AI_AVAILABILITY window_step="end_of_turn" type="window" />
  <AI_AVAILABILITY type="in_response" response_source="1" />
  <AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
  <AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
  <AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
  <AI_AVAILABILITY window_step="declare_blockers" type="window" />
  <AI_AVAILABILITY window_step="end_of_turn" type="window" />
  <AI_AVAILABILITY type="in_response" response_source="1" response_target="1" />
  <AI_AVAILABILITY window_step="declare_blockers" type="window" />
  <AI_AVAILABILITY type="in_response" response_target="1" />
  <AI_AVAILABILITY type="in_response" response_source="1" />
</CARD_V2>
I put a file named "CARD_UI_TEXT.XML" with all my strings inside in "TEXT_PERMANENT". I checked and double-checked several times and everything is in the right place, I'm not making any spelling mistakes or misplacing any files, or anything like that. The code for those (I don't have Excel so I have to write the strings using Notepad) are as follows:

Code: Select all
 <Row>
    <Cell><Data ss:Type="String">MODE_BANT_ARTIFACT</Data></Cell>
    <Cell ss:Index="3"><Data ss:Type="String">Destroy target artifact.</Data></Cell>
    <Cell><Data ss:Type="String">Destroy target artifact.</Data></Cell>
    <Cell><Data ss:Type="String">Destruye el artefacto objetivo</Data></Cell>
    <Cell><Data ss:Type="String">Zerstöre ein Artefakt deiner Wahl</Data></Cell>
    <Cell><Data ss:Type="String">Distruggi un artefatto bersaglio</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">クリーチャー1体を対象とする。イゼットの魔除けはそれに2点のダメージを与える。</Data></Cell>
    <Cell><Data ss:Type="String">또는 생물 한 개를 목표로 정한다. 이젯 부적은 그 생물에게 피해 2점을 입힌다.</Data></Cell>
    <Cell><Data ss:Type="String">Талисман Иззетов наносит 2 повреждения целевому существу.</Data></Cell>
    <Cell><Data ss:Type="String">Destroy target artifact.</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">MODE_BANT_CONDEMN</Data></Cell>
    <Cell ss:Index="3"><Data ss:Type="String">Put target creature on the bottom of its owner's library.</Data></Cell>
    <Cell><Data ss:Type="String">Put target creature on the bottom of its owner's library.</Data></Cell>
    <Cell><Data ss:Type="String">Pon la criatura objetivo en el fondo de la biblioteca de su propietario</Data></Cell>
    <Cell><Data ss:Type="String">Lege eine Kreatur deiner Wahl unter die Bibliothek ihres Besitzers</Data></Cell>
    <Cell><Data ss:Type="String">Metti una creatura bersaglio in fondo al grimorio del suo proprietario</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">クリーチャー1体を対象とする。イゼットの魔除けはそれに2点のダメージを与える。</Data></Cell>
    <Cell><Data ss:Type="String">또는 생물 한 개를 목표로 정한다. 이젯 부적은 그 생물에게 피해 2점을 입힌다.</Data></Cell>
    <Cell><Data ss:Type="String">Талисман Иззетов наносит 2 повреждения целевому существу.</Data></Cell>
    <Cell><Data ss:Type="String">Put target creature on the bottom of its owner's library.</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">MODE_BANT_COUNTER</Data></Cell>
    <Cell ss:Index="3"><Data ss:Type="String">Counter target instant spell.</Data></Cell>
    <Cell><Data ss:Type="String">Counter target instant spell.</Data></Cell>
    <Cell><Data ss:Type="String">Contrarresta el hechizo instantáneo objetivo.</Data></Cell>
    <Cell><Data ss:Type="String">Neutralisiere einen Spontanzauber deiner Wahl.</Data></Cell>
    <Cell><Data ss:Type="String">Oppure neutralizza una magia istantaneo bersaglio.</Data></Cell>
    <Cell ss:Index="9"><Data ss:Type="String">クリーチャー1体を対象とする。イゼットの魔除けはそれに2点のダメージを与える。</Data></Cell>
    <Cell><Data ss:Type="String">또는 생물 한 개를 목표로 정한다. 이젯 부적은 그 생물에게 피해 2점을 입힌다.</Data></Cell>
    <Cell><Data ss:Type="String">Талисман Иззетов наносит 2 повреждения целевому существу.</Data></Cell>
    <Cell><Data ss:Type="String">Counter target instant spell.</Data></Cell>
   </Row>
Anyone know what's going on?
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 31 Aug 2013, 19:03

Do the other strings work properly? CARD_UI_TEXT.XML seems to be a very common name, you might have another XML with the same name in another WAD that's overriding yours.
< 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: 721 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 31 Aug 2013, 19:19

It turns out there was another mod with the same string file, and it was overriding mines.

Anyways, I have another quick question pertaining to MTG rules. Should Giltspire Avenger be able to target creatures that dealt damage to an ALLY in two-headed giant games?
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 31 Aug 2013, 20:35

GrovyleXShinyCelebi wrote:Anyways, I have another quick question pertaining to MTG rules. Should Giltspire Avenger be able to target creatures that dealt damage to an ALLY in two-headed giant games?
Let's see... I'm not sure... life points are in common, but if you get hit by Hypnotic Specter, your ally doesn't have to discard a card, that means that you are the only damage receiver. That's why I'd answer no. To be honest I haven't thought about that at all when I coded my own Giltspire Avenger.
< 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: 721 times

Re: Report cards error here

Postby gorem2k » 09 Sep 2013, 23:15

I'm trying to code Pyromancer's Gauntlet from M14. thought it would be easy in DotP2014 but they've removed SetAmount() from DotP2013.

Any idea what could possibly work instead of SetAmount?

Also, this code doesn't consider red planeswalkers, yet.

| Open
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[If a red instant or sorcery spell you control or a red planeswalker you control would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.]]></LOCALISED_TEXT>
    <TRIGGER value="SOURCE_DEALS_DAMAGE" simple_qualifier="objectyoucontrol" pre_trigger="1" damage_type="all">
    return (TriggerObject():GetCardType():Test(CARD_TYPE_INSTANT) or TriggerObject():GetCardType():Test(CARD_TYPE_SORCERY) ) and
    TriggerObject():GetColour():Test(COLOUR_RED)
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    Damage():SetAmount( Damage():GetAmount() + 2 )
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Report cards error here

Postby thefiremind » 10 Sep 2013, 00:10

gorem2k wrote:I'm trying to code Pyromancer's Gauntlet from M14. thought it would be easy in DotP2014 but they've removed SetAmount() from DotP2013.

Any idea what could possibly work instead of SetAmount?
A possibility is to call another DealDamageTo after saving the original amount and zero-multiplying the original damage. The problem is that unpreventable damage would become preventable this way.

A crazy idea would be to use Multiply in order to add 2... crazy because I actually made my math. :lol:
xy = x+2 => y = 1 + (2/x)
so:
Code: Select all
Damage():Multiply( 1 + 2/Damage():GetAmount() )
Theoretically, the result would always be integer, but I'm afraid that Multiply only accepts integers, so there would be a bad approximation before getting to the result.
< 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: 721 times

PreviousNext

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 51 guests


Who is online

In total there are 51 users online :: 0 registered, 0 hidden and 51 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 51 guests

Login Form