Skip to content

Commit dd213a8

Browse files
committed
"Malefic Selector" update
- fixed script errors that would be raised if the player attempted to apply its effect using a card to copy it/apply it (e.g. Diamond Dude)
1 parent 4448a1c commit dd213a8

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

official/c18378992.lua

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
--Scripted by Eerie Code
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Activate
6+
--Add 2 "Malefic" cards from the Deck to the hand
77
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
89
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
910
e1:SetType(EFFECT_TYPE_ACTIVATE)
1011
e1:SetCode(EVENT_FREE_CHAIN)
@@ -14,36 +15,42 @@ function s.initial_effect(c)
1415
e1:SetOperation(s.activate)
1516
c:RegisterEffect(e1)
1617
end
17-
s.listed_series={0x23}
18-
s.listed_names={18378992}
18+
s.listed_series={SET_MALEFIC}
19+
s.listed_names={id}
1920
function s.cfilter(c)
20-
return c:IsSetCard(0x23) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true)
21+
return c:IsSetCard(SET_MALEFIC) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true)
2122
end
22-
function s.filter(c,g)
23-
return c:IsSetCard(0x23) and not c:IsCode(id) and c:IsAbleToHand() and not g:IsExists(Card.IsCode,1,nil,c:GetCode())
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())
2425
end
2526
function s.rescon(sg,e,tp,mg)
26-
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,sg)
27+
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,sg)
2728
return g:GetClassCount(Card.GetCode)>1
2829
end
2930
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
30-
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE+LOCATION_MZONE,0,nil,tp)
31-
if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end
31+
e:SetLabel(100)
32+
if chk==0 then return true end
33+
end
34+
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
35+
if chk==0 then
36+
if e:GetLabel()~=100 then 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)
39+
end
40+
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,nil,tp)
3241
local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE)
3342
Duel.Remove(rg,POS_FACEUP,REASON_COST)
3443
rg:KeepAlive()
3544
e:SetLabelObject(rg)
36-
end
37-
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
38-
if chk==0 then return true end
3945
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK)
4046
end
4147
function s.activate(e,tp,eg,ep,ev,re,r,rp)
4248
local rg=e:GetLabelObject()
43-
local hg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,rg)
49+
local hg=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,rg)
4450
local g=aux.SelectUnselectGroup(hg,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_ATOHAND)
4551
if #g==2 then
4652
Duel.SendtoHand(g,nil,REASON_EFFECT)
4753
Duel.ConfirmCards(1-tp,g)
4854
end
55+
rg:DeleteGroup()
4956
end

0 commit comments

Comments
 (0)