Skip to content

Commit bd5ec0b

Browse files
authored
"Malefic Selector" update
Move the cost to the cost function and simplify the selection checks a little bit.
1 parent 57ac9ce commit bd5ec0b

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

official/c18378992.lua

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--Scripted by Eerie Code
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Add 2 "Malefic" cards from the Deck to the hand
6+
--Add 2 "Malefic" cards from your Deck to your hand, except "Malefic Selector", with different names from each other and from the banished cards
77
local e1=Effect.CreateEffect(c)
88
e1:SetDescription(aux.Stringid(id,0))
99
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
@@ -17,40 +17,40 @@ function s.initial_effect(c)
1717
end
1818
s.listed_series={SET_MALEFIC}
1919
s.listed_names={id}
20-
function s.cfilter(c)
20+
function s.costfilter(c)
2121
return c:IsSetCard(SET_MALEFIC) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true)
2222
end
23-
function s.thfilter(c,g)
24-
return c:IsSetCard(SET_MALEFIC) and not c:IsCode(id) and c:IsAbleToHand() and not g:IsExists(Card.IsCode,1,nil,c:GetCode())
25-
end
2623
function s.rescon(sg,e,tp,mg)
27-
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,sg)
24+
if #sg~=2 then return false end
25+
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,sg:GetFirst():GetCode(),sg:GetNext():GetCode())
2826
return g:GetClassCount(Card.GetCode)>1
2927
end
28+
function s.thfilter(c,code1,code2)
29+
return c:IsSetCard(SET_MALEFIC) and not c:IsCode(id,code1,code2) and c:IsAbleToHand()
30+
end
3031
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
31-
e:SetLabel(100)
32-
if chk==0 then return true end
32+
e:SetLabel(-100)
33+
local g=Duel.GetMatchingGroup(s.costfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,nil)
34+
if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end
35+
local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE)
36+
Duel.Remove(rg,POS_FACEUP,REASON_COST)
37+
e:SetLabel(rg:GetFirst():GetCode(),rg:GetNext():GetCode())
3338
end
3439
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
3540
if chk==0 then
36-
if e:GetLabel()~=100 then e:SetLabel(0) return false end
37-
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,nil,tp)
38-
return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0)
41+
local res=e:GetLabel()==-100
42+
e:SetLabel(0)
43+
return res
3944
end
40-
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,nil,tp)
41-
local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE)
42-
Duel.Remove(rg,POS_FACEUP,REASON_COST)
43-
rg:KeepAlive()
44-
e:SetLabelObject(rg)
4545
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK)
4646
end
4747
function s.activate(e,tp,eg,ep,ev,re,r,rp)
48-
local rg=e:GetLabelObject()
49-
local hg=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,rg)
50-
local g=aux.SelectUnselectGroup(hg,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_ATOHAND)
51-
if #g==2 then
52-
Duel.SendtoHand(g,nil,REASON_EFFECT)
53-
Duel.ConfirmCards(1-tp,g)
48+
local code1,code2=e:GetLabel()
49+
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,code1,code2)
50+
if #g<2 then return end
51+
local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_ATOHAND)
52+
if #sg==2 then
53+
Duel.SendtoHand(sg,nil,REASON_EFFECT)
54+
Duel.ConfirmCards(1-tp,sg)
5455
end
55-
rg:DeleteGroup()
56-
end
56+
end

0 commit comments

Comments
 (0)