22-- Performapal Corn
33local s ,id = GetID ()
44function s .initial_effect (c )
5- -- Change both it this card and a "Perfomapal" monster you control to Defense Position, and if you do, add 1 "Odd-Eyes" monster from your Deck to your hand
5+ -- Change both this card and 1 other "Perfomapal" monster you control to Defense Position, and if you do, add 1 "Odd-Eyes" monster from your Deck to your hand
66 local e1 = Effect .CreateEffect (c )
77 e1 :SetDescription (aux .Stringid (id ,0 ))
8- e1 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
9- e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
8+ e1 :SetCategory (CATEGORY_POSITION + CATEGORY_TOHAND + CATEGORY_SEARCH )
109 e1 :SetType (EFFECT_TYPE_IGNITION )
1110 e1 :SetRange (LOCATION_MZONE )
1211 e1 :SetCountLimit (1 )
13- e1 :SetCondition (function (e ) return e :GetHandler ():HasFlagEffect ( id ) end )
12+ e1 :SetCondition (function (e ) return ( e :GetHandler ():IsStatus ( STATUS_SUMMON_TURN ) or e : GetHandler (): IsStatus ( STATUS_SPSUMMON_TURN ) ) end )
1413 e1 :SetTarget (s .thtg )
1514 e1 :SetOperation (s .thop )
1615 c :RegisterEffect (e1 )
@@ -22,40 +21,29 @@ function s.initial_effect(c)
2221 e2 :SetCode (EVENT_FREE_CHAIN )
2322 e2 :SetRange (LOCATION_GRAVE )
2423 e2 :SetCondition (function (e ,tp ) return Duel .IsTurnPlayer (1 - tp ) end )
25- e2 :SetCost (s .lpcost )
26- e2 :SetTarget (s .lptg )
27- e2 :SetOperation (s .lpop )
24+ e2 :SetCost (s .reccost )
25+ e2 :SetTarget (s .rectg )
26+ e2 :SetOperation (s .recop )
2827 c :RegisterEffect (e2 )
29- aux .GlobalCheck (s ,function ()
30- local ge1 = Effect .CreateEffect (c )
31- ge1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
32- ge1 :SetCode (EVENT_SUMMON_SUCCESS )
33- ge1 :SetLabel (id )
34- ge1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
35- ge1 :SetOperation (aux .sumreg )
36- Duel .RegisterEffect (ge1 ,0 )
37- local ge2 = ge1 :Clone ()
38- ge2 :SetCode (EVENT_SPSUMMON_SUCCESS )
39- ge2 :SetLabel (id )
40- Duel .RegisterEffect (ge2 ,0 )
41- end )
4228end
4329s .listed_series = {SET_PERFORMAPAL ,SET_ODD_EYES }
4430s .listed_names = {id }
45- function s .filter (c )
31+ function s .posfilter (c )
4632 return c :IsFaceup () and c :IsSetCard (SET_PERFORMAPAL ) and c :IsAttackBelow (1000 )
4733 and c :IsPosition (POS_FACEUP_ATTACK ) and c :IsCanChangePosition ()
4834end
4935function s .thfilter (c )
5036 return c :IsSetCard (SET_ODD_EYES ) and c :IsMonster () and c :IsAbleToHand ()
5137end
5238function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
53- if chkc then return chkc :IsLocation (LOCATION_MZONE ) and chkc :IsControler (tp ) and s .filter (chkc ) and chkc ~= e :GetHandler () end
39+ local c = e :GetHandler ()
40+ if chkc then return chkc :IsLocation (LOCATION_MZONE ) and chkc :IsControler (tp ) and s .posfilter (chkc ) and chkc ~= c end
5441 if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil )
55- and e : GetHandler (): IsPosition ( POS_FACEUP_ATTACK )
56- and Duel .IsExistingTarget (s .filter ,tp ,LOCATION_MZONE ,0 ,1 ,e : GetHandler () ) end
42+ and c : IsPosition ( POS_FACEUP_ATTACK ) and c : IsCanChangePosition ()
43+ and Duel .IsExistingTarget (s .posfilter ,tp ,LOCATION_MZONE ,0 ,1 ,c ) end
5744 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_POSCHANGE )
58- local g = Duel .SelectTarget (tp ,s .filter ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,e :GetHandler ())
45+ local g = Duel .SelectTarget (tp ,s .posfilter ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,c )
46+ Duel .SetOperationInfo (0 ,CATEGORY_POSITION ,g + Group .FromCards (c ),2 ,tp ,0 )
5947 Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
6048end
6149function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
@@ -73,23 +61,23 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
7361 end
7462end
7563function s .cfilter (c )
76- return c :IsSetCard (SET_PERFORMAPAL ) and c :IsMonster () and c :IsAbleToRemoveAsCost () and not c :IsCode (id )
64+ return c :IsSetCard (SET_PERFORMAPAL ) and c :IsMonster () and c :IsAbleToRemoveAsCost () and aux . SpElimFilter ( c , true ) and not c :IsCode (id )
7765end
78- function s .lpcost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
79- if chk == 0 then return aux . bfgcost ( e , tp , eg , ep , ev , re , r , rp , 0 )
80- and Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,e : GetHandler () ) end
66+ function s .reccost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
67+ local c = e : GetHandler ( )
68+ if chk == 0 then return c : IsAbleToRemoveAsCost () and Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_MZONE | LOCATION_GRAVE ,0 ,1 ,c ) end
8169 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_REMOVE )
82- local g = Duel .SelectMatchingCard (tp ,s .cfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,e : GetHandler () )
83- g :AddCard (e : GetHandler () )
70+ local g = Duel .SelectMatchingCard (tp ,s .cfilter ,tp ,LOCATION_MZONE | LOCATION_GRAVE ,0 ,1 ,1 ,c )
71+ g :AddCard (c )
8472 Duel .Remove (g ,POS_FACEUP ,REASON_COST )
8573end
86- function s .lptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
74+ function s .rectg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
8775 if chk == 0 then return true end
8876 Duel .SetTargetPlayer (tp )
8977 Duel .SetTargetParam (500 )
9078 Duel .SetOperationInfo (0 ,CATEGORY_RECOVER ,nil ,0 ,tp ,500 )
9179end
92- function s .lpop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
80+ function s .recop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
9381 local p ,d = Duel .GetChainInfo (0 ,CHAININFO_TARGET_PLAYER ,CHAININFO_TARGET_PARAM )
9482 Duel .Recover (p ,d ,REASON_EFFECT )
9583end
0 commit comments