Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Gain or lose all creature types until end of turn. Help?
Moderator: CCGHQ Admins
Gain or lose all creature types until end of turn. Help?
by alexandreonly » 16 Oct 2012, 02:56
I want to code Amoeboid Changeling to include in my Mono Blue Allies deck (because there are no enough allies to fill the deck) but i don't know how to implement its active abilities.
- alexandreonly
- Posts: 145
- Joined: 04 Jul 2011, 17:27
- Has thanked: 0 time
- Been thanked: 8 times
Re: Gain or lose all creature types until end of turn. Help?
by Persee » 16 Oct 2012, 08:24
Use CHARACTERISTIC_CHANGELING ^^
Re: Gain or lose all creature types until end of turn. Help?
by thefiremind » 16 Oct 2012, 08:47
As I said here, it's not exactly how it should work, but it's as close as you can get.Persee wrote:Use CHARACTERISTIC_CHANGELING ^^
About losing all creature types, I made the LoseCreatureTypes function (but never used it, so it's untested):
- Code: Select all
LoseSubTypes = function(object)
-- makes object lose all sub-types
object:GetCurrentCharacteristics():SubType_GetWritable(object):Clear()
end
LoseCreatureTypes = function(object)
-- makes object lose all creature sub-types (preserving the other ones, if any)
local ncst_array = {}
local ncst_count = 0
for i=ARTIFACT_TYPE_CONTRAPTION,ARTIFACT_TYPE_FORTIFICATION do
if object:GetSubType():Test(i) ~= 0 then
ncst_array[ncst_count] = i
ncst_count = ncst_count + 1
end
end
for i=ENCHANTMENT_TYPE_AURA,ENCHANTMENT_TYPE_CURSE do
if object:GetSubType():Test(i) ~= 0 then
ncst_array[ncst_count] = i
ncst_count = ncst_count + 1
end
end
for i=LAND_TYPE_DESERT,LAND_TYPE_URZAS do
if object:GetSubType():Test(i) ~= 0 then
ncst_array[ncst_count] = i
ncst_count = ncst_count + 1
end
end
LoseSubTypes(object)
if ncst_count > 0 then
for i=0,ncst_count-1 do
AddSubTypeTo(ncst_array[i], object)
end
end
end
< 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
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests