Skip to content

Commit 374fbf1

Browse files
authored
Update c511001857.lua
-Should only activate in response to the Spell Card in question -Script polish/modernization update
1 parent 038d593 commit 374fbf1

1 file changed

Lines changed: 18 additions & 26 deletions

File tree

unofficial/c511001857.lua

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,28 @@
22
--Last Trick
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
-- Activate
5+
--Add 1 Spell Card your opponent activated to your hand instead of it going to the GY
66
local e1=Effect.CreateEffect(c)
7+
e1:SetCategory(CATEGORY_TOHAND)
78
e1:SetType(EFFECT_TYPE_ACTIVATE)
8-
e1:SetCode(EVENT_FREE_CHAIN)
9-
e1:SetHintTiming(0,TIMING_DRAW_PHASE)
9+
e1:SetCode(EVENT_CHAINING)
10+
e1:SetCondition(s.condition)
11+
e1:SetTarget(s.target)
1012
e1:SetOperation(s.activate)
1113
c:RegisterEffect(e1)
1214
end
13-
function s.activate(e,tp,eg,ep,ev,re,r,rp)
14-
local e1=Effect.CreateEffect(e:GetHandler())
15-
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
16-
e1:SetCode(EVENT_CHAIN_ACTIVATING)
17-
e1:SetOperation(s.regop)
18-
e1:SetReset(RESET_PHASE+PHASE_END)
19-
Duel.RegisterEffect(e1,tp)
15+
function s.condition(e,tp,eg,ep,ev,re,r,rp)
16+
return rp==1-tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsSpellCard()
17+
end
18+
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
19+
local ec=re:GetHandler()
20+
if chk==0 then return ec:IsStatus(STATUS_LEAVE_CONFIRMED) end
21+
Duel.SetOperationInfo(0,CATEGORY_TOHAND,ec,1,0,0)
2022
end
21-
function s.regop(e,tp,eg,ep,ev,re,r,rp)
22-
local rc=re:GetHandler()
23-
if rp==tp or not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_SPELL) then return end
24-
local e1=Effect.CreateEffect(e:GetOwner())
25-
e1:SetCode(EVENT_LEAVE_FIELD_P)
26-
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
27-
e1:SetCondition(function(e)return e:GetHandler():GetDestination()==LOCATION_GRAVE end)
28-
e1:SetOperation(s.repop)
29-
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
30-
rc:RegisterEffect(e1)
23+
function s.activate(e,tp,eg,ep,ev,re,r,rp)
24+
local ec=re:GetHandler()
25+
if ec and not ec:IsStatus(STATUS_DESTROY_CONFIRMED) then
26+
ec:CancelToGrave()
27+
Duel.SendtoHand(ec,tp,REASON_EFFECT)
28+
end
3129
end
32-
function s.repop(e,tp,eg,ep,ev,re,r,rp)
33-
local c=e:GetHandler()
34-
local p=e:GetOwner():GetOwner()
35-
Duel.SendtoHand(c,p,REASON_EFFECT)
36-
Duel.ConfirmCards(1-p,c)
37-
end

0 commit comments

Comments
 (0)