Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



Help with "Omniscience" [play nonland card without paying]
Moderator: CCGHQ Admins
Help with "Omniscience" [play nonland card without paying]
by Zambooo » 23 Jul 2012, 21:10
Here I am with another deal
I have some problem with Omniscience: the rules for this card say
"- If the card has X in its mana cost, you must choose 0 as its value."
so I cannot just reduce indefinitely the cost of all my cards. I tried to reduce the cost separately for each card, but I've realized I can't do like I did

I have some problem with Omniscience: the rules for this card say
"- If the card has X in its mana cost, you must choose 0 as its value."
so I cannot just reduce indefinitely the cost of all my cards. I tried to reduce the cost separately for each card, but I've realized I can't do like I did

- Code: Select all
<?xml version='1.0'?>
<CARD_V2>
<FILENAME text="OMNISCIENCE_288937" />
<CARDNAME text="OMNISCIENCE" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Omniscience]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Onniscenza]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="288937" />
<ARTID value="288937" />
<ARTIST name="Jason Chan" />
<CASTING_COST cost="{7}{U}{U}{U}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA["The things I once imagined would be my greatest achievements were only the first steps toward a future I can only begin to fathom."
—Jace Beleren]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA["Le cose che sognavo un tempo sarebbero le mie conquiste più grandi, se non fossero solo i primi passi verso un futuro che riesco appena a intravedere."
—Jace Beleren]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Enchantment" />
<EXPANSION value="DPG" />
<RARITY metaname="M" />
<STATIC_ABILITY filter_zone="ZONE_HAND">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast nonland cards from your hand without paying their mana costs.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Puoi lanciare carte non terra dalla tua mano senza pagare il loro costo di mana.]]></LOCALISED_TEXT>
<FILTER>
local filteredCard = FilteredCard()
local objectPlayer = Object():GetPlayer()
return (FilteredCard():GetCardType():Test( CARD_TYPE_LAND ) == 0) and (FilteredCard():GetPlayer() == Object():GetPlayer()) and (FilteredCard() ~= nil and FilteredCard():GetZone() == ZONE_HAND)
</FILTER>
<CONTINUOUS_ACTION layer="6">
if FilteredCard() ~= nil then
FilteredCard():GetCurrentCharacteristics():GrantAbility(1)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<UTILITY_ABILITY resource_id="1">
<COST type="Mana" cost="{0}" qualifier="alternate" tag="ALTERNATE_COST_PAY_0" />
</UTILITY_ABILITY>
<HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
<AI_BASE_SCORE score="900" zone="ZONE_IN_PLAY" />
<AI_BASE_SCORE score="1800" zone="ZONE_HAND" />
</CARD_V2>
Last edited by Zambooo on 24 Jul 2012, 12:43, edited 1 time in total.
Re: Help with "Omniscience" [play nonland card without payin
by thefiremind » 23 Jul 2012, 21:42
I'm not sure if "without paying their mana costs" is perfectly equal to "paying
rather than paying their mana costs", but if it is, I would take inspiration from Archive Trap:

- Code: Select all
<STATIC_ABILITY filter_zone="ZONE_HAND">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast nonland cards from your hand without paying their mana costs.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Puoi lanciare carte non terra dalla tua mano senza pagare il loro costo di mana.]]></LOCALISED_TEXT>
<FILTER>
return FilteredCard() ~= nil and
FilteredCard():GetCardType():Test( CARD_TYPE_LAND ) == 0 and
FilteredCard():GetPlayer() == Object():GetPlayer()
</FILTER>
<CONTINUOUS_ACTION layer="6">
if FilteredCard() ~= nil then
FilteredCard():GetCurrentCharacteristics():GrantAbility(1)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<UTILITY_ABILITY resource_id="1">
<COST type="Mana" cost="{0}" qualifier="alternate" tag="ALTERNATE_COST_PAY_0" />
</UTILITY_ABILITY>
Last edited by thefiremind on 17 Jan 2013, 23:00, edited 1 time in total.
< 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: Help with "Omniscience" [play nonland card without payin
by Zambooo » 24 Jul 2012, 11:33
Thanks for the suggestion, I'm gonna try it 
Well it actually worked but I got 3 option for the cost, its normal mana cost and two times "pay
". 
Okay maybe it's because I had two of it in play >.>

Well it actually worked but I got 3 option for the cost, its normal mana cost and two times "pay


Okay maybe it's because I had two of it in play >.>
Re: Help with "Omniscience" [play nonland card without payin
by thefiremind » 12 Aug 2012, 23:01
About the usage of the alternative costs, I want to add that I just coded Fist of Suns, and while paying
doesn't have any problem, if the alternative cost requires to actually pay some mana, we have to check by ourselves if it can be paid: the alternative cost doesn't imply it.
If I code Fist of Suns like this:
With this little fix on the filter:

If I code Fist of Suns like this:
- Code: Select all
<STATIC_ABILITY filter_zone="ZONE_HAND">
<FILTER>
return FilteredCard() ~= nil and
FilteredCard():GetPlayer() == EffectController() and
FilteredCard():GetCardType():Test( CARD_TYPE_LAND ) == 0
</FILTER>
<CONTINUOUS_ACTION layer="6">
if FilteredCard() ~= nil then
FilteredCard():GetCurrentCharacteristics():GrantAbility(1)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<UTILITY_ABILITY resource_id="1">
<COST type="Mana" cost="{W}{U}{B}{R}{G}" qualifier="alternate" tag="ALTERNATE_COST_PAY_WUBRG" />
</UTILITY_ABILITY>
With this little fix on the filter:
- Code: Select all
<FILTER>
if EffectController():CanAfford("{W}{U}{B}{R}{G}") == 0 then
return false
else
return FilteredCard() ~= nil and
FilteredCard():GetPlayer() == EffectController() and
FilteredCard():GetCardType():Test( CARD_TYPE_LAND ) == 0
end
</FILTER>
< 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
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests