Skip to content

Commit f0c40da

Browse files
authored
Update "Performapal Corn"
- Add position category to initial effect/position operation info to effect target function - Minor script modernization update - Used STATUS effect codes to clean-up checking for it being summoned that turn
1 parent 8eb19a8 commit f0c40da

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed

official/c33103459.lua

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
--Performapal Corn
33
local s,id=GetID()
44
function 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)
4228
end
4329
s.listed_series={SET_PERFORMAPAL,SET_ODD_EYES}
4430
s.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()
4834
end
4935
function s.thfilter(c)
5036
return c:IsSetCard(SET_ODD_EYES) and c:IsMonster() and c:IsAbleToHand()
5137
end
5238
function 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)
6048
end
6149
function 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
7462
end
7563
function 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)
7765
end
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)
8573
end
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)
9179
end
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)
9583
end

0 commit comments

Comments
 (0)