It is currently 26 Apr 2024, 17:37
   
Text Size

DOTP 2012 : How to check summoning sickness ?

Moderator: CCGHQ Admins

DOTP 2012 : How to check summoning sickness ?

Postby Persee » 15 Jan 2012, 08:06

Hello,

I try to code Paradise Mantle and it's almost finished. But I have a problem, the ability is available even if the equipped creature has summoning sickness.

| Open
Code: Select all
<?xml version='1.0'?>
<CARD_V2 custom="true">
  <FILENAME text="PARADISE MANTLE_12340069" />
  <CARDNAME text="PARADISE MANTLE" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Paradise Mantle]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="12340069" />
  <ARTID value="PARADISE MANTLE" />
  <FRAMECOLOUR name="A" />
  <COLOUR value="A" />
  <ARTIST name="Greg Hildebrandt" />
  <CASTING_COST cost="{0}" />
  <TYPE metaname="Artifact" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
  <SUB_TYPE metaname="Equipment" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
  <EXPANSION value="DPE" />
  <RARITY metaname="U" />
  <TOKEN_REGISTRATION reservation="2" type="_MANATOKEN_B_888801" />
  <TOKEN_REGISTRATION reservation="2" type="_MANATOKEN_W_888802" />
  <TOKEN_REGISTRATION reservation="2" type="_MANATOKEN_G_888803" />
  <TOKEN_REGISTRATION reservation="2" type="_MANATOKEN_R_888804" />
  <TOKEN_REGISTRATION reservation="2" type="_MANATOKEN_U_888805" />
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Blood Cultist deals 1 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}: Blood Cultist deals 1 damage to target creature or player.]]></LOCALISED_TEXT>
    <COST type="mana" cost="{0}"/>
   <AVAILABILITY>
   local parent = Object():GetParent()
    if parent ~= nil and parent:Tapped() == 0 and parent:GetCurrentCharacteristics():Bool_Get(CHARACTERISTIC_CANT_USE_ABILITIES) ~= 1 then
    return true
    else
    return false
    end
    </AVAILABILITY>
   <PLAY_TIME_ACTION>
    Object():GetPlayer():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
    </PLAY_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    Object():GetParent():Tap()
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local LNG_COLOUR = Object():GetPlayer():GetChosenColour()   
    if (LNG_COLOUR == 4) then
   ProduceMana( "U", 1 )
    end
    if (LNG_COLOUR == 3) then
   ProduceMana( "B", 1 )
    end
    if (LNG_COLOUR == 1) then
   ProduceMana( "R", 1 )
    end
    if (LNG_COLOUR == 2) then
   ProduceMana( "G", 1 )
    end
    if (LNG_COLOUR == 5) then
   ProduceMana( "W", 1 )
    end
    </RESOLUTION_TIME_ACTION>
    <AI_BASE_SCORE score="300" zone="in_play" /> 
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY sorcery_time="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {1}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
    <COST type="mana" cost="{1}" qualifier="equip" />
    <PLAY_TIME_ACTION target_choosing="1">
    ChooseTarget( "CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP" )
    </PLAY_TIME_ACTION>
    <TARGET_DETERMINATION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetController( Object():GetPlayer() )
    filter:SetZone( ZONE_IN_PLAY )
    filter:AddCardType( CARD_TYPE_CREATURE )
    local curr_parent = Object():GetParent()
    if curr_parent ~= nil then
      filter:SetCardInstance(curr_parent)
      filter:AddExtra( FILTER_EXTRA_FLIP_CARD_INSTANCE )
    end
    return TargetGoodF()
    </TARGET_DETERMINATION>
    <RESOLUTION_TIME_ACTION>
    local target = Object():GetTargetCard()
    if target ~= nil then
      Object():AttachmentFilter_Get():Clear()
      Object():AttachmentFilter_Get():AddCardType( CARD_TYPE_CREATURE )
      Object():Attach( target )
    end
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
</CARD_V2>
Is there a means to check if a creature has summoning sickness ?

Thanks for help

ps : sorry for bad english
Last edited by Persee on 15 Jan 2012, 10:54, edited 1 time in total.
User avatar
Persee
 
Posts: 168
Joined: 02 Jun 2011, 08:33
Has thanked: 42 times
Been thanked: 24 times

Re: DOTP 2012 : How to check summonig sickness ?

Postby thefiremind » 15 Jan 2012, 09:39

Just to be precise, you should tap the creature as PLAY_TIME_ACTION since it's a cost and nobody should be able to respond. Actually, nobody should respond to the effect, too, since it's a mana ability, but I don't know if it's possible (does forced_skip="1" work on an ACTIVATED_ABILITY?). Anyway, as a rule of thumb, always put the costs in PLAY_TIME_ACTIONs.

There's no specific function that checks for summoning sickness, and the only way to make this card work that comes into my mind is quite complicated: you should save in a storage every creature that ends a turn under your control (which also involves deleting creatures from the storage when they leave play or change controller!) and make the ability available only if the parent is one of them. If someone comes up with a shorter solution, feel free to suggest. :wink:

Maybe nabeshin can help you more: I saw that he coded some ability-granting equipments, but he introduced an extra card that does the job, so his method could be less intuitive to understand and copy.
< 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: DOTP 2012 : How to check summoning sickness ?

Postby Persee » 15 Jan 2012, 11:39

Thanks for the advice, I'll change to PLAY_TIME_ACTION.

I try to save the creatures which was in play at the beginning of my turn and those which have haste.

But I realize there are still problems with ability-granting equipments. Card like Null Rod (easy to code) and Act of Treason are not compatibles with my card.
I'll take a look at nabeshin's cards.
User avatar
Persee
 
Posts: 168
Joined: 02 Jun 2011, 08:33
Has thanked: 42 times
Been thanked: 24 times

Re: DOTP 2012 : How to check summoning sickness ?

Postby nabeshin » 15 Jan 2012, 20:09

Use after careful consideration. I am dissatisfied with them...

PS summoning sickness, coloured cost/colourless cost, ability in hand, grant/erase abilties - "This groan at us songs is"
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 31 times

Re: DOTP 2012 : How to check summoning sickness ?

Postby Eglin » 03 Mar 2012, 21:29

I really want Oran-Rief, the Vastwood. The only way I can think to implement it is via checking for summoning sickness. It's hard to believe that there's not a characteristic and a badge, but I guess it's possible that all that stuff is hard-coded into the game.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: DOTP 2012 : How to check summoning sickness ?

Postby thefiremind » 04 Mar 2012, 09:35

Eglin wrote:I really want Oran-Rief, the Vastwood. The only way I can think to implement it is via checking for summoning sickness. It's hard to believe that there's not a characteristic and a badge, but I guess it's possible that all that stuff is hard-coded into the game.
That card shouldn't be very hard to code. Use nabeshin's storage and save all the green creatures that enter the battlefield, erasing the storage at every end of turn. Then, when you activate it, iterate over the storage and add a +1/+1 counter to all the creatures you find there. If you don't want to use nabeshin's storage, you could find inspiration on Sengir Vampire's code: instead of saving the creatures damaged by Sengir Vampire, you save the green creatures that enter the battlefield.
< 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: DOTP 2012 : How to check summoning sickness ?

Postby Eglin » 05 Mar 2012, 18:18

thefiremind wrote:
Eglin wrote:I really want Oran-Rief, the Vastwood. The only way I can think to implement it is via checking for summoning sickness. It's hard to believe that there's not a characteristic and a badge, but I guess it's possible that all that stuff is hard-coded into the game.
That card shouldn't be very hard to code. Use nabeshin's storage and save all the green creatures that enter the battlefield, erasing the storage at every end of turn. Then, when you activate it, iterate over the storage and add a +1/+1 counter to all the creatures you find there. If you don't want to use nabeshin's storage, you could find inspiration on Sengir Vampire's code: instead of saving the creatures damaged by Sengir Vampire, you save the green creatures that enter the battlefield.
As ever, I appreciate your feedback. I feel very disadvantaged in that I'm trying to learn both LUA and this implementation simultaneously and by example. It's hard for me. I saw your reply in the other thread and can understand how Nate's storage could be very useful, but I'm afraid that I haven't yet gotten deep enough into the language to understand how to make good use of it. Similarly, after looking at the Sengir Vampire's code, I'm not 100% clear on how it works or whether or not it would be safe to reuse the same compartment identifiers. I /do/ understand, thanks to you, the big picture at least. Setup a trigger for whenever a creature comes into play, store a pointer to said creature, and when Oran taps iterate over the pointers attaching counters. Whew.

Thanks again!
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: DOTP 2012 : How to check summoning sickness ?

Postby sadlyblue » 05 Mar 2012, 20:15

I have coded something similar for presence of gond. It will check summoning sickness. But in your case, a creature with haste should get the counter also.

Anyway here's how i do it:
This clears the storage at end of turn:
Code: Select all
  <TRIGGERED_ABILITY auto_skip="1" active_zone="any" zone="any" internal="1">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_UNTAP and TriggeredForMe() and Object():GetController():MyTurn() ~= 0
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local mystore = Storage(Object())
    mystore.clear()
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
This adds the creature to the storage:
Code: Select all
  <TRIGGERED_ABILITY auto_skip="1" active_zone="any" zone="any" internal="1">
    <TRIGGER value="COMES_INTO_PLAY">
     return TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
     local mystore = Storage(Object())
     if TriggerObject():GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_HASTE ) ~= 1 then
         mystore.push(TriggerObject())
     end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
And this is the activated ability:
Code: Select all
  <ACTIVATED_ABILITY any_player="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Enchanted creature has "{T}: Put a 1/1 green Elf Warrior creature token onto the battlefield."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]></LOCALISED_TEXT>
    <COST type="Mana" cost="{0}" />
    <AVAILABILITY>
       local parent = Object():GetParent()
       local mystore = Storage(Object())
       if parent ~= nil and parent:Tapped() == 0 and parent:GetCurrentCharacteristics():Bool_Get( CHARACTERISTIC_CANT_USE_ABILITIES ) ~= 1 and MTG():EffectController() == parent:GetController() and mystore.test(parent) &lt; 0 then
          return true
       else
          return false
       end
    </AVAILABILITY>
    <RESOLUTION_TIME_ACTION>
       Object():GetParent():Tap()
       PutTokensIntoPlay( "TOKEN_ELF_WARRIOR_1_1_245024",1 )
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY behaviour="InResponseOrDuringCombatOrBeforeMyUntap" />
    <AI_BASE_SCORE score="600" zone="in_play" />
  </ACTIVATED_ABILITY>
Just remove the check for haste, change the ability to whatever you need it to do and i think your set.
Also, i used the any_player and in the availability only the creature controller can activate the ability. In Oran-Rief, the Vastwood is not needed also.
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: DOTP 2012 : How to check summoning sickness ?

Postby Eglin » 05 Mar 2012, 23:53

You, sir, rock! It will take me some time to digest this, but you can bet I will be studying it. Thank you very much for sharing.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: DOTP 2012 : How to check summoning sickness ?

Postby thefiremind » 02 Jun 2012, 11:50

I'm working on a Rebel deck and I wanted to code Knight of the Holy Nimbus. The problem was restricting the activated ability to the opponents, then I remembered that sadlyblue had to code something similar for an ability-granting Aura. And here's what I was searching for: MTG():EffectController(). This function should point to the player who uses the ability...

...but I can't seem to make it work.

If I write the availability like this:
Code: Select all
    <AVAILABILITY>
    return MTG():EffectController():GetTeam() ~= Object():GetController():GetTeam()
    </AVAILABILITY>
EffectController returns nil and MOTHER.TXT gets filled with errors.

If I write it like this:
Code: Select all
    <AVAILABILITY>
    if MTG():EffectController() ~= nil then
      if MTG():EffectController():GetTeam() ~= Object():GetController():GetTeam() then
        return true
      end
    end
    return false
    </AVAILABILITY>
there are no errors, but I can never activate it on the opponent's card and for a long time my own card glows as I could activate it on my own card, but if I try, nothing happens.

If I didn't see sadlyblue's code (did you test it, right?) I'd say that the EffectController is still undecided until the ability is on the stack and the effects are unpredictable...
< 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


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 38 guests


Who is online

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

Login Form