Changes

Jump to: navigation, search

Gladiator Beast Fort

531 bytes removed, 11 months ago
Imported revision from memcached. (text_id:"4318848")
--{{Anime card| ja_image = GladiatorBeastFort-JP- implements {{Autolink}}, {{Unlink}}, and {{Formatted link}}Anime-AV-NC.png local p | image_nc = {} GladiatorBeastFort-JP-Anime- removes all special formatting from a stringlocal function unprettify( s ) return s:gsub( '""', '' ) :gsub( "'''?", '' ) :gsub( '##', ' ' ) :gsub( ' ', ' ' )end AV-NC- formats a link2.pnglocal function prettify_link( target, txt )| ja_name = {{Ruby|剣闘獣の砦|グラディアルビースト・フォート}} if not target or target | romaji_name == '' thenGuradiaru Bīsuto Fōto return '' end if not txt or txt | trans_name == '' thenGladial Beast Fort txt | card_type = targetSpell end local plain_target | property = unprettify( target )Continuous local prettified_txt | effect_types = txt:gsub( '""'Ignition-like, '"' ):gsub( '##'Ignition-like, '<>' ):gsub( '([^&])#', '%1 §&nbsp;' ):gsub( '<>', '#' )Quick-like local link = '' if plain_target == prettified_txt then | non-- no formatting link card = ('This was not a physical card, but other "[[%sGladiator Beast]]'):format( plain_target ) else local start, _end = prettified_txt:find( plain_target, 1, true ) if start then -- only formatting is on the link boundaries (`''Foo Bar''`) link = ('%s" [[%sContinuous Spell Card]]%s'):format( prettified_txt:sub( 1, start - 1 ), plain_target, prettified_txt:sub( _end + 1 ) ) else -- formatting within the link (`''Foo Bar'' (Quux)`) link = ('/[[%sContinuous Trap Card|%sTrap Card]]'):format( plain_target, prettified_txt ) end end return linkend -- there's several things this doesn't do that it probably could/should:-- * supporting mixed lists (currently it assumes that whatever list type is used affected by the first item is the same as all other items)-- ** similarly, supporting sublists-- * allowing multiple items to be linked/formatted via multiple parameters, instead of just via a list in the first parameterfunction p.link( frame ) if frame == mw.getCurrentFrame() then args = frame:getParent().args else args = frame end  -- the gsub() is a dumb hack for the encoded apostrophe test case(s) local items = args[1[card effect|effect]] and argsof "[1]:gsub( '&amp;', '&' ) or '' -- remove any empty lines/list items from the input local lines = {} for item in mw.text.gsplit( items, '\n' ) do item = mw.text.trim( item:match( '^[*#;:]?(.-)$' ) ) if item ~= '' then table.insert( lines, item ) end end  -- if thereGladiator Beast's more than one line, grab the list character (with a fallback if there is none) local listtype = '' if #lines > 1 then listtype = (items:match( '^%s*([*#;:Assault Fort]])' ) or '*') ".. ' ' end -- format, link, and return local prettified_lines | lore = {} for _, line in ipairs( lines ) do if line:find( '[[', 1, true ) then local prettified_line = {} local post = line while postOnce per turn]]:find( 'You can [[', shuffle]] 1, true ) do local pre, target, txt = post:match( '^(card underneath this card into the [^%[Deck]]*)%; inflict 1000 [%[%s*([^effect damage|%damage]]+)%s*|?%s*(to your opponent. Once per [[^%turn]]-)%s*%]%]' ) table.insert( prettified_line, ('%s%s')if this card has no cards underneath it:format( pre and pre:gsub( 'You can place 1 "[[Gladiator Beast]]"', '"' ) or '', prettify_link( target, txt ) ) ) post = post:match( '%[[Monster Card|monster]%](from your Deck underneath this card.*)$' ) end result = ('%s%s'):format( table.concat( prettified_line )Once per turn, post:gsub( during either player'""', '"' ) ) else result = prettify_link( line ) end table.insert( prettified_lines, ('%s%s'):format( listtype, result ) ) end prettified_lines = table.concat( prettified_lines, '\n' ) turn:gsub( '%You can [%[[Cctarget][Aa]1 "Gladiator Beast" monster you [Tt][Eecontrol][Gg], then [Oo][Rractivate][Yy]:', '1 of these [[:Category:' ) :gsub( '%[%[[Ffcard effect|effects]];<br />● If the targeted monster [Ii][Llbattle][Ee]s:', 'It cannot be [[:File:' ) :gsub( '%[%[[Iidestroy][Mm]ed by that battle, also you take no [Aa][Ggbattle damage][Ee]from that battle.<br />● If the targeted monster is targeted by a card effect:', '[[:File:' )It cannot be destroyed by that effect. return prettified_linesend -- returns the target of the first link in text-- to return the entire text without any links instead, see | ja_lore = ①:1ターンに1度、このカードの下に重ねて置いたカード1枚をデッキに戻してこの効果を発動できる。相手に1000ダメージを与える。②:1ターンに1度、このカードの下に重ねて置いたカードが無い場合にこの効果を発動できる。デッキから「{{Ruby|剣闘獣|グラディアルビースト}}」モンスターカード1枚を選んでこのカードの下に重ねて置く。③:1ターンに1度、自分フィールドの「{{DelinkRuby|剣闘獣|グラディアルビースト}}」モンスター1体を対象とし、以下の効果から1つを選択してこの効果を発動できる。この効果は相手ターンでも発動できる。●対象のモンスターが戦闘を行う場合に発動できる。そのモンスターはその戦闘では破壊されず、その戦闘で発生する自分への戦闘ダメージは0になる。●対象のモンスターが効果の対象になった場合に発動できる。そのモンスターはその効果では破壊されない。function p.unlink( frame )| appears_in_av = 121, 122 if frame | archseries =Gladiator Beast| supports_archetypes = mw.getCurrentFrame() thenGladiator Beast txt | misc = frame:getParent().args[1]Limited activations else| life_points = txt = frame[1]* Damages your opponent end* Prevents battle damage return txt and ( txt:match( '%[%[:?(.-)[|%]]' ) or mw.text.trim( txt ) )action = Places cards underneath itselfend| attack = Cannot be destroyed by battle| m/s/t = Cannot be destroyed by card effectsreturn p}}

Navigation menu