Gain or lose all creature types until end of turn. Help?
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.
High Quality Resources for Collectible Card Games
https://www.slightlymagic.net/forum/
https://www.slightlymagic.net/forum/viewtopic.php?f=63&t=8362
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 ^^
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