Commit 48d97d08 authored by nanahira's avatar nanahira

opponent pendulum

parent 9158b588
...@@ -88,6 +88,7 @@ end ...@@ -88,6 +88,7 @@ end
function c29432356.penop(e,tp,eg,ep,ev,re,r,rp) function c29432356.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(29432356,2))
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON) e2:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
......
...@@ -11,7 +11,8 @@ function c31531170.initial_effect(c) ...@@ -11,7 +11,8 @@ function c31531170.initial_effect(c)
end end
function c31531170.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c31531170.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
if chk==0 then return PENDULUM_CHECKLIST and PENDULUM_CHECKLIST&(0x1<<tp)~=0 and Duel.IsExistingTarget(nil,tp,0,LOCATION_PZONE,2,nil) end if not PENDULUM_CHECKLIST then PENDULUM_CHECKLIST=0 end
if chk==0 then return (PENDULUM_CHECKLIST&(0x1<<tp)==0 or Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)) and Duel.IsExistingTarget(nil,tp,0,LOCATION_PZONE,2,nil) end
local g=Duel.GetFieldGroup(tp,0,LOCATION_PZONE) local g=Duel.GetFieldGroup(tp,0,LOCATION_PZONE)
Duel.SetTargetCard(g) Duel.SetTargetCard(g)
end end
...@@ -36,6 +37,8 @@ end ...@@ -36,6 +37,8 @@ end
function c31531170.pendcon(e,c,og) function c31531170.pendcon(e,c,og)
if c==nil then return true end if c==nil then return true end
local tp=e:GetOwnerPlayer() local tp=e:GetOwnerPlayer()
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
if PENDULUM_CHECKLIST&(0x1<<tp)~=0 and #eset==0 then return false end
local rpz=Duel.GetFieldCard(1-tp,LOCATION_PZONE,1) local rpz=Duel.GetFieldCard(1-tp,LOCATION_PZONE,1)
if rpz==nil or rpz:GetFieldID()~=c:GetFlagEffectLabel(31531170) then return false end if rpz==nil or rpz:GetFieldID()~=c:GetFlagEffectLabel(31531170) then return false end
local lscale=c:GetLeftScale() local lscale=c:GetLeftScale()
...@@ -44,14 +47,14 @@ function c31531170.pendcon(e,c,og) ...@@ -44,14 +47,14 @@ function c31531170.pendcon(e,c,og)
local ft=Duel.GetLocationCountFromEx(tp) local ft=Duel.GetLocationCountFromEx(tp)
if ft<=0 then return false end if ft<=0 then return false end
if og then if og then
return og:IsExists(aux.PConditionFilter,1,nil,e,tp,lscale,rscale) return og:IsExists(aux.PConditionFilter,1,nil,e,tp,lscale,rscale,eset)
else else
return Duel.IsExistingMatchingCard(aux.PConditionFilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,lscale,rscale) return Duel.IsExistingMatchingCard(aux.PConditionFilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,lscale,rscale,eset)
end end
end end
function c31531170.pendop(e,tp,eg,ep,ev,re,r,rp,c,sg,og) function c31531170.pendop(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
Duel.Hint(HINT_CARD,0,31531170)
local tp=e:GetOwnerPlayer() local tp=e:GetOwnerPlayer()
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
local rpz=Duel.GetFieldCard(1-tp,LOCATION_PZONE,1) local rpz=Duel.GetFieldCard(1-tp,LOCATION_PZONE,1)
local lscale=c:GetLeftScale() local lscale=c:GetLeftScale()
local rscale=rpz:GetRightScale() local rscale=rpz:GetRightScale()
...@@ -60,16 +63,43 @@ function c31531170.pendop(e,tp,eg,ep,ev,re,r,rp,c,sg,og) ...@@ -60,16 +63,43 @@ function c31531170.pendop(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local ect=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and c29724053[tp] local ect=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and c29724053[tp]
if ect~=nil then ft=math.min(ft,ect) end if ect~=nil then ft=math.min(ft,ect) end
local tg=nil
if og then if og then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) tg=og:Filter(Card.IsLocation,nil,LOCATION_EXTRA):Filter(aux.PConditionFilter,nil,e,tp,lscale,rscale,eset)
local g=og:FilterSelect(tp,aux.PConditionFilter,1,ft,nil,e,tp,lscale,rscale)
sg:Merge(g)
else else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) tg=Duel.GetMatchingGroup(aux.PConditionFilter,tp,LOCATION_EXTRA,0,nil,e,tp,lscale,rscale,eset)
local g=Duel.SelectMatchingCard(tp,aux.PConditionFilter,tp,LOCATION_EXTRA,0,1,ft,nil,e,tp,lscale,rscale) end
sg:Merge(g) local ce=nil
local b1=PENDULUM_CHECKLIST&(0x1<<tp)==0
local b2=#eset>0
if b1 and b2 then
local options={1163}
for _,te in ipairs(eset) do
table.insert(options,te:GetDescription())
end
local op=Duel.SelectOption(tp,table.unpack(options))
if op>0 then
ce=eset[op]
end
elseif b2 and not b1 then
local options={}
for _,te in ipairs(eset) do
table.insert(options,te:GetDescription())
end
local op=Duel.SelectOption(tp,table.unpack(options))
ce=eset[op+1]
end end
PENDULUM_CHECKLIST=PENDULUM_CHECKLIST|(0x1<<tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=tg:FilterSelect(tp,aux.PConditionExtraFilterSpecific,0,ft,nil,e,tp,lscale,rscale,ce)
if #g==0 then return end
if ce then
Duel.Hint(HINT_CARD,0,ce:GetOwner():GetOriginalCode())
ce:Reset()
else
PENDULUM_CHECKLIST=PENDULUM_CHECKLIST|(0x1<<tp)
end
Duel.Hint(HINT_CARD,0,31531170)
sg:Merge(g)
Duel.HintSelection(Group.FromCards(c)) Duel.HintSelection(Group.FromCards(c))
Duel.HintSelection(Group.FromCards(rpz)) Duel.HintSelection(Group.FromCards(rpz))
end end
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