Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Play a card any time you could play an instant paying "plus"
Moderator: CCGHQ Admins
Play a card any time you could play an instant paying "plus"
by Zambooo » 18 Jul 2012, 21:23
I encountered this problem creating Saproling Symbiosis (http://magiccards.info/in/en/209.html). Do you think it is possible to code?
- Code: Select all
<?xml version='1.0'?>
<CARD_V2>
<FILENAME text="SAPROLING_SYMBIOSIS_24670" />
<CARDNAME text="SAPROLING_SYMBIOSIS" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Saproling Symbiosis]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Simbiosi dei Saprolingi]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="24670" />
<ARTID value="2848" />
<ARTIST name="Ciruelo" />
<CASTING_COST cost="{3}{G}" />
<TYPE metaname="Sorcery" />
<EXPANSION value="INV" />
<RARITY metaname="R" />
<STATIC_ABILITY active_zone="ZONE_HAND">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast Saproling Symbiosis any time you could cast an instant if you pay {2} more to cast it.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Puoi lanciare Simbiosi dei Saprolingi in qualunque momento in cui potresti lanciare un istantaneo se paghi {2} in più per lanciarlo.]]></LOCALISED_TEXT>
<CONTINUOUS_ACTION>
Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_FLASH, 1 )
</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="8">
if (EffectController():SorceryTime() == 0) then
Object():IncreaseCost(2)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<SPELL_ABILITY filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Put a 1/1 green Saproling creature token onto the battlefield for each creature you control.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Metti sul campo di battaglia una creatura pedina Saprolingio 1/1 verde per ogni creatura che controlli.]]></LOCALISED_TEXT>
<RESOLUTION_TIME_ACTION>
local total = 0
local filter = Object():GetFilter()
filter:Clear()
filter:SetZone( ZONE_IN_PLAY )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetController( EffectController() )
filter:NotTargetted()
total = filter:Count()
MTG():PutTokensIntoPlay( "TOKEN_SAPROLING_1_1_277461", total, EffectController() )
</RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>
</CARD_V2>
Last edited by Zambooo on 19 Jul 2012, 13:25, edited 3 times in total.
Re: Play a card any time you could play an instant paying "p
by thefiremind » 18 Jul 2012, 22:07
This is a possible idea:
There are no examples of SorceryTime usage, but I hope I got it right. Please let me know if it works.
- Code: Select all
<STATIC_ABILITY active_zone="ZONE_HAND">
<CONTINUOUS_ACTION>
Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_FLASH, 1 )
</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="8">
if not EffectController():SorceryTime() then
Object():IncreaseCost(2)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
There are no examples of SorceryTime usage, but I hope I got it right. Please let me know if it works.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Play a card any time you could play an instant paying "p
by Zambooo » 19 Jul 2012, 10:13
Well I could actually use it as it was an instant, but it didn't make me pay the surplus. I used it in the enemy's turn paying only its cost
Re: Play a card any time you could play an instant paying "p
by thefiremind » 19 Jul 2012, 11:09
I tend to forget that most functions don't return a boolean... the correct code is the following:
- Code: Select all
<STATIC_ABILITY active_zone="ZONE_HAND">
<CONTINUOUS_ACTION>
Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_FLASH, 1 )
</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="8">
if EffectController():SorceryTime() == 0 then
Object():IncreaseCost(2)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Play a card any time you could play an instant paying "p
by Zambooo » 19 Jul 2012, 12:52
I've updated the first post with the code, but now the card is not even shown in the deck editor. Probably is a silly mistake but I didn't change anything >.>
Re: Play a card any time you could play an instant paying "p
by thefiremind » 19 Jul 2012, 12:57
- Code: Select all
<FILENAME text="SAPROLING_SYMBIOSIS_2848" />
<MULTIVERSEID value="277040" />
<ARTID value="2848" />
- Code: Select all
<FILENAME text="SAPROLING_SYMBIOSIS_277040" />
<MULTIVERSEID value="277040" />
<ARTID value="2848" />
- Code: Select all
<FILENAME text="SAPROLING_SYMBIOSIS_2848" />
<MULTIVERSEID value="2848" />
<ARTID value="277040" />
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Play a card any time you could play an instant paying "p
by Zambooo » 19 Jul 2012, 13:02
Mmmm... I think they didn't influence at all. The ID of the card is 24670. What am I supposed to do?
LoL the page reloaded only now...
Well all the cards I've made have a sort of "random multiverseID" but they still works
LoL the page reloaded only now...
Well all the cards I've made have a sort of "random multiverseID" but they still works
Re: Play a card any time you could play an instant paying "p
by thefiremind » 19 Jul 2012, 13:12
You can choose a random number if you really want to, but once you have chosen it, always use that: in the actual file name, in the FILENAME block, and in the MULTIVERSEID block. If you don't use a little order, the more cards you make, the more chances you have to create a collision. All the blocks in the XML are correctly opened and closed so you can't have done anything else wrong.Zambooo wrote:Well all the cards I've made have a sort of "random multiverseID" but they still works
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Play a card any time you could play an instant paying "p
by Zambooo » 19 Jul 2012, 13:26
I've changed it to
I corrected it: the problem was just the letter "ù" in the Italian translation
Now it works perfectly thanks!
- Code: Select all
<FILENAME text="SAPROLING_SYMBIOSIS_24670" />
<CARDNAME text="SAPROLING_SYMBIOSIS" />
<MULTIVERSEID value="24670" />
<ARTID value="2848" />
I corrected it: the problem was just the letter "ù" in the Italian translation
Now it works perfectly thanks!
Re: Play a card any time you could play an instant paying "p
by thefiremind » 19 Jul 2012, 14:19
Always save the XML files with UTF-8 encoding if you want to avoid this problem. Notepad warns you only if you include Japanese or other foreign characters, but the game also can't read "ù", "è", etc. when the default ANSI encoding is used. If you want to be super-safe, always start from a copy of an existing core XML, those are already encoded in UTF-8 and they will preserve the encoding when saved.Zambooo wrote:I corrected it: the problem was just the letter "ù" in the Italian translation
Now it works perfectly thanks!
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 32 guests