208,538
edits
Changes
make `isNormalMonster(card)` and `isEffectMonster(card)` local functions. (Need to define them before the function that invokes them for them to work this way.)
-- -------------------------------------- Custom methods-- Methods that are only to be used within this module-- -------------------------------------- Check if the card is a Normal Monster-- @param card Card-- @return boollocal function isNormalMonster(card) -- Not a monster, can't be a Normal Monster if (not card.isMonster) then return false end -- If the Types contain an Effect, Summon or ability Type, it is not a Normal Monster for _, type in pairs(card.types) do if (TableTools.inArray({ 'Effect', 'Summon', 'Ability' }, type.category)) then return false end end -- If the card has an Effect type, it is not a Normal Monster if (#card.effectTypes > 0) then return false end -- If the card is a God card, it is not a Normal Monster if (#card.attributes and card.attributes[1].link ==Traditional Format=='DIVINE') then return false end return trueend -- Check if the card is an Effect Monster-- @param card Card-- @return bool* This local function isEffectMonster(card ) -- Not a monster, can 't be searched by "[[Sangan]]"an Effect Monster if (not card.isMonster) then return false end -- If the Types contain an Effect or ability Type, it is an Effect Monster for _, type in pairs(card.types) do if (TableTools.inArray({ 'Effect', 'Ability' }, type.category)) then return true end end -- If the card has an Effect type, it is an Effect Monster if (#card.effectTypes > 0) then return true end return falseend -- -------------------------------------- Override methods-- These methods exist in the original `Card` module-- And are having their behavior modified here.-- -------------------------------------- Override the `setData` method to change its Normal/Effect-checking logicfunction Card:setData(args) -- Call the original `setData` function Parent.setData(self, args) -- Set the "[[Last Will]]Normal" and "[[Witch of Effect" checks based on the Black Forest]]"logic in this module self.isNormalMonster = isNormalMonster(self) self.isEffectMonster = isEffectMonster(self)end return Card