Changes

Jump to: navigation, search

Module:Card/traits/implicit Normal and Effect

1,455 bytes added, 3 months ago
make `isNormalMonster(card)` and `isEffectMonster(card)` local functions. (Need to define them before the function that invokes them for them to work this way.)
{{Navigation}}-- Trait for games that don't explicitely put "Normal"-- and don't necessarily put "Effect" next to a card's Type.
* This card can be searched by "[[Princess Cologne -- For testing purposes, make sure this is defined.if not Card then Card = require(card'Module:Card')|Princess Cologne]]", "[[Serpentine Princess]]","[[Emissary of the Afterlife]]", "[[Enchanting Fitting Room]]", "[[Rescue Rabbit]]", "[[Vampire Dragon]]", "[[Sphere of Chaos]]", "[[Dragunity Corsesca]]", "[[Chaos Zone]]", "[[Photon Veil]]" and "[[Shining Angel]]".end
* This card can be summoned from -- Take a copy of the [[Graveyard]] by "[[Limit Reverse]]"original `Card` object before this makes changes to it.local Parent = mw.clone(Card)
* You can send these to the "[[Graveyard]]" with "[[Rock Bombardment]]" then remove them from play to Summon "[[Megarock Dragon]]".
*This card is versatile in a way that it's a [[Rock]] type with [[Light]] attribute. If this card is in the graveyard it can help special summon [[Gaia Plate the Earth Giant]] or [[Chaos Sorcerer]].
-- -------------------------------------- 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

Navigation menu