Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Checking if a card has Protection
Moderator: CCGHQ Admins
Checking if a card has Protection
by Jspapp » 03 Jul 2012, 00:22
I'm trying to code Concerted Effort, and I've got everything down except for the part related to protection. Does anyone know of any way to check if a card has protection and/or to copy it to another card in 2013?
- Code: Select all
<?xml version='1.0'?>
<CARD_V2>
<FILENAME text="CONCERTED_EFFORT_89109" />
<CARDNAME text="CONCERTED_EFFORT" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Concerted Effort]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="89109" />
<ARTID value="A89109" />
<ARTIST name="Michael Sutfin" />
<CASTING_COST cost="{2}{W}{W}" />
<TYPE metaname="Enchantment" />
<EXPANSION value="DPG" />
<RARITY metaname="R" />
<TRIGGERED_ABILITY filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of each upkeep, all creatures you control gain flying until end of turn if a creature you control has flying. The same is true for fear, first strike, double strike, landwalk, protection, trample, and vigilance.]]></LOCALISED_TEXT>
<TRIGGER value="BEGINNING_OF_STEP">
return MTG():GetStep() == STEP_UPKEEP
</TRIGGER>
<FILTER>
return ( FilteredCard() ~= nil and
FilteredCard():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0 and
FilteredCard():GetPlayer() == EffectController() )
</FILTER>
<CONTINUOUS_ACTION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_FLYING )
local flying = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_FEAR )
local fear = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_FIRST_STRIKE )
local first_strike = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_DOUBLE_STRIKE )
local double_strike = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_FORESTWALK )
local forestwalk = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_ISLANDWALK )
local islandwalk = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_MOUNTAINWALK )
local mountainwalk = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_PLAINSWALK )
local plainswalk = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_SWAMPWALK )
local swampwalk = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_TRAMPLE )
local trample = filter:CountStopAt( 1 )
filter:Clear()
filter:SetPlayer( EffectController() )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:AddCharacteristic( CHARACTERISTIC_VIGILANCE )
local vigilance = filter:CountStopAt( 1 )
if FilteredCard() ~= nil then
local chars = FilteredCard():GetCurrentCharacteristics()
chars:Characteristic_Set( CHARACTERISTIC_FLYING, flying )
chars:Characteristic_Set( CHARACTERISTIC_FEAR, fear )
chars:Characteristic_Set( CHARACTERISTIC_FIRST_STRIKE, first_strike )
chars:Characteristic_Set( CHARACTERISTIC_DOUBLE_STRIKE, double_strike )
chars:Characteristic_Set( CHARACTERISTIC_FORESTWALK, forestwalk )
chars:Characteristic_Set( CHARACTERISTIC_ISLANDWALK, islandwalk )
chars:Characteristic_Set( CHARACTERISTIC_MOUNTAINWALK, mountainwalk )
chars:Characteristic_Set( CHARACTERISTIC_PLAINSWALK, plainswalk )
chars:Characteristic_Set( CHARACTERISTIC_SWAMPWALK, swampwalk )
chars:Characteristic_Set( CHARACTERISTIC_TRAMPLE, trample )
chars:Characteristic_Set( CHARACTERISTIC_VIGILANCE, vigilance )
end
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT" />
</TRIGGERED_ABILITY>
<AI_BASE_SCORE score="2000" zone="ZONE_IN_PLAY" />
</CARD_V2>
Re: Checking if a card has Protection
by thefiremind » 03 Jul 2012, 09:22
I would have liked to make that card, too, but I'm afraid it's impossible. Protection isn't coded as a characteristic, so it can't be checked.
< 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
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 39 guests