Commit 17b2fe52 authored by Aephiex's avatar Aephiex Committed by nanahira

add Auxiliary.EnableReviveLimitPendulumSummonable (#1030)

parent 74fb78bb
...@@ -2,13 +2,7 @@ ...@@ -2,13 +2,7 @@
function c16306932.initial_effect(c) function c16306932.initial_effect(c)
aux.EnablePendulumAttribute(c) aux.EnablePendulumAttribute(c)
--revive limit --revive limit
c:EnableUnsummonable() aux.EnableReviveLimitPendulumSummonable(c,LOCATION_HAND)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_REVIVE_LIMIT)
e0:SetCondition(c16306932.rvlimit)
c:RegisterEffect(e0)
--splimit --splimit
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
...@@ -33,7 +27,7 @@ function c16306932.initial_effect(c) ...@@ -33,7 +27,7 @@ function c16306932.initial_effect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_SPSUMMON_CONDITION) e3:SetCode(EFFECT_SPSUMMON_CONDITION)
e3:SetValue(c16306932.splimit) e3:SetValue(aux.FALSE)
c:RegisterEffect(e3) c:RegisterEffect(e3)
--special summon rule --special summon rule
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
...@@ -76,9 +70,6 @@ function c16306932.initial_effect(c) ...@@ -76,9 +70,6 @@ function c16306932.initial_effect(c)
e8:SetOperation(c16306932.tdop) e8:SetOperation(c16306932.tdop)
c:RegisterEffect(e8) c:RegisterEffect(e8)
end end
function c16306932.rvlimit(e)
return not e:GetHandler():IsLocation(LOCATION_HAND)
end
function c16306932.psplimit(e,c,tp,sumtp,sumpos) function c16306932.psplimit(e,c,tp,sumtp,sumpos)
return not c:IsRace(RACE_DRAGON) and bit.band(sumtp,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM return not c:IsRace(RACE_DRAGON) and bit.band(sumtp,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM
end end
...@@ -100,9 +91,6 @@ function c16306932.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -100,9 +91,6 @@ function c16306932.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end end
end end
function c16306932.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM and e:GetHandler():IsLocation(LOCATION_HAND)
end
function c16306932.hspfilter1(c,g,ft) function c16306932.hspfilter1(c,g,ft)
local rg=Group.FromCards(c) local rg=Group.FromCards(c)
local ct=ft local ct=ft
......
...@@ -134,15 +134,7 @@ function c29432356.eftg2(e,c) ...@@ -134,15 +134,7 @@ function c29432356.eftg2(e,c)
and rpz:GetFlagEffectLabel(31531170)==c:GetFieldID() and rpz:GetFlagEffectLabel(31531170)==c:GetFieldID()
end end
function c29432356.penfilter(c,e,tp,lscale,rscale) function c29432356.penfilter(c,e,tp,lscale,rscale)
local lv=0 return c:IsSetCard(0xc4) and aux.PConditionFilter(c,e,tp,lscale,rscale)
if c.pendulum_level then
lv=c.pendulum_level
else
lv=c:GetLevel()
end
return (c:IsLocation(LOCATION_HAND) or (c:IsFaceup() and c:IsType(TYPE_PENDULUM)))
and lv>lscale and lv<rscale and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,false,false)
and not c:IsForbidden() and c:IsSetCard(0xc4)
end end
function c29432356.pencon1(e,c,og) function c29432356.pencon1(e,c,og)
if c==nil then return true end if c==nil then return true end
......
...@@ -1696,8 +1696,9 @@ function Auxiliary.PConditionFilter(c,e,tp,lscale,rscale) ...@@ -1696,8 +1696,9 @@ function Auxiliary.PConditionFilter(c,e,tp,lscale,rscale)
else else
lv=c:GetLevel() lv=c:GetLevel()
end end
local bool=Auxiliary.PendulumSummonableBool(c)
return (c:IsLocation(LOCATION_HAND) or (c:IsFaceup() and c:IsType(TYPE_PENDULUM))) return (c:IsLocation(LOCATION_HAND) or (c:IsFaceup() and c:IsType(TYPE_PENDULUM)))
and lv>lscale and lv<rscale and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,false,false) and lv>lscale and lv<rscale and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,bool,bool)
and not c:IsForbidden() and not c:IsForbidden()
end end
function Auxiliary.PendCondition() function Auxiliary.PendCondition()
...@@ -1786,6 +1787,31 @@ function Auxiliary.PendOperation() ...@@ -1786,6 +1787,31 @@ function Auxiliary.PendOperation()
Duel.HintSelection(Group.FromCards(rpz)) Duel.HintSelection(Group.FromCards(rpz))
end end
end end
--enable revive limit for monsters that are also pendulum sumonable from certain locations (Odd-Eyes Revolution Dragon)
function Auxiliary.EnableReviveLimitPendulumSummonable(c, loc)
if c:IsStatus(STATUS_COPYING_EFFECT) then return end
c:EnableReviveLimit()
local code=c:GetOriginalCode()
local mt=_G["c" .. code]
if loc==nil then loc=0xff end
mt.psummonable_location=loc
--complete procedure on pendulum summon success
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetOperation(Auxiliary.PSSCompleteProcedure)
c:RegisterEffect(e1)
end
function Auxiliary.PendulumSummonableBool(c)
return c.psummonable_location~=nil and c:GetLocation() & c.psummonable_location > 0
end
function Auxiliary.PSSCompleteProcedure(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsSummonType(SUMMON_TYPE_PENDULUM) then
c:CompleteProcedure()
end
end
--Link Summon --Link Summon
function Auxiliary.AddLinkProcedure(c,f,min,max,gf) function Auxiliary.AddLinkProcedure(c,f,min,max,gf)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
......
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