Skip to content

Commit e137cdd

Browse files
committed
"Eva" update
- Added a hint message to be shown when the player selects the card(s) to add to the hand - general script modernization
1 parent a69ca76 commit e137cdd

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

official/c40177746.lua

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,43 @@
33
--Scripted by Eerie Code
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--search
6+
--If this card is sent to the GY: You can banish up to 2 other LIGHT Fairy monsters from your field and/or GY; add the same number of Level 2 or lower LIGHT Fairy monsters with different names from your Deck to your hand, except "Eva"
77
local e1=Effect.CreateEffect(c)
88
e1:SetDescription(aux.Stringid(id,0))
99
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
1010
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
11-
e1:SetCode(EVENT_TO_GRAVE)
1211
e1:SetProperty(EFFECT_FLAG_DELAY)
12+
e1:SetCode(EVENT_TO_GRAVE)
1313
e1:SetCountLimit(1,id)
1414
e1:SetTarget(s.thtg)
1515
e1:SetOperation(s.thop)
1616
c:RegisterEffect(e1)
1717
end
1818
s.listed_names={id}
19-
function s.cfilter(c)
20-
return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemoveAsCost()
19+
function s.costfilter(c)
20+
return c:IsFaceup() and c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemoveAsCost()
2121
end
22-
function s.filter(c)
22+
function s.thfilter(c)
2323
return c:IsLevelBelow(2) and c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_LIGHT) and not c:IsCode(id) and c:IsAbleToHand()
2424
end
2525
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
26-
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,e:GetHandler())
27-
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end
28-
local dg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil)
26+
if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,e:GetHandler())
27+
and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
28+
local dg=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
2929
local ct=math.min(2,dg:GetClassCount(Card.GetCode))
3030
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
31-
local rg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,ct,e:GetHandler())
32-
local rc=Duel.Remove(rg,POS_FACEUP,REASON_COST)
33-
Duel.SetTargetParam(rc)
34-
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,rc,tp,LOCATION_DECK)
31+
local rg=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,ct,e:GetHandler())
32+
local ct=Duel.Remove(rg,POS_FACEUP,REASON_COST)
33+
Duel.SetTargetParam(ct)
34+
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,ct,tp,LOCATION_DECK)
3535
end
3636
function s.thop(e,tp,eg,ep,ev,re,r,rp)
37-
local dg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil)
37+
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
3838
local ct=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
39-
if dg:GetClassCount(Card.GetCode)==0 or dg:GetClassCount(Card.GetCode)<ct then return end
40-
local g=Group.CreateGroup()
41-
for i=1,ct do
42-
local tc=dg:Select(tp,1,1,nil):GetFirst()
43-
g:AddCard(tc)
44-
dg:Remove(Card.IsCode,nil,tc:GetCode())
39+
if #g==0 or g:GetClassCount(Card.GetCode)<ct then return end
40+
local sg=aux.SelectUnselectGroup(g,e,tp,ct,ct,aux.dncheck,1,tp,HINTMSG_ATOHAND)
41+
if #sg==ct then
42+
Duel.SendtoHand(sg,nil,REASON_EFFECT)
43+
Duel.ConfirmCards(1-tp,sg)
4544
end
46-
Duel.SendtoHand(g,nil,REASON_EFFECT)
47-
Duel.ConfirmCards(1-tp,g)
4845
end

0 commit comments

Comments
 (0)