Commit 95959307 authored by mercury233's avatar mercury233 Committed by GitHub

add aux.TurnPlayers (#2131)

parent 5b65922e
......@@ -37,8 +37,7 @@ function c11808215.dicetg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,PLAYER_ALL,1)
end
function c11808215.diceop(e,tp,eg,ep,ev,re,r,rp)
local turnp=Duel.GetTurnPlayer()
for p=turnp,1-turnp,1-turnp-turnp do
for p in aux.TurnPlayers() do
local dice=Duel.TossDice(p,1)
if dice>=1 and dice<=6 then
local g=Duel.GetMatchingGroup(Card.IsFaceup,p,LOCATION_MZONE,0,nil)
......
......@@ -25,8 +25,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
end
if #tg>0 then
Duel.BreakEffect()
local turnp=Duel.GetTurnPlayer()
for p=turnp,1-turnp,1-turnp-turnp do
for p in aux.TurnPlayers() do
local sg=tg:Filter(Card.IsControler,nil,p)
Duel.SendtoGrave(sg,REASON_RULE,p)
end
......
......@@ -53,7 +53,7 @@ end
function c36368606.spop(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject():Filter(c36368606.spfilter,nil,e,tp)
if g:GetCount()==0 then return end
for p=0,1 do
for p in aux.TurnPlayers() do
local tg=g:Filter(Card.IsControler,nil,p)
local ft=Duel.GetLocationCount(p,LOCATION_MZONE)
if ft>1 and Duel.IsPlayerAffectedByEffect(p,59822133) then ft=1 end
......
......@@ -46,7 +46,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then
local bk=true
for p=tp,1-tp,1-tp-tp do
for p in aux.TurnPlayers() do
local ct=Duel.GetFieldGroupCount(p,LOCATION_HAND,0)
if 6-ct>0 then
if bk then
......
......@@ -83,7 +83,7 @@ function s.tkop(e,tp,eg,ep,ev,re,r,rp)
or Duel.IsPlayerAffectedByEffect(tp,59822133) then
return
end
for p=tp,1-tp,1-2*tp do
for p in aux.TurnPlayers() do
local token=Duel.CreateToken(tp,id+o)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -54,6 +54,16 @@ function Auxiliary.GetXyzNumber(v)
return Auxiliary.xyz_number[id]
end
--iterator for getting playerid of current turn player and the other player
function Auxiliary.TurnPlayers()
local i=0
return function()
i=i+1
if i==1 then return Duel.GetTurnPlayer() end
if i==2 then return 1-Duel.GetTurnPlayer() end
end
end
--the chain id of the results modified by EVENT_TOSS_DICE_NEGATE
Auxiliary.idx_table=table.pack(1,2,3,4,5,6,7,8)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment