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

Formal Request Thread

Moderator: CCGHQ Admins

Re: Formal Request Thread

Postby sumomole » 24 Jan 2014, 02:01

RiiakShiNal wrote:Though you could also do a match on the underscores and then add 1, but if for whatever reason there were starting or trailing underscores it would mess up the calculations.
thank you, I also would like to know this method and does it mean that we can distinguish each letter in card name?
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 234 times

Re: Formal Request Thread

Postby RiiakShiNal » 24 Jan 2014, 02:39

NeoAnderson wrote:I am fighting with another issue about the folow card :
Image
The card is simple to make but there is a problem about the TOKEN.
It seems that the games only supports TOKENS cards as like creature types, if i define the TOKEN only as artifact the game crash and create a minidump.
If i add the creature type it normally works.
I think i have to make that artifact token just as like an artifact card, in this way PutTokensOntoBattlefield, works.
The simple answer here is to do what I did for my mana tokens. In the token card simply leave out the <TOKEN /> tag. The only real issue is that it won't have the "token" border, but it works fine.

sumomole wrote:thank you, I also would like to know this method and does it mean that we can distinguish each letter in card name?
As for the method it was just simple regular expression pattern matching.
string.gmatch (s, pattern)
Returns an iterator function that, each time it is called, returns the next captures from pattern over the string s. If pattern specifies no captures, then the whole match is produced in each call.

As an example, the following loop will iterate over all the words from string s, printing one per line:

Code: Select all
     s = "hello world from Lua"
     for w in string.gmatch(s, "%a+") do
       print(w)
     end
The next example collects all pairs key=value from the given string into a table:

Code: Select all
     t = {}
     s = "from=world, to=Lua"
     for k, v in string.gmatch(s, "(%w+)=(%w+)") do
       t[k] = v
     end
For this function, a caret '^' at the start of a pattern does not work as an anchor, as this would prevent the iteration.

...

6.4.1 – Patterns
Character Class:

A character class is used to represent a set of characters. The following combinations are allowed in describing a character class:
  • x: (where x is not one of the magic characters ^$()%.[]*+-?) represents the character x itself.
  • .: (a dot) represents all characters.
  • %a: represents all letters.
  • %c: represents all control characters.
  • %d: represents all digits.
  • %g: represents all printable characters except space.
  • %l: represents all lowercase letters.
  • %p: represents all punctuation characters.
  • %s: represents all space characters.
  • %u: represents all uppercase letters.
  • %w: represents all alphanumeric characters.
  • %x: represents all hexadecimal digits.
  • %x: (where x is any non-alphanumeric character) represents the character x. This is the standard way to escape the magic characters. Any punctuation character (even the non magic) can be preceded by a '%' when used to represent itself in a pattern.
  • [set]: represents the class which is the union of all characters in set. A range of characters can be specified by separating the end characters of the range, in ascending order, with a '-', All classes %x described above can also be used as components in set. All other characters in set represent themselves. For example, [%w_] (or [_%w]) represents all alphanumeric characters plus the underscore, [0-7] represents the octal digits, and [0-7%l%-] represents the octal digits plus the lowercase letters plus the '-' character.

    The interaction between ranges and classes is not defined. Therefore, patterns like [%a-z] or [a-%%] have no meaning.
  • [^set]: represents the complement of set, where set is interpreted as above.

For all classes represented by single letters (%a, %c, etc.), the corresponding uppercase letter represents the complement of the class. For instance, %S represents all non-space characters.

The definitions of letter, space, and other character groups depend on the current locale. In particular, the class [a-z] may not be equivalent to %l.
Pattern Item:

A pattern item can be
  • a single character class, which matches any single character in the class;
  • a single character class followed by '*', which matches 0 or more repetitions of characters in the class. These repetition items will always match the longest possible sequence;
  • a single character class followed by '+', which matches 1 or more repetitions of characters in the class. These repetition items will always match the longest possible sequence;
  • a single character class followed by '-', which also matches 0 or more repetitions of characters in the class. Unlike '*', these repetition items will always match the shortest possible sequence;
  • a single character class followed by '?', which matches 0 or 1 occurrence of a character in the class;
  • %n, for n between 1 and 9; such item matches a substring equal to the n-th captured string (see below);
  • %bxy, where x and y are two distinct characters; such item matches strings that start with x, end with y, and where the x and y are balanced. This means that, if one reads the string from left to right, counting +1 for an x and -1 for a y, the ending y is the first y where the count reaches 0. For instance, the item %b() matches expressions with balanced parentheses.
  • %f[set], a frontier pattern; such item matches an empty string at any position such that the next character belongs to set and the previous character does not belong to set. The set set is interpreted as previously described. The beginning and the end of the subject are handled as if they were the character '\0'.

Pattern:

A pattern is a sequence of pattern items. A caret '^' at the beginning of a pattern anchors the match at the beginning of the subject string. A '$' at the end of a pattern anchors the match at the end of the subject string. At other positions, '^' and '$' have no special meaning and represent themselves.
Captures:

A pattern can contain sub-patterns enclosed in parentheses; they describe captures. When a match succeeds, the substrings of the subject string that match captures are stored (captured) for future use. Captures are numbered according to their left parentheses. For instance, in the pattern "(a*(.)%w(%s*))", the part of the string matching "a*(.)%w(%s*)" is stored as the first capture (and therefore has number 1); the character matching "." is captured with number 2, and the part matching "%s*" has number 3.

As a special case, the empty capture () captures the current string position (a number). For instance, if we apply the pattern "()aa()" on the string "flaaap", there will be two captures: 3 and 5.
If you are looking to pick apart the strings letter by letter then you would probably be better off using string.len() and then something to examine each character such as string.byte() or string.sub().

For example this will iterate through each character in the card name (including underscores):
Code: Select all
local sName = Object():GetCardName()
local nLength = string.len(sName)
for i = 1, nLength do
  local nChar = string.byte(sName, i)
  local sChar = string.sub(sName, i, i)
  -- Do some comparison or processing.
end
nChar is the byte value of the character at position i and sChar is the actual character at position i.

Of course you could always combine this example with the previous example to examine each character of each word in the card name (excluding underscores).

String manipulation isn't particularly difficult in Lua it just isn't particularly useful for DotP. Though we could store a name if we used string.byte() to covert each character to a number saved all those plus the length in a data chest to save it then used the stored length to get all the values and pass them into string.char() to convert it back to a string.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby NeoAnderson » 24 Jan 2014, 03:02

RiiakShiNal wrote:The simple answer here is to do what I did for my mana tokens. In the token card simply leave out the <TOKEN /> tag. The only real issue is that it won't have the "token" border, but it works fine.
:wink: It is exactly what i was saying when i said to make it as a normal artifact, i just removed that tag and i change the ARTWORK to match the standard squared art box. :wink:

2. About ARCHETYPE issue any suggestion my skilled friend?? Do you see any possibility to make them work rule compliant?
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Formal Request Thread

Postby MC Brodie » 24 Jan 2014, 05:40

I'm looking to try and code Hex Parasite. I remember some time ago there was some talk about a way to cycle through the specific counters on a card that has multiple counters on it. I think it was relating to proliferate. Did anyone make any headway on this? I don't think Hex Parasite can be coded unless there is it can tell the type of counter on a card and can relay that information back to the user. On a side note, can Hex Parasite be used to remove time counters on a suspend card?
-----------------------------------------------------------------------
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 sumomole » 24 Jan 2014, 08:41

MC Brodie wrote:I'm looking to try and code Hex Parasite. I remember some time ago there was some talk about a way to cycle through the specific counters on a card that has multiple counters on it. I think it was relating to proliferate. Did anyone make any headway on this? I don't think Hex Parasite can be coded unless there is it can tell the type of counter on a card and can relay that information back to the user. On a side note, can Hex Parasite be used to remove time counters on a suspend card?
the answer to the last question is: no, a card on battlefield called permanent and on stack call spell, in other zone called card.

the easiest way is the proliferate code(object:GetBestOrWorstCounterType(index)) if you don't care about the exact type of coutners, index equal to 1 is the best count type on permanent, and equal to 0 is the worst. like this:
Simple Method | Open
Code: Select all
   <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[{X}{J}: Remove up to X counters from target permanent. For each counter removed this way, Hex Parasite gets +1/+0 until end of turn.]]></LOCALISED_TEXT>
    <COST mana_cost="{X}{B/P}" type="Mana" />
    <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_IS_PERMANENT, true )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
      local counter_type_value = 0
      if target:GetPlayer():GetTeam() ~= EffectController():GetTeam() then
        counter_type_value = 1
      end
      for i=0, (GetEffectX()-1) do
        local suitable_counter_type = target:GetBestOrWorstCounterType(counter_type_value)
        if suitable_counter_type == 0 then
           suitable_counter_type = target:GetBestOrWorstCounterType(1-counter_type_value)
        end
        if suitable_counter_type ~= 0 then
           EffectSource():RemoveCounters( suitable_counter_type, 1 )
            EffectDC():Int_Inc(1)
        end
      end
    end
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="7C">
    if EffectSource() ~= nil then
      local PT_value = EffectDC():Get_Int(1)
       local characteristics = EffectSource():GetCurrentCharacteristics()
       characteristics:Power_Add( PT_value )
       characteristics:Toughness_Add( 0 )
    end
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
  </ACTIVATED_ABILITY>
if you want to choose the type and number of counters, you need to refer to the card like thefiremind's Vorel of the Hull Clade, and also need to create a list of counters name, I have coded Thrull Parasite in DotP2013, maybe you can find this list in my old mod.

PS: when we code cards with add counters effect like Sphinx-Bone Wand and Xathrid Gorgon, we will use the following code:
Code: Select all
<COUNTER_REGISTRATION name="A" proliferate="B" />
A is the coutner type and B is its proliferate value that we use to judge the counter is good or bad, on the official cards, the value of good coutners is 11, in fact more precise value ​​is -1<MinusOneMinusOneCounters<0<1<PlusOnePlusOneCounters<PlusOnePlusZeroCounters<PlusZeroPlusOneCounters<2, the greater value will be considered the better. when proliferate value equal to 0, that means the proliferate code can't affect this counter type.
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 234 times

Re: Formal Request Thread

Postby RiiakShiNal » 24 Jan 2014, 13:49

NeoAnderson wrote:2. About ARCHETYPE issue any suggestion my skilled friend?? Do you see any possibility to make them work rule compliant?
Unfortunately, I do not see any way to make them rule compliant. Either you code it as an override which dissolves when it leaves play (which is not rule compliant but works for things like Snapsail Glider, but fails for things like Ana Disciple) or you code it to override permanently (except for things that flying can be detected on, which fails for Akroma's Memorial and Snapsail Glider, but could work for Ana Disciple). Either way is not rule compliant and I doubt we will be able to make them rule compliant without engine support.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby NeoAnderson » 24 Jan 2014, 14:23

RiiakShiNal wrote:
NeoAnderson wrote:2. About ARCHETYPE issue any suggestion my skilled friend?? Do you see any possibility to make them work rule compliant?
Unfortunately, I do not see any way to make them rule compliant. Either you code it as an override which dissolves when it leaves play (which is not rule compliant but works for things like Snapsail Glider, but fails for things like Ana Disciple) or you code it to override permanently (except for things that flying can be detected on, which fails for Akroma's Memorial and Snapsail Glider, but could work for Ana Disciple). Either way is not rule compliant and I doubt we will be able to make them rule compliant without engine support.
So if we would accept a partial working card which would be you choice to have less impact on MTG rules?
I mean which solution could be considered that interact in a bad way with less cards?
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Formal Request Thread

Postby RiiakShiNal » 24 Jan 2014, 15:36

NeoAnderson wrote:So if we would accept a partial working card which would be you choice to have less impact on MTG rules?
I mean which solution could be considered that interact in a bad way with less cards?
Both ways could potentially have large impacts on the rules and actual gameplay, but if I had to choose one of the approximations I would probably choose to have the effect dissolve either as it leaves play or at the end of the turn in which the Archetype left play. This would cover most situations with a relative minimum of code so there would be a minimum of conflict. Though it would still have lots of situations where it would not act properly.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby drleg3nd » 25 Jan 2014, 11:57

when will born of the god cards be available on gatherer ? i really want Kiora lol
drleg3nd
 
Posts: 528
Joined: 14 May 2012, 20:05
Has thanked: 5 times
Been thanked: 30 times

Re: Formal Request Thread

Postby NeoAnderson » 25 Jan 2014, 15:07

I want to show to my skilled friend a strange behaviour i found when i had to code the follow card :
Image
The weird thing is that when i attack with enchanted creature or the main one, all the opponent creature at a first approach are declared as blockers, but then after a while he remove all the creatures or some of them from blocking!!!
I have resolved this issue with a workaround but it is really weird.
Here you can find the card code:

Noble Quarry | Open
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="NOBLE_QUARRY_NEO_9988878" />
   <CARDNAME text="NOBLE_QUARRY" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nobile Preda]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Noble Quarry]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="9988878" />
   <ARTID value="9988878" />
   <ARTIST name="Michael C. Hayes" />
   <CASTING_COST cost="{2}{G}" />
   <TYPE metaname="Enchantment" />
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Unicorn" />
   <EXPANSION value="BNG" />
   <RARITY metaname="U" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <UTILITY_ABILITY qualifier="Alternate" active_zone="ZONE_HAND">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Bestow {5}{G} |(If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)|]]

></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Grâce {5}{G}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Concesión {5}{G}.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Göttergabe {5}{G}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Conferire {5}{G} |(Se lanci questa creatura per il suo costo di conferire, è una magia Aura con incanta creatura. Diventa una creatura se non è assegnata a una creatura.)|]]

></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[授与 {5}{G} (このカードを授与コストで唱えた場合、これはエンチャント]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[권능 {5}{G}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Дар {5}{G}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Agraciar {5}{G}]]></LOCALISED_TEXT>
      <ABILITY_TEXT tag="CARD_QUERY_OPTION_BESTOW_5G" />
      <COST mana_cost="{5}{G}" type="Mana" />
      <COST type="Generic">
         <PREREQUISITE>
       MTG():ClearFilterMark()
      local filter = ClearFilter()
      filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      filter:SetZone( ZONE_BATTLEFIELD )
     local filter_count = filter:EvaluateObjects()
     local characteristics = Object():GetCurrentCharacteristics()
     local card_type = characteristics:CardType_GetWritable()
     local sub_type = characteristics:SubType_GetWritable()
     sub_type:ClearAllOfType( CARD_TYPE_CREATURE )
     card_type:Clear()
     card_type:Add( CARD_TYPE_ENCHANTMENT )
     sub_type:Add( ENCHANTMENT_TYPE_AURA )
             for i=0,filter_count-1 do
                local permanent = filter:GetNthEvaluatedObject(i)
                if permanent:GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHROUD ) == false then
                   if Object():CanAttachTo(permanent) then
                      permanent:MarkForFilter()
                   end
                end
             end
             filter:SetMarkedObjectsOnly()
      local count = filter:Count()
      if count &gt; 0 then
        sub_type:ClearAllOfType( CARD_TYPE_ENCHANTMENT )
   card_type:Clear()
        card_type:Add( CARD_TYPE_CREATURE )
        card_type:Add( CARD_TYPE_ENCHANTMENT )
        sub_type:Add( CREATURE_TYPE_UNICORN )
       return true
      else
       return false
      end
    </PREREQUISITE>
         <RESOLUTION_TIME_ACTION>
       if  Object() ~= nil then
           local refplayer = Object():GetPlayer()
           local Chest_Id = Object():GetRef()
           local chest = refplayer:PlayerDataChest():Make_Chest(Chest_Id)
           chest:Set_CardPtr(1, Object())
          local delayDC = EffectDC():Make_Chest(1)
          delayDC:Set_CardPtr(0, Object())
          delayDC:Protect_CardPtr(0)
          MTG():CreateDelayedTrigger(1, delayDC)
       end
    </RESOLUTION_TIME_ACTION>
      </COST>
   </UTILITY_ABILITY>
   <TRIGGERED_ABILITY resource_id="1" linked_ability_group="1">
      <TRIGGER value="STATE_BASED_EFFECTS" />
      <CLEANUP fire_once="1" />
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_ENCHANT" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
       if  Object() ~= nil then
          LinkedDC():Set_Int(0,0)
          local target =  EffectDC():Get_Targets(0):Get_CardPtr(0)
          if target ~= nil  then
             if target:GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHROUD ) == false then
           if  Object():GetPlayer() ~= target:GetPlayer() then
          if target:GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_HEXPROOF ) == false then
                  LinkedDC():Set_Int(0,1)
                       LinkedDC():Set_Int(1,0)
                       local delayDC = EffectDC():Make_Chest(1)
                       delayDC:Set_CardPtr(0, target)
                       MTG():CreateDelayedTrigger(2, delayDC)
                    else
             LinkedDC():Set_Int(0,2)
                    end
                else
               LinkedDC():Set_Int(0,1)
                    LinkedDC():Set_Int(1,0)
                    local delayDC = EffectDC():Make_Chest(1)
                    delayDC:Set_CardPtr(0, target)
                    MTG():CreateDelayedTrigger(2, delayDC)
                end
           else
              LinkedDC():Set_Int(0,2)
           end 
        end
     end
  </RESOLUTION_TIME_ACTION>
      <CONTINUOUS_ACTION layer="4">
        local target =  EffectDC():Get_Targets(0):Get_CardPtr(0)
        if target ~= nil and (LinkedDC():Get_Int(0) == 1 )then
      local characteristics = EffectSource():GetCurrentCharacteristics()
          local card_type = characteristics:CardType_GetWritable()
          local sub_type = characteristics:SubType_GetWritable()
           sub_type:ClearAllOfType( CARD_TYPE_CREATURE )
      card_type:Clear()
           card_type:Add( CARD_TYPE_ENCHANTMENT )
           sub_type:Add( ENCHANTMENT_TYPE_AURA )
        end
    </CONTINUOUS_ACTION>
      <DURATION>
     local target =  EffectDC():Get_Targets(0):Get_CardPtr(0)
     if (target == nil) or (target:GetCardType():Test(CARD_TYPE_CREATURE) == false) or (LinkedDC():Get_Int(0) == 2) then
     return true
     end
    </DURATION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY resource_id="2" linked_ability_group="1" replacement_query="1">
      <TRIGGER value="STATE_BASED_EFFECTS" pre_trigger="1" />
      <CLEANUP fire_once="1" />
      <RESOLUTION_TIME_ACTION>
       if  Object() ~= nil then
          local target =  EffectDC():Get_CardPtr(0)
        if target ~= nil  then
           if target:GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_SHROUD ) == false then
         if  Object():GetPlayer() ~= target:GetPlayer() then
        if target:GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_HEXPROOF ) == false then
                     LinkedDC():Set_Int(0,3)
                  else
           LinkedDC():Set_Int(0,2)
        end
              else
        LinkedDC():Set_Int(0,3)
              end
           else
               LinkedDC():Set_Int(0,2)
           end 
        end
       end
    </RESOLUTION_TIME_ACTION>
      <CONTINUOUS_ACTION layer="4">
        local target =  EffectDC():Get_CardPtr(0)
        if target ~= nil then
           local characteristics = Object():GetCurrentCharacteristics()
             local card_type = characteristics:CardType_GetWritable()
             local sub_type = characteristics:SubType_GetWritable()
              sub_type:ClearAllOfType( CARD_TYPE_CREATURE )
         card_type:Clear()
              card_type:Add( CARD_TYPE_ENCHANTMENT )
              sub_type:Add( ENCHANTMENT_TYPE_AURA )
              if Object():CanAttachTo(target) and (LinkedDC():Get_Int(1) == 0) then
                  if (LinkedDC():Get_Int(0) == 3) then   
          Object():Attach(target)
                    LinkedDC():Set_Int(1,1)
                 end
              end
              local parent = Object():GetParent()
              if parent ~= nil then
            if parent ~= target then
                    if Object():CanAttachTo(parent) then
                  Object():Attach(parent)
                       EffectDC():Set_CardPtr(0,  parent)
                    end
                 end
              end
      end
    </CONTINUOUS_ACTION>
      <DURATION>
     local target =  EffectDC():Get_CardPtr(0)
     if (target == nil) or (target:GetCardType():Test(CARD_TYPE_CREATURE) == false) or (LinkedDC():Get_Int(0) == 2) then
     return true
     end
    </DURATION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
      <TRIGGER value="ZONECHANGE_CONSIDERED" simple_qualifier="self" to_zone="ZONE_ANY" from_zone="ZONE_BATTLEFIELD" pre_trigger="1">
if (LinkedDC():Get_Int(0) ~= 2) then
    LinkedDC():Set_Int(0,2)
end
</TRIGGER>
   </TRIGGERED_ABILITY>
<STATIC_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tutte le creature in grado di bloccare la Nobile Preda o la creatura incantata lo fanno.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[All creatures able to block Noble Quarry or enchanted creature do so. ]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="8">
    if EffectSource() ~= nil then
       local parent = EffectSource():GetParent()
       if parent == nil then
          local characteristics = EffectSource():GetCurrentCharacteristics()
         characteristics:Bool_Set( CHARACTERISTIC_ALL_CREATURES_MUST_BLOCK_THIS_IF_ABLE, 1 )
       end
    end
    </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="4">
      local parent = EffectSource():GetParent()
      if parent == nil then
   local characteristics = EffectSource():GetCurrentCharacteristics()
       local card_type = characteristics:CardType_GetWritable()
       local sub_type = characteristics:SubType_GetWritable()
        sub_type:ClearAllOfType( CARD_TYPE_ENCHANTMENT )
   card_type:Clear()
        card_type:Add( CARD_TYPE_CREATURE )
        card_type:Add( CARD_TYPE_ENCHANTMENT )
        sub_type:Add( CREATURE_TYPE_UNICORN)
      end
    </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Enchanted creature gets +1/+1.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La créature enchantée gagne +1/+1.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La criatura encantada obtiene +1/+1.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die verzauberte Kreatur erhält +1/+1.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La creatura incantata prende +1/+1.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[エンチャントされているクリーチャーは+1/+1の修整を受ける。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[부여된 생물은 +1/+1을 받는다.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Зачарованное существо получает +1/+1.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[A criatura encantada recebe +1/+1.]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="7C">
     local parent = EffectSource():GetParent()
      if parent ~= nil then
        parent:GetCurrentCharacteristics():Power_Add( 1 )
       parent:GetCurrentCharacteristics():Toughness_Add( 1 )
      end
    </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="8">
    local parent = EffectSource():GetParent()
    if parent ~= nil then
       parent:GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_ALL_CREATURES_MUST_BLOCK_THIS_IF_ABLE, 1 )
    end
    </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_1" body="MORE_INFO_BADGE_BODY_1" zone="ZONE_ANY" />
   <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" />
</CARD_V2>
ADDING THE FOLLOW CODE THE BUG IS RESOLVED

BUG FIX | Open
LOOK FORWARD FOR REVISED CODE
Last edited by NeoAnderson on 25 Jan 2014, 18:01, edited 1 time in total.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Formal Request Thread

Postby sumomole » 25 Jan 2014, 15:42

I didn't use this code in 2014, so I don't know the wrong reasons, but I'm sure Gloomwidow can't bolck Noble Quarry, so it can choose not to block.

EDIT: I also don't understand the effect of EVASION_TEST trigger, is to stop creatures other than "card" block creatures that "player" controls?
Last edited by sumomole on 25 Jan 2014, 15:58, edited 1 time in total.
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 234 times

Re: Formal Request Thread

Postby thefiremind » 25 Jan 2014, 15:56

NeoAnderson wrote:The weird thing is that when i attack with enchanted creature or the main one, all the opponent creature at a first approach are declared as blockers, but then after a while he remove all the creatures or some of them from blocking!!!
This is the same thing that happens with my transform cards. I always thought that the bug was connected to the clone effect, but your bestow code doesn't use clone effects so I have no clue. The real question is: why do official cards work when using block restrictions against the AI? Where is the difference?
< 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 NeoAnderson » 25 Jan 2014, 16:04

sumomole wrote:I didn't use this code in 2014, so I don't know the wrong reasons, but I'm sure Gloomwidow can't bolck Noble Quarry, so it can choose not to block.
About this i checked and it is not a problem, MUST BLOCK will afflict all the creatures of the opponent but each creature characteristic will be keeped, so the evasion test for Gloomwidow will still avoid it to block Noble Quarry.
sumomole wrote:EDIT: I also don't understand the effect of EVASION_TEST trigger, is to stop creatures other than "card" block creatures that "player" controls?
Nope is the opposite, in this case "card" can be Noble Quarry or the creature it is enchanting, and the trigger avoid that creatures controlled by "player" could block other creatures.
thefiremind wrote:
NeoAnderson wrote:The weird thing is that when i attack with enchanted creature or the main one, all the opponent creature at a first approach are declared as blockers, but then after a while he remove all the creatures or some of them from blocking!!!
This is the same thing that happens with my transform cards. I always thought that the bug was connected to the clone effect, but your bestow code doesn't use clone effects so I have no clue. The real question is: why do official cards work when using block restrictions against the AI? Where is the difference?
Yeah you're right my friend also because i checked the code comparing with official cards and is the same! :shock:
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Formal Request Thread

Postby sumomole » 25 Jan 2014, 16:07

NeoAnderson wrote:About this i checked and it is not a problem, MUST BLOCK will afflict all the creatures of the opponent but each creature characteristic will be keeped, so the evasion test for Gloomwidow will still avoid it to block Noble Quarry.
yes, but if there also has a flying creature attacking, Gloomwidow will have to block it.

NeoAnderson wrote:Nope is the opposite, in this case "card" can be Noble Quarry or the creature it is enchanting, and the trigger avoid that creatures controlled by "player" could block other creatures.
I remember TriggerObject is attacking creature and SecondaryObject is blocking creature.

EDIT: I'm curious about how could encounter such bug, I tested your code but it seems to run fine.
Last edited by sumomole on 25 Jan 2014, 16:41, edited 2 times in total.
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 234 times

Re: Formal Request Thread

Postby NeoAnderson » 25 Jan 2014, 16:12

sumomole wrote:
NeoAnderson wrote:About this i checked and it is not a problem, MUST BLOCK will afflict all the creatures of the opponent but each creature characteristic will be keeped, so the evasion test for Gloomwidow will still avoid it to block Noble Quarry.
yes, but if there also has a flying creature attacking, Gloomwidow will have to block it.
You're right my friend i was not thinking about this particular combination, i want to try to make a modify to check if i can adjust it. I want to change the first trigger "Attacking", to "BLOCKING", if when the first time the creature are declared as blocker, before the ai remove them, if the trigger fire, it could work.

UPDATED : RESOLVED, I HAVE CHANGED THE TRIGGER FROM ATTACKING TO BLOCKING, AND SET MUST BLOCK CONDITION ONLY TO THE CARD_INSTANCE NOW IT WORKS.
BUG FIX | Open
Code: Select all
<TRIGGERED_ABILITY replacement_effect="1">
  <TRIGGER value="BLOCKING" simple_qualifier="another" pre_trigger="1">
   local parent = EffectSource():GetParent()
    if parent ~= nil then
       return SecondaryObject() == parent
    else
       return SecondaryObject() == EffectSource()
    end
</TRIGGER>
    <FILTER filter_id="0">
      local filter = ClearFilter()
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      filter:Add( FE_CARD_INSTANCE, OP_IS, TriggerObject() )
    </FILTER>

   <RESOLUTION_TIME_ACTION>
    if EffectSource() ~= nil then
       local delayDC = EffectDC():Make_Chest(1)
       local parent = EffectSource():GetParent()
       if parent ~= nil then
          delayDC:Set_CardPtr(0, parent)
       else
          delayDC:Set_CardPtr(0, EffectSource())
       end
          delayDC:Set_PlayerPtr(1, TriggerObject():GetPlayer())
       MTG():CreateDelayedTrigger(5, delayDC)
    end
    </RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="6" filter_id="0">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_MUST_BLOCK, 1 )
    end
    </CONTINUOUS_ACTION>
      <DURATION simple_duration="UntilEOT" />

</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="5" replacement_effect="1">
    <TRIGGER value="EVASION_TEST" pre_trigger="1">
        local card = EffectDC():Get_CardPtr(0)
        local player = EffectDC():Get_PlayerPtr(1)
        if card ~= nil then
           return TriggerObject():GetPlayer() == player and SecondaryObject() ~= card
        end
    </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn"/>
</TRIGGERED_ABILITY>
Obviously this should be not necessary if the A.I. was not a an ARTIFICIAL IDIOT. :lol:
It works because when the first time the condition ALL_CREATURES_MUST_BLOCK_THIS_IF_ABLE make them to be declared as blockers, then before the A.I. :D could remove them, the trigger BLOCKING is already fired, than they receive the condition MUST_BLOCK.
At this point the EVASION Test trigger set the only avaible choice to the creature that must be blocked.
Last edited by NeoAnderson on 25 Jan 2014, 16:41, edited 1 time in total.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: No registered users and 1 guest

Main Menu

User Menu

Our Partners


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (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 1 guest

Login Form