Skip to content

Commit 83d19bf

Browse files
authored
Update "Spy Hero"
-Should function along the lines of Graverobber, removed code related to sending it to the opponent's hand as that was not present in the raw card text -Script modernization updates
1 parent 8e03e72 commit 83d19bf

1 file changed

Lines changed: 32 additions & 20 deletions

File tree

unofficial/c511000485.lua

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
--潜入!スパイ・ヒーロー
12
--Spy Hero
23
local s,id=GetID()
34
function s.initial_effect(c)
@@ -12,43 +13,54 @@ function s.initial_effect(c)
1213
e1:SetOperation(s.activate)
1314
c:RegisterEffect(e1)
1415
end
15-
function s.cfilter(c)
16-
return c:IsAbleToGrave()
17-
end
1816
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
19-
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_DECK,0,2,nil) end
20-
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_DECK,0,nil):RandomSelect(tp,2)
17+
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_DECK,0,2,nil) end
18+
local g=Duel.GetMatchingGroup(Card.IsAbleToGraveAsCost,tp,LOCATION_DECK,0,nil):RandomSelect(tp,2)
2119
Duel.SendtoGrave(g,REASON_COST)
2220
end
23-
function s.filter(c)
24-
return c:IsSpell() and c:IsAbleToHand()
25-
end
2621
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
27-
if chkc then return chkc:GetLocation()==LOCATION_GRAVE and chkc:GetControler()~=tp and s.filter(chkc) end
28-
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_GRAVE,1,nil) end
22+
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and chkc:IsSpell() and chkc:IsAbleToHand() end
23+
if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsSpell,Card.IsAbleToHand),tp,0,LOCATION_GRAVE,1,nil) end
2924
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
30-
local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_GRAVE,1,1,nil)
25+
local g=Duel.SelectTarget(tp,aux.AND(Card.IsSpell,Card.IsAbleToHand),tp,0,LOCATION_GRAVE,1,1,nil)
3126
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
3227
end
3328
function s.activate(e,tp,eg,ep,ev,re,r,rp)
3429
local tc=Duel.GetFirstTarget()
35-
if tc and tc:IsRelateToEffect(e) then
30+
if tc:IsRelateToEffect(e) then
3631
Duel.SendtoHand(tc,tp,REASON_EFFECT)
3732
Duel.ConfirmCards(1-tp,tc)
33+
tc:RegisterFlagEffect(id,RESET_EVENT|RESET_TOGRAVE|RESET_REMOVE|RESET_TEMP_REMOVE|RESET_TODECK|RESET_PHASE|PHASE_END,0,1)
34+
--Send this card back to your opponent's GY if you do not use it from your hand
3835
local e1=Effect.CreateEffect(e:GetHandler())
3936
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
37+
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
4038
e1:SetCode(EVENT_PHASE+PHASE_END)
4139
e1:SetCountLimit(1)
42-
e1:SetReset(RESET_PHASE+PHASE_END)
40+
e1:SetCondition(s.tgcon)
41+
e1:SetOperation(s.tgop)
4342
e1:SetLabelObject(tc)
44-
e1:SetOperation(s.retop)
43+
e1:SetReset(RESET_EVENT|RESET_TOGRAVE|RESET_REMOVE|RESET_TEMP_REMOVE|RESET_TODECK|RESET_PHASE|PHASE_END)
4544
Duel.RegisterEffect(e1,tp)
45+
--Reset the effect if you activate the added card
46+
local e2=Effect.CreateEffect(e:GetHandler())
47+
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
48+
e2:SetCode(EVENT_CHAINING)
49+
e2:SetCondition(s.actcon)
50+
e2:SetOperation(function(e) e:Reset() end)
51+
e2:SetLabelObject(tc)
52+
e2:SetReset(RESET_PHASE|PHASE_END)
53+
Duel.RegisterEffect(e2,tp)
4654
end
4755
end
48-
function s.retop(e,tp,eg,ep,ev,re,r,rp)
56+
function s.tgcon(e,tp,eg,ep,ev,re,r,rp)
4957
local tc=e:GetLabelObject()
50-
if tc and tc:IsLocation(LOCATION_HAND|LOCATION_SZONE) and tc:IsControler(tp) then
51-
Duel.SendtoHand(tc,nil,REASON_EFFECT)
52-
Duel.ConfirmCards(tp,tc)
53-
end
54-
end
58+
return tc:GetControler()~=tc:GetOwner() and tc:GetFlagEffect(id)>0
59+
end
60+
function s.tgop(e,tp,eg,ep,ev,re,r,rp)
61+
local tc=e:GetLabelObject()
62+
Duel.SendtoGrave(tc,REASON_EFFECT)
63+
end
64+
function s.actcon(e,tp,eg,ep,ev,re,r,rp)
65+
return rp==tp and re:GetHandler()==e:GetLabelObject() and re:GetHandler():GetFlagEffect(id>0
66+
end

0 commit comments

Comments
 (0)