Changes

Jump to: navigation, search

Spawn Alligator (Duel Links)

6,260 bytes removed, 1 year ago
Restoring revision 5081738 by User:Dinobot1000 on 2022-10-13 19:30:49. "update after rename"
-- <pre>{{Duel Links card| image = SpawnAlligator-DULI- @name DataEN-- @description Interface for [[Module:Data/data]]VG.png| ja_image = SpawnAlligator-DULI- @notes InternalJP-only, so farVG.png-- @author [[User:Becasita]]-- @contact [[User talk:Becasita]] --------------------- Export variable:-------------------local D | attribute = {};WATER ---------------- Load data:--------------local DATA | types = mw.loadData( 'Module:DataReptile /data' );Effectlocal NORM | atk = DATA.normalize -- mw.loadData( 'Module:Data/normalize' );2200| def = 1000-------------| level = 5-- Constants:--------------- @description--local WORD_DELIMITERS | rarity = "[%s%-_]";R ----------------------- Utility functions:----------------------- mw functions:local trim | effect_types = mw.text.trim;Trigger -- @name normalize-- @description Normalizes the input applying a specific set of rules.-- The rules are applied in case the input is of the type `string`-- @parameter {*} arg Argument to be normalized.-- @parameter {function} rules Normalization rules to apply.-- @return A generally normalized arg to be used to index the normalization table.local function normalize( arg, rules ) return type( arg ) =| lore = type( 'string' ) and rules( trim( arg ):lower() ) or nil ;end -- @name normalizeRegionLanguageMedium-- @description Normalizes During the input for region, language and medium,-- since there are dependencies between these.-- @parameter {*} arg Argument to be normalized.-- @return A normalized arg to be used to index the normalization table.local function normalizeRegionLanguageMedium( arg ) return normalize( arg, function( normalizedArg ) return normalizedArg :gsub( "[%s%-_'![End Phase]]", '' ) -- Remove a bunch of commonly used characters. :gsub( 'north', '' ) -- Remove "north" (for region and language). :gsub( 'yugioh', '' ) -- Remove "yugioh" (becuase of the medium). :gsub( 'cardgame', '' ) -- Remove "cardgame" (because of the medium). ; end );end -- @name normalizeRarity-- @description Normalizes the input for rarity.-- @parameter {*} arg Argument to be normalized.-- @return A normalized arg to be used to index the normalization table.--[[local function normalizeRarity( arg ) return normalize( arg, function( normalizedArg ) return NORM.rarityturn]] this card was [ normalizedArg :gsub( ' rare$', '' ) -- Remove " rare" at the end (and with a space before it). :gsub( "[%s%-_']", '' ) -- Remove a bunch of commonly used characters. Tribute Summon]; end );end--]] ------------------------- Methods (Interface):------------------------- @name getRegion-- @description Gets the region for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {table|nil} A region or nil.function D.getRegion( arg ) return DATA.regioned by [ NORM.region[ normalizeRegionLanguageMedium( arg ) Tributing] ];end -- @name getLanguage-- @description Gets the language for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {table|nil} A language or nil.function D.getLanguage( arg ) return DATA.languagea [ NORM.language[ NORM.region[ normalizeRegionLanguageMedium( arg ) Reptile] ] ];end -- @name getMedium-- @description Gets the language for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {table|nil} A language or nil.function D.getMedium( arg ) local normalizedArg = normalizeRegionLanguageMedium( arg ); return DATA.medium[ NORM.medium[ NORM.region[ normalizedArg Type] or normalizedArg ] ];end -- @name getEdition-- @description Gets the edition for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {string|nil} An edition or nil.function D.getEdition( arg ) return DATA.edition[ normalize( arg, function( normalizedArg ) return NORM.edition[ normalizedArg :gsub( '[%s%-_Monster Card|monster]]', '' ) -- Remove a bunch of commonly used characters. :gsub( 'edition', '' ) -- Redundant. ]; end ) ];end -- @name getRelease-- @description Gets the release for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {string|nil} A release or `nil`.function D.getRelease( arg ) return DATA.release[ normalize( arg, function( normalizedArg ) return NORM.release[ normalizedArg :gsub( '[%s%-_Target]]', '' ) -- Remove a bunch of commonly 1 monster that was used characters. :gsub( 'case', '' ) -- for "Case Topper". :gsub( 'the Tribute Summon of this card', '' ) -- for "Giant Card". :gsub( 'official', '' ) -- For "Official Proxy". ]; end ) ];end -- @name getRarity-- @description Gets the rarity for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {string|nil} A rarity or `nil`.function D.getRarity( arg ) return DATA.rarity[ normalize( arg, function( normalizedArg ) return NORM.rarity[ normalizedArg :gsub( ' rare$', '' ) -- Remove " rare" at the end (and with a space before it). :gsub( "[%s%-_'Special Summon]", '' ) -- Remove a bunch of commonly used characters. ]; end ) ];end ----------------- Anime stuff:----------------- @name getAnimeRelease-- @description Gets it from the anime release for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {string|nil} Anime release or `nil`.function D.getAnimeRelease( arg ) return DATA.anime.release[ normalize( arg, function( normalizedArg ) return NORM.anime.release[ normalizedArg :gsub( '[%s%-_Graveyard]]', '' ) -- Remove a bunch of commonly used characters. ];| ja_lore = 爬虫類族モンスターをリリースしてこのカードがアドバンス召喚したターンのエンドフェイズ時、このカードのアドバンス召喚のためにリリースしたモンスター1体を墓地から選択して自分フィールド上に特殊召喚する。 end ) ];end -- @name getAnimeSeries| releases = -- @description Gets the anime series name for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {string|nil} Anime series or `nil`.function D.getAnimeSeries( arg ) return DATA.anime.series[ normalize( arg, function( normalizedArg ) return NORM.anime.series[ normalizedArg :gsub( "[%s%-_'Duel Links release table/:!]", '' ) -- Remove a bunch of commonly used characters. :gsub( 'the', '' ) :gsub( 'ygo', '' ) :gsub( 'yugioh', '' ) ]; end ) ];end ----------------- Manga stuff:----------------- @name getMangaRelease-- @description Gets the manga release for `arg`. `nil` if not found.-- @parameter {stringheader} arg-- @return {string|nil} Manga release or `nil`.function D.getMangaRelease( arg ) return DATA.manga.release[ normalize( arg, function( normalizedArg ) return NORM.manga.release[ normalizedArg :gsub( '[%s%-_]', '' ) -- Remove a bunch of commonly used characters. ]; end ) ];end -- @name getMangaSeries-- @description Gets the manga series name for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {stringDuel Links release table|nil} Manga series or `nil`.function D.getMangaSeriestype=box|Generation Next ( arg ) return DATA.manga.series[ normalize( arg, function( normalizedArg ) return NORM.manga.series[ normalizedArg :gsub( "[%s%-_'/:!]", '' Duel Links set) -- Remove a bunch of commonly used characters. :gsub( 'the', '' ) :gsub( 'strongest', '' ) :gsub( 'ygo', '' ) :gsub( 'yugioh', '' ) ]; end ) ];end --------------------- Templates stuff:--------------------- @name getCardGalleryType-- @description Gets the `{{Card gallery}}` type for `arg`. `nil` if not found.-- @parameter {string} arg-- @return {string|nilDuel Links release table/footer} `{{Card gallery}}` possible `{{{type}}}`s.function D.getCardGalleryType( arg ) return DATA.templates[ 'Card gallery' ].types[ normalize( arg, function( normalizedArg ) return normalizedArg :gsub( "[%s%-s]", '' ) -- Remove a bunch of commonly used characters. :gsub( 'video', '' ) -- Remove "video". ; end ) ];end ------------ Return:------------ @exports `D`: Interface to interact with [[Module:Data/data]].return D;-- </pre>
Bots, mover
37,923
edits

Navigation menu