Skip to content

Commit 4918342

Browse files
authored
Fix "Lyrilusc - Ensemblue Robin"
Missing chkc for targeting/general script modernization
1 parent fa72c48 commit 4918342

File tree

1 file changed

+38
-41
lines changed

1 file changed

+38
-41
lines changed

official/c72971064.lua

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,88 +3,85 @@
33
--Scripted by The Razgriz
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Must be properly SSd before reviving
76
c:EnableReviveLimit()
8-
--Xyz Procedure
7+
--Xyz Procedure: 2+ Level 1 monsters
98
Xyz.AddProcedure(c,nil,1,2,nil,nil,99)
10-
--ATK Up
9+
--This card gains 500 ATK for each material attached to it
1110
local e1=Effect.CreateEffect(c)
1211
e1:SetType(EFFECT_TYPE_SINGLE)
1312
e1:SetCode(EFFECT_UPDATE_ATTACK)
1413
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
1514
e1:SetRange(LOCATION_MZONE)
16-
e1:SetValue(s.atkval)
15+
e1:SetValue(function(e,c) return c:GetOverlayCount()*500 end)
1716
c:RegisterEffect(e1)
18-
--Return SSd monsters to hand
17+
--Return 1 of your opponent's Special Summoned monsters to your opponent's hand
1918
local e2=Effect.CreateEffect(c)
2019
e2:SetDescription(aux.Stringid(id,0))
2120
e2:SetCategory(CATEGORY_TOHAND)
2221
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
2322
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
2423
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
2524
e2:SetRange(LOCATION_MZONE)
26-
e2:SetCondition(s.condition)
27-
e2:SetCost(s.cost)
28-
e2:SetTarget(s.target)
29-
e2:SetOperation(s.activate)
25+
e2:SetCondition(s.retopthcon)
26+
e2:SetCost(aux.dxmcostgen(1,1,nil))
27+
e2:SetTarget(s.retopthtg)
28+
e2:SetOperation(s.retopthop)
3029
c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT)
31-
--Add 1 LL monster from GY to hand
30+
--Add 1 "Lyrilusc" monster from your GY to your hand, except this card
3231
local e3=Effect.CreateEffect(c)
3332
e3:SetDescription(aux.Stringid(id,1))
34-
e3:SetCategory(CATEGORY_TOHAND)
33+
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE)
3534
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
3635
e3:SetCode(EVENT_TO_GRAVE)
3736
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
38-
e3:SetCondition(s.tgcon)
39-
e3:SetTarget(s.tgtg)
40-
e3:SetOperation(s.tgop)
37+
e3:SetCondition(s.llthcon)
38+
e3:SetTarget(s.llthtg)
39+
e3:SetOperation(s.llthop)
4140
c:RegisterEffect(e3)
4241
end
43-
s.listed_series={0xf7}
44-
function s.atkval(e,c)
45-
return c:GetOverlayCount()*500
42+
s.listed_series={SET_LYRILUSC}
43+
function s.retopthfilter(c,e,tp)
44+
return c:IsSummonPlayer(1-tp) and c:IsAbleToHand() and c:IsCanBeEffectTarget(e) and c:IsLocation(LOCATION_MZONE)
4645
end
47-
function s.cfilter(c,e,tp)
48-
return c:IsSummonPlayer(1-tp) and c:IsAbleToHand() and c:IsCanBeEffectTarget(e)
49-
and c:IsLocation(LOCATION_MZONE)
46+
function s.retopthcon(e,tp,eg,ep,ev,re,r,rp)
47+
return eg:IsExists(s.retopthfilter,1,nil,e,tp)
5048
end
51-
function s.condition(e,tp,eg,ep,ev,re,r,rp)
52-
return eg:IsExists(s.cfilter,1,nil,e,tp)
53-
end
54-
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
55-
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
56-
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
57-
end
58-
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
59-
if chk==0 then return eg:IsExists(s.cfilter,1,nil,e,tp) end
49+
function s.retopthtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
50+
if chkc then return eg:IsContains(chkc) and s.retopthfilter(chkc,e,tp) end
51+
if chk==0 then return eg:IsExists(s.retopthfilter,1,nil,e,tp) end
6052
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
61-
local g=eg:FilterSelect(tp,s.cfilter,1,1,nil,e,tp)
62-
local tc=g:GetFirst()
63-
Duel.SetTargetCard(tc)
53+
local tc=nil
54+
if #eg==1 then
55+
tc=eg:GetFirst()
56+
Duel.SetTargetCard(tc)
57+
else
58+
tc=eg:FilterSelect(tp,s.retopthfilter,1,1,nil,e,tp)
59+
Duel.SetTargetCard(tc)
60+
end
6461
Duel.SetOperationInfo(0,CATEGORY_TOHAND,tc,1,0,0)
6562
end
66-
function s.activate(e,tp,eg,ep,ev,re,r,rp)
63+
function s.retopthop(e,tp,eg,ep,ev,re,r,rp)
6764
local tc=Duel.GetFirstTarget()
6865
if tc and tc:IsRelateToEffect(e) then
6966
Duel.SendtoHand(tc,nil,REASON_EFFECT)
7067
end
7168
end
72-
function s.tgcon(e,tp,eg,ep,ev,re,r,rp)
69+
function s.llthcon(e,tp,eg,ep,ev,re,r,rp)
7370
local c=e:GetHandler()
7471
return rp==1-tp and c:GetPreviousControler()==c:GetOwner()
7572
end
76-
function s.thfilter(c)
77-
return c:IsSetCard(0xf7) and c:IsMonster() and c:IsAbleToHand()
73+
function s.llthfilter(c)
74+
return c:IsSetCard(SET_LYRILUSC) and c:IsMonster() and c:IsAbleToHand()
7875
end
79-
function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
76+
function s.llthtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
8077
local c=e:GetHandler()
81-
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc) and chkc~=c end
82-
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,c) end
78+
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.llthfilter(chkc) and chkc~=c end
79+
if chk==0 then return Duel.IsExistingTarget(s.llthfilter,tp,LOCATION_GRAVE,0,1,c) end
8380
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
84-
local tc=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,c)
81+
local tc=Duel.SelectTarget(tp,s.llthfilter,tp,LOCATION_GRAVE,0,1,1,c)
8582
Duel.SetOperationInfo(0,CATEGORY_TOHAND,tc,1,0,0)
8683
end
87-
function s.tgop(e,tp,eg,ep,ev,re,r,rp)
84+
function s.llthop(e,tp,eg,ep,ev,re,r,rp)
8885
local tc=Duel.GetFirstTarget()
8986
if tc and tc:IsRelateToEffect(e) then
9087
Duel.SendtoHand(tc,tp,REASON_EFFECT)

0 commit comments

Comments
 (0)