Skip to content

Commit 250164a

Browse files
authored
Fix "Session Draw"
- Nil param was causing issues with performing Xyz Summon after checking if both drawn cards were monsters with the same Level - Notation/script nomenclature update
1 parent 8fcbebb commit 250164a

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

unofficial/c511001447.lua

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,52 @@
1+
--セッション・ドロー
12
--Session Draw
23
local s,id=GetID()
34
function s.initial_effect(c)
4-
--Activate
5+
--Draw 1 extra card during your next Draw Phase, then Xyz Summon 1 Xyz Monster if both drawn cards are monsters with the same Level
56
local e1=Effect.CreateEffect(c)
7+
e1:SetCategory(CATEGORY_DRAW)
68
e1:SetType(EFFECT_TYPE_ACTIVATE)
79
e1:SetCode(EVENT_FREE_CHAIN)
8-
e1:SetOperation(s.activate)
10+
e1:SetOperation(s.operation)
911
c:RegisterEffect(e1)
1012
end
11-
function s.activate(e,tp,eg,ep,ev,re,r,rp)
12-
local ph=Duel.GetCurrentPhase()
13+
function s.operation(e,tp,eg,ep,ev,re,r,rp)
1314
local e1=Effect.CreateEffect(e:GetHandler())
1415
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
1516
e1:SetProperty(EFFECT_FLAG_DELAY)
1617
e1:SetCode(EVENT_DRAW)
1718
e1:SetCountLimit(1)
18-
if Duel.IsTurnPlayer(tp) and ph==PHASE_DRAW then
19+
if Duel.IsTurnPlayer(tp) and Duel.IsPhase(PHASE_DRAW) then
1920
e1:SetLabel(Duel.GetTurnCount())
20-
e1:SetCondition(s.con)
21-
e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN,2)
21+
e1:SetCondition(function(e) return Duel.GetTurnCount()~=e:GetLabel() end)
22+
e1:SetReset(RESET_PHASE|PHASE_DRAW|RESET_SELF_TURN,2)
2223
else
23-
e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN,1)
24+
e1:SetReset(RESET_PHASE|PHASE_DRAW|RESET_SELF_TURN,1)
2425
end
25-
e1:SetOperation(s.op)
26+
e1:SetOperation(s.drawxyzop)
2627
Duel.RegisterEffect(e1,tp)
2728
end
28-
function s.con(e,tp,eg,ep,ev,re,r,rp)
29-
return Duel.GetTurnCount()~=e:GetLabel()
30-
end
3129
function s.xyzfilter(c,mg)
3230
return c:IsXyzSummonable(nil,mg,2,2)
3331
end
34-
function s.op(e,tp,eg,ep,ev,re,r,rp)
35-
if ep~=tp or Duel.GetCurrentPhase()~=PHASE_DRAW or Duel.GetTurnPlayer()~=tp
32+
function s.drawxyzop(e,tp,eg,ep,ev,re,r,rp)
33+
if ep~=tp or not Duel.IsPhase(PHASE_DRAW) or not Duel.IsTurnPlayer(tp)
3634
or (r&REASON_RULE)==0 then return end
3735
Duel.Hint(HINT_CARD,0,id)
3836
local tc1=eg:GetFirst()
3937
local tc2=Duel.GetDecktopGroup(tp,1):GetFirst()
4038
Duel.Draw(tp,1,REASON_EFFECT)
4139
if tc1 and tc2 then
42-
local g=Group.FromCards(tc1,tc2)
43-
Duel.ConfirmCards(1-tp,g)
40+
local mg=Group.FromCards(tc1,tc2)
41+
Duel.ConfirmCards(1-tp,mg)
4442
if tc1:IsMonster() and tc2:IsMonster() and tc1:GetLevel()==tc2:GetLevel() then
45-
local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g)
43+
local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
4644
if #xyzg>0 then
4745
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
4846
local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
49-
Duel.XyzSummon(tp,xyz,g,nil,2,2)
47+
Duel.XyzSummon(tp,xyz,mg,mg,2,2)
5048
end
5149
end
5250
end
5351
Duel.ShuffleHand(tp)
54-
end
52+
end

0 commit comments

Comments
 (0)