Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Multiple colored mana sources
Moderator: CCGHQ Admins
11 posts
• Page 1 of 1
Multiple colored mana sources
by BlindWillow » 21 Aug 2012, 05:46
I was working on an Elves deck, bound and determined to figure out Elvish Archdruid and...I finally did. Using the Cloudpost method, I played around with the coding until I thought about how one can add multiple attack SFX by separating them with a "|". I tried that with mana symbols in the mana ability and was delighted to see it work.
- Code: Select all
<STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}: Aggiungi {G} alla tua riserva di mana per ogni Elfo che controlli.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}: Erhöhe deinen Manavorrat für jeden Elfen, den du kontrollierst, um {G}.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T} : Ajoutez {G} à votre réserve pour chaque elfe que vous contrôlez.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}: Agrega {G} a tu reserva de maná por cada Elfo que controlas.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}:あなたがコントロールするエルフ1体につき、あなたのマナ・プールに{G}を加える。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{T}: 당신이 조종하는 엘프 한 개당 {G}를 당신의 마나풀에 담는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{T}: добавьте {G} в ваше хранилище маны за каждого Эльфа под вашим контролем.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{T}: Adicione {G} à sua reserva de mana para cada Elfo que você controla.]]></LOCALISED_TEXT>
<CONTINUOUS_ACTION layer="6">
local characteristics = Object():GetCurrentCharacteristics()
local filter = Object():GetFilter()
local elf_count = 0
filter:Clear()
filter:SetController( EffectController() )
filter:AddSubType(CREATURE_TYPE_ELF)
filter:SetZone(ZONE_IN_PLAY)
elf_count = filter:CountStopAt(10)
if elf_count ~= 0 then
characteristics:GrantAbility(elf_count)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<MANA_ABILITY resource_id="1" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="2" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="3" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="4" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="5" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}|{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="6" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}|{G}|{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="7" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}|{G}|{G}|{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="8" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}|{G}|{G}|{G}|{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="9" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}|{G}|{G}|{G}|{G}|{G}|{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="10" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}|{G}|{G}|{G}|{G}|{G}|{G}|{G}|{G}|{G}" />
</MANA_ABILITY>
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
Re: Multiple colored mana sources
by thefiremind » 21 Aug 2012, 09:35
Nice finding! Another bound about mana abilities has gone. 
Bloom Tender could be done with this method, but it would be very annoying to write because you should consider all the possible combinations.
Bloom Tender could be done with this method, but it would be very annoying to write because you should consider all the possible combinations.
< 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: 722 times
Re: Multiple colored mana sources
by Emashzed » 21 Aug 2012, 09:55
I was thinking about an alternative way to create these semi-complex mana abilities:
Programmatically build a string that contains the mana to produce (for(...) + string concatenation for example) and then use "old school" RESOLUTION_TIME_ACTION + ProduceMana(mystring,1) instead of a MANA_ABILITY.
This would have the advantage to save all the code repetition, and the possibility to compute much complex mana generation patterns.
Has anyone ever tried that ? Are there any disadvantages if this works ?
Programmatically build a string that contains the mana to produce (for(...) + string concatenation for example) and then use "old school" RESOLUTION_TIME_ACTION + ProduceMana(mystring,1) instead of a MANA_ABILITY.
This would have the advantage to save all the code repetition, and the possibility to compute much complex mana generation patterns.
Has anyone ever tried that ? Are there any disadvantages if this works ?
Re: Multiple colored mana sources
by thefiremind » 21 Aug 2012, 11:17
You are basically suggesting to use mana tokens, if I understood. Of course you can, and the disadvantages are well-known already (more on this here).
< 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: 722 times
Re: Multiple colored mana sources
by Emashzed » 21 Aug 2012, 12:45
Ho, silly me ! for some reason I thought ProduceMana was a core function of DOTP that wasn't related to Mana tokens. My bad.
Thanks thefiremind.
Thanks thefiremind.
Re: Multiple colored mana sources
by BlindWillow » 25 Aug 2012, 17:47
Well, it seems to only work with a single color of mana. So, no Bloom Tender (which would be tough to code anyway, as thefiremind pointed out). Oh well. All I wanted was a functioning Elvish Archdruid, which I have now. So I'm happy.
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
Re: Multiple colored mana sources
by Persee » 13 Sep 2012, 22:08
I already try without the "|" and it didn't work : viewtopic.php?f=63&t=7555
Re: Multiple colored mana sources
by nabeshin » 13 Sep 2012, 22:13
my druid works fine with this:
- Code: Select all
<STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
<CONTINUOUS_ACTION layer="6">
local filter = Object():GetFilter()
filter:Clear()
filter:SetZone( ZONE_IN_PLAY )
filter:AddSubType(CREATURE_TYPE_ELF)
filter:SetController( EffectController() )
filter:NotTargetted()
local count = filter:Count()
if count ~= 0 then
if count > 8 then
count = 8
end
Object():GetCurrentCharacteristics():GrantAbility(count)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<MANA_ABILITY resource_id="2" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="1" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="3" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}{G}{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="4" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}{G}{G}{G}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="5" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}{G}{G}{G}{G}" />
</MANA_ABILITY>
<MANA_ABILITY auto_skip="1" resource_id="6" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}{G}{G}{G}{G}{G}" />
</MANA_ABILITY>
<MANA_ABILITY auto_skip="1" resource_id="7" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}{G}{G}{G}{G}{G}{G}" />
</MANA_ABILITY>
<MANA_ABILITY auto_skip="1" resource_id="8" filter_zone="ZONE_IN_PLAY">
<PRODUCES amount="{G}{G}{G}{G}{G}{G}{G}{G}" />
</MANA_ABILITY>
Re: Multiple colored mana sources
by BlindWillow » 13 Sep 2012, 22:35
Odd. Like Persee, I also tried without the "|" and it didn't work. Now, however, it appears to. I'm almost positive I updated with the patch before testing this ability. I also switched to Theta from Skidrow to do so. Somewhere along the line, something appears to have been fixed. As long as it works one way or the other.
(Still, it might be best to stick with the "|" until we can confirm everyone can use the ability without it.)
(Still, it might be best to stick with the "|" until we can confirm everyone can use the ability without it.)
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
Re: Multiple colored mana sources
by Persee » 14 Sep 2012, 10:05
Ok it's works with Theta Version. I'll try.
Edit: It's ok but AI use the land even when I cast a spell with only one mana.
So I prefer use mana token.
Edit: It's ok but AI use the land even when I cast a spell with only one mana.
So I prefer use mana token.
11 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests