It is currently 10 May 2025, 22:27
   
Text Size

Only one spell per turn

Moderator: CCGHQ Admins

Only one spell per turn

Postby Eglin » 16 Mar 2012, 05:22

Hi guys,

I'm trying to code a card that prevents its owner from playing more than one spell per turn. What I've got looks elegant and concise to me - unfortunately, it doesn't work. Would you please take a look and try to give me a hand?

Thanks in advance,
Eglin

Code: Select all
  <TRIGGERED_ABILITY forced_skip="1" influencing_zone="any" layer="8">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You can't cast more than one spell each turn.]]></LOCALISED_TEXT>
    <TRIGGER value="SPELL_PLAYED">
    return TriggerObject():GetPlayer() == Object():GetPlayer()
    </TRIGGER>
    <FILTER>
    return OwnedByYou() and InHand()
    </FILTER>
    <CONTINUOUS_ACTION>
    FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_BE_PLAYED, 1 )
    </CONTINUOUS_ACTION>
    <DURATION>
    return (MTG():GetStep() == STEP_CLEANUP)
    </DURATION>
  </TRIGGERED_ABILITY>
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: Only one spell per turn

Postby thefiremind » 16 Mar 2012, 09:22

We talk about zone attributes again... :lol: if you look at Living Destiny, you see that its code prevents it to be played when there's no creature to reveal, by using the same characteristic you are using here. And the static ability has zone="hand".

Anyway, your idea of implementing one spell per turn is really good! I'll check if I can use it to make Ethersworn Canonist a little shorter. :)
< 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: Only one spell per turn

Postby sadlyblue » 16 Mar 2012, 09:42

And how about the cards with flashback?
This only restricts cards in hand.
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: Only one spell per turn

Postby thefiremind » 16 Mar 2012, 10:10

sadlyblue wrote:And how about the cards with flashback?
This only restricts cards in hand.
You got a point there. I forgot that I gave my Ethersworn Canonist an ability that overrides playing spells that don't come from hand because of this.
For Eglin's purpose, there is the clean and functional PLAYER_CHARACTERISTIC_CANT_CAST_SPELLS, but it can't be used for Ethersworn Canonist, for obvious reasons. #-o
I should check if the CHARACTERISTIC_CANT_BE_PLAYED can be set on cards in any zone.
< 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: Only one spell per turn

Postby Eglin » 16 Mar 2012, 19:31

thefiremind wrote:We talk about zone attributes again... :lol: if you look at Living Destiny, you see that its code prevents it to be played when there's no creature to reveal, by using the same characteristic you are using here. And the static ability has zone="hand".

Anyway, your idea of implementing one spell per turn is really good! I'll check if I can use it to make Ethersworn Canonist a little shorter. :)
I was under the impression that Living Destiny was marked as hand because Living Destiny needs to be in the hand for its static effect to be active. My card needs to be in play for its static effect to be active. I can actually see the card flash when spells are played, indicating the trigger is firing - I just can't seem to make it refuse to allow further spells. Which zones are you suggesting the card be given?

I think I might shelve what I've got now and switch to simply overriding spells after the first, like your Canonist does. Are there any side effects with that choice, like unintentional mana tapping or anything?

As an aside, I've got an issue where there's some weird interaction between this card and another one that I'm working on. Whenever I try to include both in the same deck, the game goes into some sort of endless loop whenever it tries to load the deck - this happens for both games and the in-game deck editor. It's weird, and I haven't been able to identify the cause yet.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: Only one spell per turn

Postby Eglin » 16 Mar 2012, 20:37

Here's what I ended up with:

Code: Select all
  <STATIC_ABILITY active_zone="player" influencing_zone="player">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You can't cast more than one spell each turn.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION>
    if MTG():DuelDataChest():Get_Int( DUEL_UTILITY_COMPARTMENT_ID_SPELLS_PLAYED_THIS_TURN ) &gt; 0 then
       Object():GetPlayer():GetCurrentCharacteristics():Bool_Set( PLAYER_CHARACTERISTIC_CANT_CAST_SPELLS, 1 )
    end
    </CONTINUOUS_ACTION>
    <AI_BASE_SCORE score="450" zone="in_play" />
  </STATIC_ABILITY>
It seems to work perfectly. Thanks for the help, everyone.

I am interested, still, in overriding spells like thefiremind's Canonist.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 1 guest


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 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 1 guest

Login Form