Commit 636a66d1 authored by POLYMER's avatar POLYMER

fix

parent 6d744f0e
...@@ -5313,7 +5313,6 @@ ...@@ -5313,7 +5313,6 @@
77032563 0 77032563 0
77032564 0 77032564 0
77032565 0 77032565 0
89790163 0
#limit #limit
33403513 1 33403513 1
82204250 1 82204250 1
......
...@@ -5042,7 +5042,11 @@ function cm.HTAmvop(e,tp,eg,ep,ev,re,r,rp) ...@@ -5042,7 +5042,11 @@ function cm.HTAmvop(e,tp,eg,ep,ev,re,r,rp)
e1:SetDescription(aux.Stringid(53765000,14)) e1:SetDescription(aux.Stringid(53765000,14))
if te:GetCode()==EVENT_FREE_CHAIN then if te:GetCode()==EVENT_FREE_CHAIN then
if te:IsActiveType(TYPE_TRAP+TYPE_QUICKPLAY) then e1:SetType(EFFECT_TYPE_QUICK_O) else e1:SetType(EFFECT_TYPE_IGNITION) end if te:IsActiveType(TYPE_TRAP+TYPE_QUICKPLAY) then e1:SetType(EFFECT_TYPE_QUICK_O) else e1:SetType(EFFECT_TYPE_IGNITION) end
elseif te:GetCode()==EVENT_CHAINING and te:GetProperty()&EFFECT_FLAG_DELAY==0 then e1:SetType(EFFECT_TYPE_QUICK_O) elseif te:GetCode()~=0 then e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) else e1:SetType(EFFECT_TYPE_IGNITION) end elseif te:GetCode()==EVENT_CHAINING and te:GetProperty()&EFFECT_FLAG_DELAY==0 then
if te:GetType()&EFFECT_TYPE_QUICK_F~=0 then e1:SetType(EFFECT_TYPE_QUICK_O) end
elseif te:GetCode()~=0 then
if te:GetType()&EFFECT_TYPE_TRIGGER_F~=0 then e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) end
else e1:SetType(EFFECT_TYPE_IGNITION) end
e1:SetRange(LOCATION_HAND) e1:SetRange(LOCATION_HAND)
local pro,pro2=te:GetProperty() local pro,pro2=te:GetProperty()
e1:SetProperty(pro|EFFECT_FLAG_UNCOPYABLE,pro2) e1:SetProperty(pro|EFFECT_FLAG_UNCOPYABLE,pro2)
......
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local m=53716001 local m=53716001
local cm=_G["c"..m] local cm=_G["c"..m]
cm.name="断片折光 幻想匿国" cm.name="断片折光 幻想匿国"
function cm.initial_effect(c) function cm.initial_effect(c)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE) e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE) e0:SetValue(aux.FALSE)
c:RegisterEffect(e0) c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c) local e1,e1_1,e2,e3=SNNM.ActivatedAsSpellorTrap(c,0x20004,LOCATION_EXTRA)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1,m) e1:SetCountLimit(1,m)
e1:SetCost(cm.cost) e1:SetCost(cm.cost)
e1:SetOperation(cm.op) e1:SetOperation(cm.op)
c:RegisterEffect(e1) SNNM.ActivatedAsSpellorTrapCheck(c)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_EXTRA)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget)
e3:SetCost(cm.costchk)
e3:SetOperation(cm.costop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_ADJUST)
e4:SetRange(LOCATION_EXTRA)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetLabelObject(e1)
e4:SetOperation(cm.adjustop)
c:RegisterEffect(e4)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e6:SetCode(m)
e6:SetRange(LOCATION_EXTRA)
c:RegisterEffect(e6)
Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter) Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter)
end end
function cm.chainfilter(re,tp,cid) function cm.chainfilter(re,tp,cid)
...@@ -101,267 +75,6 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -101,267 +75,6 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
e7:SetOperation(cm.spop) e7:SetOperation(cm.spop)
c:RegisterEffect(e7) c:RegisterEffect(e7)
end end
function cm.actarget(e,te,tp)
return te:GetHandler()==e:GetHandler() and te==e:GetLabelObject()
end
function cm.costchk(e,te_or_c,tp)
local fdzone=0
for i=0,4 do if Duel.CheckLocation(tp,LOCATION_SZONE,i) then fdzone=fdzone|1<<i end end
if aux.GetValueType(te_or_c)=="Effect" and te_or_c:IsHasProperty(EFFECT_FLAG_LIMIT_ZONE) then
local zone=te_or_c:GetValue()
if aux.GetValueType(c)=="function" then
zone=zone(te_or_c,tp)
end
fdzone=fdzone&zone
e:SetLabel(fdzone)
end
return fdzone>0
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local zone=e:GetLabel()
if zone==0 then Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false) else
local flag=Duel.SelectDisableField(tp,1,LOCATION_SZONE,0,~zone&0x1f00)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false,2^(math.log(flag,2)-8))
end
e:SetLabel(0)
c:CreateEffectRelation(te)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CHANGE_TYPE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(0x20004)
e0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
c:RegisterEffect(e0,true)
local te2=te:Clone()
c:RegisterEffect(te2,true)
e:SetLabelObject(te2)
te:SetType(EFFECT_TYPE_ACTIVATE)
local ev0=Duel.GetCurrentChain()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ev==ev0 end)
e1:SetOperation(cm.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_REMAIN_FIELD)
e3:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_CHAIN)
c:RegisterEffect(e3)
end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_EFFECT_ENABLED,true)
end
if e:GetCode()==EVENT_CHAIN_NEGATED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
rc:CancelToGrave(false)
end
re:Reset()
end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local re1={c:IsHasEffect(EFFECT_CANNOT_TRIGGER)}
local re2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local re3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t1,t2={},{}
for _,te1 in pairs(re1) do
table.insert(t1,te1)
if te1:GetType()==EFFECT_TYPE_SINGLE then
table.insert(t2,1)
end
if te1:GetType()==EFFECT_TYPE_EQUIP then
table.insert(t2,2)
end
if te1:GetType()==EFFECT_TYPE_FIELD then
table.insert(t2,3)
end
end
for _,te2 in pairs(re2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,te,tp) then
table.insert(t1,te2)
table.insert(t2,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(re3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,te,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,e,tp) then
table.insert(t1,te3)
table.insert(t2,5)
end
end
end
end--]]
local dc=Duel.CreateToken(tp,m+50)
local de=dc:GetActivateEffect()
local ae2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local ae3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t3,t4={},{}
for _,te2 in pairs(ae2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,de,tp) then
table.insert(t3,te2)
table.insert(t4,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(ae3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,de,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,de,tp) then
table.insert(t3,te3)
table.insert(t4,5)
end
end
end
end--]]
local ret1,ret2={},{}
for k,v1 in pairs(t1) do
local equal=false
for k,v2 in pairs(t3) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret1,v1)
table.insert(ret2,t2[k])
end
end
local ret3,ret4={},{}
for k,v1 in pairs(t3) do
local equal=false
for k,v2 in pairs(t1) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret3,v1)
table.insert(ret4,t4[k])
end
end
for k,v in pairs(ret1) do
if ret2[k]==1 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon(con,false))
end
if ret2[k]==2 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon2(con,false))
end
if ret2[k]==3 then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg(aux.TRUE,false))
elseif tg(v,c)==true then
v:SetTarget(cm.chtg(tg,false))
end
end
if ret2[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,te,tp) then
v:SetValue(cm.chval(val,false))
end
end
if ret2[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,te,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,false))
elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end
end
end
end
for k,v in pairs(ret3) do
if ret4[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,de,tp) then
v:SetValue(cm.chval(val,true))
end
end
if ret4[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,de,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,true))
elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end
end
end
end
end
function cm.chcon(_con,res)
return function(e,...)
local x=e:GetHandler()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chcon2(_con,res)
return function(e,...)
local x=e:GetHandler():GetEquipTarget()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chtg(_tg,res)
return function(e,c,...)
if c:IsHasEffect(m) then return res end
return _tg(e,c,...)
end
end
function cm.chval(_val,res)
return function(e,re,...)
local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect()
else return res end
if x and x:IsHasEffect(m) then return res end
return _val(e,re,...)
end
end
function cm.chtg2(_tg,res)
return function(e,te,...)
local x=te:GetHandler()
if x:IsHasEffect(m) then return res end
return _tg(e,te,...)
end
end
function cm.disable(e,c) function cm.disable(e,c)
local ct1=aux.GetColumn(e:GetHandler()) local ct1=aux.GetColumn(e:GetHandler())
local ct2=aux.GetColumn(c) local ct2=aux.GetColumn(c)
......
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local m=53716004 local m=53716004
local cm=_G["c"..m] local cm=_G["c"..m]
cm.name="于断片沉默的处决" cm.name="于断片沉默的处决"
function cm.initial_effect(c) function cm.initial_effect(c)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE) e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE) e0:SetValue(aux.FALSE)
c:RegisterEffect(e0) c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c) local e1,e1_1,e2,e3=SNNM.ActivatedAsSpellorTrap(c,0x20004,LOCATION_EXTRA)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1,m) e1:SetCountLimit(1,m)
e1:SetCost(cm.cost) e1:SetCost(cm.cost)
e1:SetTarget(cm.tg) e1:SetTarget(cm.tg)
e1:SetOperation(cm.op) e1:SetOperation(cm.op)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetCode(EVENT_RELEASE)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)end)
e2:SetOperation(cm.operation)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_EXTRA)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget)
e3:SetCost(cm.costchk)
e3:SetOperation(cm.costop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetDescription(aux.Stringid(m,1))
e4:SetCode(EVENT_ADJUST) e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e4:SetRange(LOCATION_EXTRA) e4:SetCode(EVENT_RELEASE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e4:SetLabelObject(e1) e4:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)end)
e4:SetOperation(cm.adjustop) e4:SetOperation(cm.operation)
c:RegisterEffect(e4) c:RegisterEffect(e4)
local e6=Effect.CreateEffect(c) SNNM.ActivatedAsSpellorTrapCheck(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e6:SetCode(m)
e6:SetRange(LOCATION_EXTRA)
c:RegisterEffect(e6)
Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter) Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter)
end end
function cm.chainfilter(re,tp,cid) function cm.chainfilter(re,tp,cid)
...@@ -105,267 +79,6 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -105,267 +79,6 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
e6:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET) e6:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
c:RegisterEffect(e6) c:RegisterEffect(e6)
end end
function cm.actarget(e,te,tp)
return te:GetHandler()==e:GetHandler() and te==e:GetLabelObject()
end
function cm.costchk(e,te_or_c,tp)
local fdzone=0
for i=0,4 do if Duel.CheckLocation(tp,LOCATION_SZONE,i) then fdzone=fdzone|1<<i end end
if aux.GetValueType(te_or_c)=="Effect" and te_or_c:IsHasProperty(EFFECT_FLAG_LIMIT_ZONE) then
local zone=te_or_c:GetValue()
if aux.GetValueType(c)=="function" then
zone=zone(te_or_c,tp)
end
fdzone=fdzone&zone
e:SetLabel(fdzone)
end
return fdzone>0
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local zone=e:GetLabel()
if zone==0 then Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false) else
local flag=Duel.SelectDisableField(tp,1,LOCATION_SZONE,0,~zone&0x1f00)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false,2^(math.log(flag,2)-8))
end
e:SetLabel(0)
c:CreateEffectRelation(te)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CHANGE_TYPE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(0x20004)
e0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
c:RegisterEffect(e0,true)
local te2=te:Clone()
c:RegisterEffect(te2,true)
e:SetLabelObject(te2)
te:SetType(EFFECT_TYPE_ACTIVATE)
local ev0=Duel.GetCurrentChain()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ev==ev0 end)
e1:SetOperation(cm.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_REMAIN_FIELD)
e3:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_CHAIN)
c:RegisterEffect(e3)
end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_EFFECT_ENABLED,true)
end
if e:GetCode()==EVENT_CHAIN_NEGATED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
rc:CancelToGrave(false)
end
re:Reset()
end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local re1={c:IsHasEffect(EFFECT_CANNOT_TRIGGER)}
local re2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local re3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t1,t2={},{}
for _,te1 in pairs(re1) do
table.insert(t1,te1)
if te1:GetType()==EFFECT_TYPE_SINGLE then
table.insert(t2,1)
end
if te1:GetType()==EFFECT_TYPE_EQUIP then
table.insert(t2,2)
end
if te1:GetType()==EFFECT_TYPE_FIELD then
table.insert(t2,3)
end
end
for _,te2 in pairs(re2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,te,tp) then
table.insert(t1,te2)
table.insert(t2,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(re3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,te,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,e,tp) then
table.insert(t1,te3)
table.insert(t2,5)
end
end
end
end--]]
local dc=Duel.CreateToken(tp,m+50)
local de=dc:GetActivateEffect()
local ae2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local ae3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t3,t4={},{}
for _,te2 in pairs(ae2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,de,tp) then
table.insert(t3,te2)
table.insert(t4,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(ae3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,de,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,de,tp) then
table.insert(t3,te3)
table.insert(t4,5)
end
end
end
end--]]
local ret1,ret2={},{}
for k,v1 in pairs(t1) do
local equal=false
for k,v2 in pairs(t3) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret1,v1)
table.insert(ret2,t2[k])
end
end
local ret3,ret4={},{}
for k,v1 in pairs(t3) do
local equal=false
for k,v2 in pairs(t1) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret3,v1)
table.insert(ret4,t4[k])
end
end
for k,v in pairs(ret1) do
if ret2[k]==1 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon(con,false))
end
if ret2[k]==2 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon2(con,false))
end
if ret2[k]==3 then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg(aux.TRUE,false))
elseif tg(v,c)==true then
v:SetTarget(cm.chtg(tg,false))
end
end
if ret2[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,te,tp) then
v:SetValue(cm.chval(val,false))
end
end
if ret2[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,te,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,false))
elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end
end
end
end
for k,v in pairs(ret3) do
if ret4[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,de,tp) then
v:SetValue(cm.chval(val,true))
end
end
if ret4[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,de,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,true))
elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end
end
end
end
end
function cm.chcon(_con,res)
return function(e,...)
local x=e:GetHandler()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chcon2(_con,res)
return function(e,...)
local x=e:GetHandler():GetEquipTarget()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chtg(_tg,res)
return function(e,c,...)
if c:IsHasEffect(m) then return res end
return _tg(e,c,...)
end
end
function cm.chval(_val,res)
return function(e,re,...)
local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect()
else return res end
if x and x:IsHasEffect(m) then return res end
return _val(e,re,...)
end
end
function cm.chtg2(_tg,res)
return function(e,te,...)
local x=te:GetHandler()
if x:IsHasEffect(m) then return res end
return _tg(e,te,...)
end
end
function cm.indtg(e,c) function cm.indtg(e,c)
local ct1=aux.GetColumn(e:GetHandler()) local ct1=aux.GetColumn(e:GetHandler())
local ct2=aux.GetColumn(c) local ct2=aux.GetColumn(c)
...@@ -420,7 +133,7 @@ function cm.acfd(e,tp,eg,ep,ev,re,r,rp) ...@@ -420,7 +133,7 @@ function cm.acfd(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetLabelObject() local ec=e:GetLabelObject()
local le={c:GetActivateEffect()} local le={c:GetActivateEffect()}
for _,v in pairs(le) do for _,v in pairs(le) do
if v:GetOwner()==c then if v:GetOwner()==c and v:GetRange()&0x2~=0 then
local e1=v:Clone() local e1=v:Clone()
e1:SetOwner(ec) e1:SetOwner(ec)
e1:SetRange(LOCATION_DECK) e1:SetRange(LOCATION_DECK)
......
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local m=53716010 local m=53716010
local cm=_G["c"..m] local cm=_G["c"..m]
cm.name="断片折光 幻想炉心" cm.name="断片折光 幻想炉心"
function cm.initial_effect(c) function cm.initial_effect(c)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE) e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE) e0:SetValue(aux.FALSE)
c:RegisterEffect(e0) c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c) local e1,e1_1,e2,e3=SNNM.ActivatedAsSpellorTrap(c,0x20004,LOCATION_EXTRA)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_TOGRAVE) e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCost(cm.cost) e1:SetCost(cm.cost)
e1:SetOperation(cm.op) e1:SetOperation(cm.op)
c:RegisterEffect(e1)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_EXTRA)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget)
e3:SetCost(cm.costchk)
e3:SetOperation(cm.costop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EVENT_ADJUST) e4:SetCode(m)
e4:SetRange(LOCATION_EXTRA) e4:SetRange(0xff)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetLabelObject(e1)
e4:SetOperation(cm.adjustop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
local e6=Effect.CreateEffect(c) if not cm.global_check then
e6:SetType(EFFECT_TYPE_SINGLE) cm.global_check=true
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE) local ge1=Effect.CreateEffect(c)
e6:SetCode(m) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetRange(LOCATION_EXTRA) ge1:SetCode(EVENT_RELEASE)
c:RegisterEffect(e6) ge1:SetOperation(cm.effop)
local e7=Effect.CreateEffect(c) Duel.RegisterEffect(ge1,0)
e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) local ge2=ge1:Clone()
e7:SetCode(EVENT_RELEASE) ge2:SetCode(EVENT_CHAIN_END)
e7:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)end) ge2:SetOperation(cm.evchk)
e7:SetOperation(cm.effop) Duel.RegisterEffect(ge2,0)
c:RegisterEffect(e7) end
Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter) Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter)
end end
function cm.chainfilter(re,tp,cid) function cm.chainfilter(re,tp,cid)
...@@ -83,98 +67,113 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -83,98 +67,113 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(sg,REASON_EFFECT+REASON_RETURN) Duel.SendtoGrave(sg,REASON_EFFECT+REASON_RETURN)
end end
end end
function cm.effop(e,tp,eg,ep,ev,re,r,rp) function cm.effac(c,g,ct,se,p)
Duel.RegisterFlagEffect(0,m,RESET_PHASE+PHASE_END,0,0)
local ct=Duel.GetFlagEffect(0,m)
local g=Duel.GetMatchingGroup(function(c)return c:GetOriginalType()&0x6~=0 end,0,0xff,0xff,nil)
local c=e:GetHandler()
local se=c:GetPreviousSequence()
if c:GetPreviousControler()~=tp then se=4-se end
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e0:SetRange(0xff)
e0:SetCode(EVENT_CUSTOM+m)
e0:SetLabel(ct)
e0:SetCondition(cm.regcon)
e0:SetOperation(cm.regop)
e0:SetReset(RESET_PHASE+PHASE_END)
c:RegisterEffect(e0,true)
for tc in aux.Next(g) do for tc in aux.Next(g) do
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,se+2)) e1:SetDescription(aux.Stringid(m,se+2))
e1:SetCategory(CATEGORY_TOGRAVE) e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetRange(0xff) e1:SetRange(LOCATION_GRAVE+LOCATION_MZONE)
e1:SetCode(EVENT_CUSTOM+(m+50*ct)) e1:SetCode(EVENT_CUSTOM+(m+50*ct))
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetLabel(ct,se,tp) e1:SetTarget(cm.actg(ct,se,p))
e1:SetTarget(cm.actg)
e1:SetOperation(cm.acop) e1:SetOperation(cm.acop)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1,true) tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetCode(m) e2:SetRange(LOCATION_GRAVE+LOCATION_MZONE)
e2:SetTargetRange(1,1) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SET_AVAILABLE)
e2:SetLabel(ct)
e2:SetLabelObject(e1) e2:SetLabelObject(e1)
e2:SetTargetRange(1,1)
e2:SetTarget(cm.actarget)
e2:SetCost(cm.costchk)
e2:SetOperation(cm.costop2)
e2:SetReset(RESET_PHASE+PHASE_END) e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp) tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD) e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_GRAVE+LOCATION_MZONE) e3:SetCode(m+50)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SET_AVAILABLE)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1) e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget) e3:SetLabel(ct)
e3:SetCost(cm.costchk) e3:SetReset(RESET_PHASE+PHASE_END)
e3:SetOperation(cm.costop2) Duel.RegisterEffect(e3,p)
tc:RegisterEffect(e3,true)
end end
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+m,re,r,rp,ep,ev)
end
function cm.regcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabel()==Duel.GetFlagEffect(0,m)
end end
function cm.regop(e,tp,eg,ep,ev,re,r,rp) function cm.effop(e,tp,eg,ep,ev,re,r,rp)
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+(m+50*e:GetLabel()),re,r,rp,ep,ev) local tg=eg:Filter(function(c)return c:IsHasEffect(m) and c:IsPreviousLocation(LOCATION_ONFIELD)end,nil)
e:Reset() if #tg==0 then return end
end if Duel.GetCurrentChain()==0 and not Duel.CheckEvent(EVENT_CHAIN_END) then
function cm.filter(c,e,tp) local g=Duel.GetMatchingGroup(function(c)return c:GetType()&0x20004~=0 and c:IsFaceupEx()end,p,LOCATION_MZONE+LOCATION_GRAVE,0,nil)
local ct,se,p=e:GetLabel() for c in aux.Next(tg) do
local p=c:GetControler()
local se=c:GetPreviousSequence()
if c:GetPreviousControler()~=p then se=4-se end
local ct=Duel.GetFlagEffect(0,m)
Duel.RegisterFlagEffect(0,m,RESET_PHASE+PHASE_END,0,1)
cm.effac(c,g,ct,se,p)
Duel.RaiseEvent(g,EVENT_CUSTOM+(m+50*ct),re,r,rp,ep,ev)
end
else
for c in aux.Next(tg) do
local p=c:GetControler()
local se=c:GetPreviousSequence()
if c:GetPreviousControler()~=p then se=4-se end
local ct=Duel.GetFlagEffect(0,m)
Duel.RegisterFlagEffect(0,m,RESET_PHASE+PHASE_END,0,1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(m)
e1:SetTargetRange(1,1)
e1:SetLabel(ct,se,p)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,p)
end
end
end
function cm.evchk(e,tp,eg,ep,ev,re,r,rp)
local le={Duel.IsPlayerAffectedByEffect(0,m)}
for _,v in pairs(le) do
local c=v:GetOwner()
local ct,se,p=v:GetLabel()
local g=Duel.GetMatchingGroup(function(c)return c:GetType()&0x20004~=0 and c:IsFaceupEx()end,p,LOCATION_MZONE+LOCATION_GRAVE,0,nil)
cm.effac(c,g,ct,se,p)
Duel.RaiseEvent(g,EVENT_CUSTOM+(m+50*ct),re,r,rp,ep,ev)
v:Reset()
end
end
function cm.filter(c,e,tp,se,p)
local seq=c:GetSequence() local seq=c:GetSequence()
if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end
if c:GetControler()~=tp then seq=math.abs(seq-4) end if c:GetControler()~=tp then seq=math.abs(seq-4) end
return seq<5 and math.abs(se-seq)==0 and c:IsAbleToGrave() return seq<5 and math.abs(se-seq)==0 and c:IsAbleToGrave()
end end
function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.actg(ct,se,p)
if chkc then return cm.filter(chkc,e,tp) and chkc:IsOnField() end return
local c=e:GetHandler() function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ct,se,p=e:GetLabel() if chkc then return cm.filter(chkc,e,tp,se,p) and chkc:IsOnField() end
if chk==0 then if chk==0 then
local res=false local res=false
local le={Duel.IsPlayerAffectedByEffect(tp,m)} local le={Duel.IsPlayerAffectedByEffect(tp,m+50)}
for k,v in pairs(le) do for k,v in pairs(le) do if v:GetLabel()==ct then res=true end end
if v:GetLabel()==ct then return res and Duel.IsExistingTarget(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,e,tp,se,p)
res=true
break
end
end
return res and Duel.IsExistingTarget(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler(),e,tp) and c:IsLocation(LOCATION_GRAVE+LOCATION_MZONE) and c:GetType()&0x20004==0x20004 and c:GetControler()==p
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler(),e,tp) local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler(),e,tp,se,p)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
local le={Duel.IsPlayerAffectedByEffect(tp,m)} local le={Duel.IsPlayerAffectedByEffect(tp,m+50)}
for k,v in pairs(le) do for k,v in pairs(le) do
if v:GetLabel()==ct then if v:GetLabel()==ct then
v:GetLabelObject():Reset() if v:GetLabelObject() and v:GetLabelObject():GetLabelObject() then v:GetLabelObject():GetLabelObject():Reset() end
if v:GetLabelObject() then v:GetLabelObject():Reset() end
v:Reset() v:Reset()
end end
end end
end
end end
function cm.acop(e,tp,eg,ep,ev,re,r,rp) function cm.acop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
...@@ -200,47 +199,6 @@ function cm.costchk(e,te_or_c,tp) ...@@ -200,47 +199,6 @@ function cm.costchk(e,te_or_c,tp)
end end
return fdzone>0 return fdzone>0
end end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local zone=e:GetLabel()
if zone==0 then Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false) else
local flag=Duel.SelectDisableField(tp,1,LOCATION_SZONE,0,~zone&0x1f00)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false,2^(math.log(flag,2)-8))
end
e:SetLabel(0)
c:CreateEffectRelation(te)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CHANGE_TYPE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(0x20004)
e0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
c:RegisterEffect(e0,true)
local te2=te:Clone()
c:RegisterEffect(te2,true)
e:SetLabelObject(te2)
te:SetType(EFFECT_TYPE_ACTIVATE)
local ev0=Duel.GetCurrentChain()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ev==ev0 end)
e1:SetOperation(cm.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_REMAIN_FIELD)
e3:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_CHAIN)
c:RegisterEffect(e3)
end
function cm.costop2(e,tp,eg,ep,ev,re,r,rp) function cm.costop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local te=e:GetLabelObject() local te=e:GetLabelObject()
...@@ -265,17 +223,6 @@ function cm.costop2(e,tp,eg,ep,ev,re,r,rp) ...@@ -265,17 +223,6 @@ function cm.costop2(e,tp,eg,ep,ev,re,r,rp)
e2:SetCode(EVENT_CHAIN_NEGATED) e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp) Duel.RegisterEffect(e2,tp)
end end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_EFFECT_ENABLED,true)
end
if e:GetCode()==EVENT_CHAIN_NEGATED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
rc:CancelToGrave(false)
end
re:Reset()
end
function cm.rsop2(e,tp,eg,ep,ev,re,r,rp) function cm.rsop2(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler() local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
...@@ -286,197 +233,3 @@ function cm.rsop2(e,tp,eg,ep,ev,re,r,rp) ...@@ -286,197 +233,3 @@ function cm.rsop2(e,tp,eg,ep,ev,re,r,rp)
rc:CancelToGrave(false) rc:CancelToGrave(false)
end end
end end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local re1={c:IsHasEffect(EFFECT_CANNOT_TRIGGER)}
local re2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local re3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t1,t2={},{}
for _,te1 in pairs(re1) do
table.insert(t1,te1)
if te1:GetType()==EFFECT_TYPE_SINGLE then
table.insert(t2,1)
end
if te1:GetType()==EFFECT_TYPE_EQUIP then
table.insert(t2,2)
end
if te1:GetType()==EFFECT_TYPE_FIELD then
table.insert(t2,3)
end
end
for _,te2 in pairs(re2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,te,tp) then
table.insert(t1,te2)
table.insert(t2,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(re3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,te,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,e,tp) then
table.insert(t1,te3)
table.insert(t2,5)
end
end
end
end--]]
local dc=Duel.CreateToken(tp,m+50)
local de=dc:GetActivateEffect()
de:SetCategory(CATEGORY_TOGRAVE)
local ae2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local ae3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t3,t4={},{}
for _,te2 in pairs(ae2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,de,tp) then
table.insert(t3,te2)
table.insert(t4,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(ae3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,de,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,de,tp) then
table.insert(t3,te3)
table.insert(t4,5)
end
end
end
end--]]
local ret1,ret2={},{}
for k,v1 in pairs(t1) do
local equal=false
for k,v2 in pairs(t3) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret1,v1)
table.insert(ret2,t2[k])
end
end
local ret3,ret4={},{}
for k,v1 in pairs(t3) do
local equal=false
for k,v2 in pairs(t1) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret3,v1)
table.insert(ret4,t4[k])
end
end
for k,v in pairs(ret1) do
if ret2[k]==1 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon(con,false))
end
if ret2[k]==2 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon2(con,false))
end
if ret2[k]==3 then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg(aux.TRUE,false))
elseif tg(v,c)==true then
v:SetTarget(cm.chtg(tg,false))
end
end
if ret2[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,te,tp) then
v:SetValue(cm.chval(val,false))
end
end
if ret2[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,te,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,false))
elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end
end
end
end
for k,v in pairs(ret3) do
if ret4[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,de,tp) then
v:SetValue(cm.chval(val,true))
end
end
if ret4[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,de,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,true))
elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end
end
end
end
end
function cm.chcon(_con,res)
return function(e,...)
local x=e:GetHandler()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chcon2(_con,res)
return function(e,...)
local x=e:GetHandler():GetEquipTarget()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chtg(_tg,res)
return function(e,c,...)
if c:IsHasEffect(m) then return res end
return _tg(e,c,...)
end
end
function cm.chval(_val,res)
return function(e,re,...)
local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect()
else return res end
if x and x:IsHasEffect(m) then return res end
return _val(e,re,...)
end
end
function cm.chtg2(_tg,res)
return function(e,te,...)
local x=te:GetHandler()
if x:IsHasEffect(m) then return res end
return _tg(e,te,...)
end
end
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local m=53716011 local m=53716011
local cm=_G["c"..m] local cm=_G["c"..m]
cm.name="断片折光 幻想魔裔" cm.name="断片折光 幻想魔裔"
function cm.initial_effect(c) function cm.initial_effect(c)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE) e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE) e0:SetValue(aux.FALSE)
c:RegisterEffect(e0) c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c) local e1,e1_1,e2,e3=SNNM.ActivatedAsSpellorTrap(c,0x20004,LOCATION_EXTRA)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_RECOVER) e1:SetCategory(CATEGORY_RECOVER)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCost(cm.cost) e1:SetCost(cm.cost)
e1:SetOperation(cm.op) e1:SetOperation(cm.op)
c:RegisterEffect(e1)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_EXTRA)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget)
e3:SetCost(cm.costchk)
e3:SetOperation(cm.costop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EVENT_ADJUST) e4:SetCode(m)
e4:SetRange(LOCATION_EXTRA) e4:SetRange(0xff)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetLabelObject(e1)
e4:SetOperation(cm.adjustop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
local e6=Effect.CreateEffect(c) if not cm.global_check then
e6:SetType(EFFECT_TYPE_SINGLE) cm.global_check=true
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE) local ge1=Effect.CreateEffect(c)
e6:SetCode(m) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetRange(LOCATION_EXTRA) ge1:SetCode(EVENT_RELEASE)
c:RegisterEffect(e6) ge1:SetOperation(cm.effop)
local e7=Effect.CreateEffect(c) Duel.RegisterEffect(ge1,0)
e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) local ge2=ge1:Clone()
e7:SetCode(EVENT_RELEASE) ge2:SetCode(EVENT_CHAIN_END)
e7:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)end) ge2:SetOperation(cm.evchk)
e7:SetOperation(cm.effop) Duel.RegisterEffect(ge2,0)
c:RegisterEffect(e7) end
Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter) Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter)
end end
function cm.chainfilter(re,tp,cid) function cm.chainfilter(re,tp,cid)
...@@ -80,98 +64,113 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -80,98 +64,113 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Recover(tp,1800,REASON_EFFECT) Duel.Recover(tp,1800,REASON_EFFECT)
end end
end end
function cm.effop(e,tp,eg,ep,ev,re,r,rp) function cm.effac(c,g,ct,se,p)
Duel.RegisterFlagEffect(0,m,RESET_PHASE+PHASE_END,0,0)
local ct=Duel.GetFlagEffect(0,m)
local g=Duel.GetMatchingGroup(function(c)return c:GetOriginalType()&0x6~=0 end,0,0xff,0xff,nil)
local c=e:GetHandler()
local se=c:GetPreviousSequence()
if c:GetPreviousControler()~=tp then se=4-se end
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e0:SetRange(0xff)
e0:SetCode(EVENT_CUSTOM+m)
e0:SetLabel(ct)
e0:SetCondition(cm.regcon)
e0:SetOperation(cm.regop)
e0:SetReset(RESET_PHASE+PHASE_END)
c:RegisterEffect(e0,true)
for tc in aux.Next(g) do for tc in aux.Next(g) do
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,se+2)) e1:SetDescription(aux.Stringid(m,se+2))
e1:SetCategory(CATEGORY_TOHAND) e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetRange(0xff) e1:SetRange(LOCATION_REMOVED)
e1:SetCode(EVENT_CUSTOM+(m+50*ct)) e1:SetCode(EVENT_CUSTOM+(m+50*ct))
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetLabel(ct,se,tp) e1:SetTarget(cm.actg(ct,se,p))
e1:SetTarget(cm.actg)
e1:SetOperation(cm.acop) e1:SetOperation(cm.acop)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1,true) tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetCode(m) e2:SetRange(LOCATION_REMOVED)
e2:SetTargetRange(1,1) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SET_AVAILABLE)
e2:SetLabel(ct)
e2:SetLabelObject(e1) e2:SetLabelObject(e1)
e2:SetTargetRange(1,1)
e2:SetTarget(cm.actarget)
e2:SetCost(cm.costchk)
e2:SetOperation(cm.costop2)
e2:SetReset(RESET_PHASE+PHASE_END) e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp) tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD) e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_REMOVED) e3:SetCode(m+50)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SET_AVAILABLE)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1) e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget) e3:SetLabel(ct)
e3:SetCost(cm.costchk) e3:SetReset(RESET_PHASE+PHASE_END)
e3:SetOperation(cm.costop2) Duel.RegisterEffect(e3,p)
tc:RegisterEffect(e3,true)
end end
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+m,re,r,rp,ep,ev)
end
function cm.regcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabel()==Duel.GetFlagEffect(0,m)
end end
function cm.regop(e,tp,eg,ep,ev,re,r,rp) function cm.effop(e,tp,eg,ep,ev,re,r,rp)
Duel.RaiseEvent(e:GetHandler(),EVENT_CUSTOM+(m+50*e:GetLabel()),re,r,rp,ep,ev) local tg=eg:Filter(function(c)return c:IsHasEffect(m) and c:IsPreviousLocation(LOCATION_ONFIELD)end,nil)
e:Reset() if #tg==0 then return end
end if Duel.GetCurrentChain()==0 and not Duel.CheckEvent(EVENT_CHAIN_END) then
function cm.filter(c,e,tp) local g=Duel.GetMatchingGroup(function(c)return c:GetType()&0x20004~=0 and c:IsFaceupEx()end,p,LOCATION_REMOVED,0,nil)
local ct,se,p=e:GetLabel() for c in aux.Next(tg) do
local p=c:GetControler()
local se=c:GetPreviousSequence()
if c:GetPreviousControler()~=p then se=4-se end
local ct=Duel.GetFlagEffect(0,m)
Duel.RegisterFlagEffect(0,m,RESET_PHASE+PHASE_END,0,1)
cm.effac(c,g,ct,se,p)
Duel.RaiseEvent(g,EVENT_CUSTOM+(m+50*ct),re,r,rp,ep,ev)
end
else
for c in aux.Next(tg) do
local p=c:GetControler()
local se=c:GetPreviousSequence()
if c:GetPreviousControler()~=p then se=4-se end
local ct=Duel.GetFlagEffect(0,m)
Duel.RegisterFlagEffect(0,m,RESET_PHASE+PHASE_END,0,1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(m)
e1:SetTargetRange(1,1)
e1:SetLabel(ct,se,p)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,p)
end
end
end
function cm.evchk(e,tp,eg,ep,ev,re,r,rp)
local le={Duel.IsPlayerAffectedByEffect(0,m)}
for _,v in pairs(le) do
local c=v:GetOwner()
local ct,se,p=v:GetLabel()
local g=Duel.GetMatchingGroup(function(c)return c:GetType()&0x20004~=0 and c:IsFaceupEx()end,p,LOCATION_REMOVED,0,nil)
cm.effac(c,g,ct,se,p)
Duel.RaiseEvent(g,EVENT_CUSTOM+(m+50*ct),re,r,rp,ep,ev)
v:Reset()
end
end
function cm.filter(c,e,tp,se,p)
local seq=c:GetSequence() local seq=c:GetSequence()
if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end if c:IsLocation(LOCATION_MZONE) then seq=aux.MZoneSequence(c:GetSequence()) end
if c:GetControler()~=tp then seq=math.abs(seq-4) end if c:GetControler()~=tp then seq=math.abs(seq-4) end
return seq<5 and math.abs(se-seq)==1 and c:IsAbleToHand() return seq<5 and math.abs(se-seq)==1 and c:IsAbleToHand()
end end
function cm.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.actg(ct,se,p)
if chkc then return cm.filter(chkc,e,tp) and chkc:IsOnField() end return
local c=e:GetHandler() function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ct,se,p=e:GetLabel() if chkc then return cm.filter(chkc,e,tp,se,p) and chkc:IsOnField() end
if chk==0 then if chk==0 then
local res=false local res=false
local le={Duel.IsPlayerAffectedByEffect(tp,m)} local le={Duel.IsPlayerAffectedByEffect(tp,m+50)}
for k,v in pairs(le) do for k,v in pairs(le) do if v:GetLabel()==ct then res=true end end
if v:GetLabel()==ct then return res and Duel.IsExistingTarget(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,e,tp,se,p)
res=true
break
end
end
return res and Duel.IsExistingTarget(cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler(),e,tp) and c:IsLocation(LOCATION_REMOVED) and c:GetType()&0x20004==0x20004 and c:GetControler()==p
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler(),e,tp) local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler(),e,tp,se,p)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
local le={Duel.IsPlayerAffectedByEffect(tp,m)} local le={Duel.IsPlayerAffectedByEffect(tp,m+50)}
for k,v in pairs(le) do for k,v in pairs(le) do
if v:GetLabel()==ct then if v:GetLabel()==ct then
v:GetLabelObject():Reset() if v:GetLabelObject() and v:GetLabelObject():GetLabelObject() then v:GetLabelObject():GetLabelObject():Reset() end
if v:GetLabelObject() then v:GetLabelObject():Reset() end
v:Reset() v:Reset()
end end
end end
end
end end
function cm.acop(e,tp,eg,ep,ev,re,r,rp) function cm.acop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
...@@ -193,47 +192,6 @@ function cm.costchk(e,te_or_c,tp) ...@@ -193,47 +192,6 @@ function cm.costchk(e,te_or_c,tp)
end end
return fdzone>0 return fdzone>0
end end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local zone=e:GetLabel()
if zone==0 then Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false) else
local flag=Duel.SelectDisableField(tp,1,LOCATION_SZONE,0,~zone&0x1f00)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false,2^(math.log(flag,2)-8))
end
e:SetLabel(0)
c:CreateEffectRelation(te)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CHANGE_TYPE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(0x20004)
e0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
c:RegisterEffect(e0,true)
local te2=te:Clone()
c:RegisterEffect(te2,true)
e:SetLabelObject(te2)
te:SetType(EFFECT_TYPE_ACTIVATE)
local ev0=Duel.GetCurrentChain()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ev==ev0 end)
e1:SetOperation(cm.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_REMAIN_FIELD)
e3:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_CHAIN)
c:RegisterEffect(e3)
end
function cm.costop2(e,tp,eg,ep,ev,re,r,rp) function cm.costop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local te=e:GetLabelObject() local te=e:GetLabelObject()
...@@ -258,17 +216,6 @@ function cm.costop2(e,tp,eg,ep,ev,re,r,rp) ...@@ -258,17 +216,6 @@ function cm.costop2(e,tp,eg,ep,ev,re,r,rp)
e2:SetCode(EVENT_CHAIN_NEGATED) e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp) Duel.RegisterEffect(e2,tp)
end end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_EFFECT_ENABLED,true)
end
if e:GetCode()==EVENT_CHAIN_NEGATED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
rc:CancelToGrave(false)
end
re:Reset()
end
function cm.rsop2(e,tp,eg,ep,ev,re,r,rp) function cm.rsop2(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler() local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
...@@ -279,197 +226,3 @@ function cm.rsop2(e,tp,eg,ep,ev,re,r,rp) ...@@ -279,197 +226,3 @@ function cm.rsop2(e,tp,eg,ep,ev,re,r,rp)
rc:CancelToGrave(false) rc:CancelToGrave(false)
end end
end end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local re1={c:IsHasEffect(EFFECT_CANNOT_TRIGGER)}
local re2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local re3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t1,t2={},{}
for _,te1 in pairs(re1) do
table.insert(t1,te1)
if te1:GetType()==EFFECT_TYPE_SINGLE then
table.insert(t2,1)
end
if te1:GetType()==EFFECT_TYPE_EQUIP then
table.insert(t2,2)
end
if te1:GetType()==EFFECT_TYPE_FIELD then
table.insert(t2,3)
end
end
for _,te2 in pairs(re2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,te,tp) then
table.insert(t1,te2)
table.insert(t2,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(re3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,te,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,e,tp) then
table.insert(t1,te3)
table.insert(t2,5)
end
end
end
end--]]
local dc=Duel.CreateToken(tp,m+50)
local de=dc:GetActivateEffect()
de:SetCategory(CATEGORY_RECOVER)
local ae2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local ae3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t3,t4={},{}
for _,te2 in pairs(ae2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,de,tp) then
table.insert(t3,te2)
table.insert(t4,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(ae3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,de,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,de,tp) then
table.insert(t3,te3)
table.insert(t4,5)
end
end
end
end--]]
local ret1,ret2={},{}
for k,v1 in pairs(t1) do
local equal=false
for k,v2 in pairs(t3) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret1,v1)
table.insert(ret2,t2[k])
end
end
local ret3,ret4={},{}
for k,v1 in pairs(t3) do
local equal=false
for k,v2 in pairs(t1) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret3,v1)
table.insert(ret4,t4[k])
end
end
for k,v in pairs(ret1) do
if ret2[k]==1 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon(con,false))
end
if ret2[k]==2 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon2(con,false))
end
if ret2[k]==3 then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg(aux.TRUE,false))
elseif tg(v,c)==true then
v:SetTarget(cm.chtg(tg,false))
end
end
if ret2[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,te,tp) then
v:SetValue(cm.chval(val,false))
end
end
if ret2[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,te,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,false))
elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end
end
end
end
for k,v in pairs(ret3) do
if ret4[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,de,tp) then
v:SetValue(cm.chval(val,true))
end
end
if ret4[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,de,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,true))
elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end
end
end
end
end
function cm.chcon(_con,res)
return function(e,...)
local x=e:GetHandler()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chcon2(_con,res)
return function(e,...)
local x=e:GetHandler():GetEquipTarget()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chtg(_tg,res)
return function(e,c,...)
if c:IsHasEffect(m) then return res end
return _tg(e,c,...)
end
end
function cm.chval(_val,res)
return function(e,re,...)
local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect()
else return res end
if x and x:IsHasEffect(m) then return res end
return _val(e,re,...)
end
end
function cm.chtg2(_tg,res)
return function(e,te,...)
local x=te:GetHandler()
if x:IsHasEffect(m) then return res end
return _tg(e,te,...)
end
end
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local m=53716013 local m=53716013
local cm=_G["c"..m] local cm=_G["c"..m]
cm.name="断片折光 幻想牲都" cm.name="断片折光 幻想牲都"
...@@ -9,45 +11,16 @@ function cm.initial_effect(c) ...@@ -9,45 +11,16 @@ function cm.initial_effect(c)
e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE) e0:SetValue(aux.FALSE)
c:RegisterEffect(e0) c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c) local e1,e1_1,e2,e3=SNNM.ActivatedAsSpellorTrap(c,0x20004,LOCATION_EXTRA)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCost(cm.cost) e1:SetCost(cm.cost)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetRange(LOCATION_SZONE)
e2:SetOperation(cm.disop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_EXTRA)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetLabelObject(e1)
e3:SetTargetRange(1,1)
e3:SetTarget(cm.actarget)
e3:SetCost(cm.costchk)
e3:SetOperation(cm.costop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_ADJUST) e4:SetCode(EVENT_CHAIN_SOLVING)
e4:SetRange(LOCATION_EXTRA) e4:SetRange(LOCATION_SZONE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e4:SetOperation(cm.disop)
e4:SetLabelObject(e1)
e4:SetOperation(cm.adjustop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
local e6=Effect.CreateEffect(c) SNNM.ActivatedAsSpellorTrapCheck(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e6:SetCode(m)
e6:SetRange(LOCATION_EXTRA)
c:RegisterEffect(e6)
Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter) Duel.AddCustomActivityCounter(m,ACTIVITY_CHAIN,cm.chainfilter)
end end
function cm.chainfilter(re,tp,cid) function cm.chainfilter(re,tp,cid)
...@@ -73,267 +46,6 @@ end ...@@ -73,267 +46,6 @@ end
function cm.aclimit(e,re,tp) function cm.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) return re:IsActiveType(TYPE_MONSTER)
end end
function cm.actarget(e,te,tp)
return te:GetHandler()==e:GetHandler() and te==e:GetLabelObject()
end
function cm.costchk(e,te_or_c,tp)
local fdzone=0
for i=0,4 do if Duel.CheckLocation(tp,LOCATION_SZONE,i) then fdzone=fdzone|1<<i end end
if aux.GetValueType(te_or_c)=="Effect" and te_or_c:IsHasProperty(EFFECT_FLAG_LIMIT_ZONE) then
local zone=te_or_c:GetValue()
if aux.GetValueType(c)=="function" then
zone=zone(te_or_c,tp)
end
fdzone=fdzone&zone
e:SetLabel(fdzone)
end
return fdzone>0
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local zone=e:GetLabel()
if zone==0 then Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false) else
local flag=Duel.SelectDisableField(tp,1,LOCATION_SZONE,0,~zone&0x1f00)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false,2^(math.log(flag,2)-8))
end
e:SetLabel(0)
c:CreateEffectRelation(te)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CHANGE_TYPE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(0x20004)
e0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
c:RegisterEffect(e0,true)
local te2=te:Clone()
c:RegisterEffect(te2,true)
e:SetLabelObject(te2)
te:SetType(EFFECT_TYPE_ACTIVATE)
local ev0=Duel.GetCurrentChain()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ev==ev0 end)
e1:SetOperation(cm.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_REMAIN_FIELD)
e3:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_CHAIN)
c:RegisterEffect(e3)
end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_EFFECT_ENABLED,true)
end
if e:GetCode()==EVENT_CHAIN_NEGATED and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
rc:CancelToGrave(false)
end
re:Reset()
end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
local re1={c:IsHasEffect(EFFECT_CANNOT_TRIGGER)}
local re2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local re3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t1,t2={},{}
for _,te1 in pairs(re1) do
table.insert(t1,te1)
if te1:GetType()==EFFECT_TYPE_SINGLE then
table.insert(t2,1)
end
if te1:GetType()==EFFECT_TYPE_EQUIP then
table.insert(t2,2)
end
if te1:GetType()==EFFECT_TYPE_FIELD then
table.insert(t2,3)
end
end
for _,te2 in pairs(re2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,te,tp) then
table.insert(t1,te2)
table.insert(t2,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(re3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,te,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,e,tp) then
table.insert(t1,te3)
table.insert(t2,5)
end
end
end
end--]]
local dc=Duel.CreateToken(tp,m+50)
local de=dc:GetActivateEffect()
local ae2={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_ACTIVATE)}
local ae3={Duel.IsPlayerAffectedByEffect(tp,EFFECT_ACTIVATE_COST)}
local t3,t4={},{}
for _,te2 in pairs(ae2) do
local val=te2:GetValue()
if aux.GetValueType(val)=="number" or val(te2,de,tp) then
table.insert(t3,te2)
table.insert(t4,4)
end
end
--[[Waiting for further repair
for _,te3 in pairs(ae3) do
if not te3:GetLabelObject() then
local cost=te3:GetCost()
if cost and not cost(te3,de,tp) then
local tg=te3:GetTarget()
if not tg or tg(te3,de,tp) then
table.insert(t3,te3)
table.insert(t4,5)
end
end
end
end--]]
local ret1,ret2={},{}
for k,v1 in pairs(t1) do
local equal=false
for k,v2 in pairs(t3) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret1,v1)
table.insert(ret2,t2[k])
end
end
local ret3,ret4={},{}
for k,v1 in pairs(t3) do
local equal=false
for k,v2 in pairs(t1) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret3,v1)
table.insert(ret4,t4[k])
end
end
for k,v in pairs(ret1) do
if ret2[k]==1 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon(con,false))
end
if ret2[k]==2 then
local con=v:GetCondition()
if not con then con=aux.TRUE end
v:SetCondition(cm.chcon2(con,false))
end
if ret2[k]==3 then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg(aux.TRUE,false))
elseif tg(v,c)==true then
v:SetTarget(cm.chtg(tg,false))
end
end
if ret2[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,te,tp) then
v:SetValue(cm.chval(val,false))
end
end
if ret2[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,te,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,false))
elseif tg(v,te,tp) then
v:SetTarget(cm.chtg2(tg,false))
end
end
end
end
end
for k,v in pairs(ret3) do
if ret4[k]==4 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,de,tp) then
v:SetValue(cm.chval(val,true))
end
end
if ret4[k]==5 then
if not v:GetLabelObject() then
local cost=v:GetCost()
if cost and not cost(v,de,tp) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg2(aux.TRUE,true))
elseif tg(v,de,tp) then
v:SetTarget(cm.chtg2(tg,true))
end
end
end
end
end
end
function cm.chcon(_con,res)
return function(e,...)
local x=e:GetHandler()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chcon2(_con,res)
return function(e,...)
local x=e:GetHandler():GetEquipTarget()
if x:IsHasEffect(m) then return res end
return _con(e,...)
end
end
function cm.chtg(_tg,res)
return function(e,c,...)
if c:IsHasEffect(m) then return res end
return _tg(e,c,...)
end
end
function cm.chval(_val,res)
return function(e,re,...)
local x=nil
if aux.GetValueType(re)=="Effect" then x=re:GetHandler() elseif aux.GetValueType(re)=="Card" then
local rc=Duel.CreateToken(tp,m+50)
re=rc:GetActivateEffect()
else return res end
if x and x:IsHasEffect(m) then return res end
return _val(e,re,...)
end
end
function cm.chtg2(_tg,res)
return function(e,te,...)
local x=te:GetHandler()
if x:IsHasEffect(m) then return res end
return _tg(e,te,...)
end
end
function cm.tgfilter(c) function cm.tgfilter(c)
return c:IsFaceup() and c:IsType(TYPE_TRAP) and c:IsAbleToGrave() return c:IsFaceup() and c:IsType(TYPE_TRAP) and c:IsAbleToGrave()
end end
......
if not require and dofile then function require(str) return dofile(str..".lua") end end
if not pcall(function() require("expansions/script/c53702500") end) then require("script/c53702500") end
local m=53718031 local m=53718031
local cm=_G["c"..m] local cm=_G["c"..m]
cm.name="太乙真人" cm.name="太乙真人"
...@@ -32,109 +34,8 @@ function cm.initial_effect(c) ...@@ -32,109 +34,8 @@ function cm.initial_effect(c)
ge1:SetCode(EVENT_CHAIN_SOLVING) ge1:SetCode(EVENT_CHAIN_SOLVING)
ge1:SetOperation(cm.count) ge1:SetOperation(cm.count)
Duel.RegisterEffect(ge1,0) Duel.RegisterEffect(ge1,0)
cm[2]=Card.IsType
Card.IsType=function(rc,type)
local res=cm[2](rc,type)
if type&0x10000~=0 and rc:IsHasEffect(m) then return true else return res end
end
cm[3]=Card.GetType
Card.GetType=function(rc)
if rc:IsHasEffect(m) then return 0x10002 else return cm[3](rc) end
end
cm[4]=Effect.IsHasType
Effect.IsHasType=function(re,type)
local res=cm[4](re,type)
local rc=re:GetHandler()
local xe={}
if rc then xe={rc:IsHasEffect(m)} end
local b=false
for _,v in pairs(xe) do if re==v:GetLabelObject() then b=true end end
if b then
if type&EFFECT_TYPE_ACTIVATE~=0 then return true else return false end
else return res end
end
cm[5]=Effect.GetType
Effect.GetType=function(re)
local rc=re:GetHandler()
local xe={}
if rc then xe={rc:IsHasEffect(m)} end
local b=false
for _,v in pairs(xe) do if re==v:GetLabelObject() then b=true end end
if b then return EFFECT_TYPE_ACTIVATE else return cm[5](re) end
end
cm[6]=Effect.IsActiveType
Effect.IsActiveType=function(re,type)
local res=cm[6](re,type)
local rc=re:GetHandler()
local xe={}
if rc then xe={rc:IsHasEffect(m)} end
local b=false
for _,v in pairs(xe) do if re==v:GetLabelObject() then b=true end end
if b then
if type&0x10000~=0 then return true else return false end
else return res end
end
cm[7]=Effect.GetActiveType
Effect.GetActiveType=function(re)
local rc=re:GetHandler()
local xe={}
if rc then xe={rc:IsHasEffect(m)} end
local b=false
for _,v in pairs(xe) do if re==v:GetLabelObject() then b=true end end
if b then return 0x10002 else return cm[7](re) end
end
cm[10]=Effect.GetActivateLocation
Effect.GetActivateLocation=function(re)
local rc=re:GetHandler()
local xe={}
if rc then xe={rc:IsHasEffect(m)} end
local b=false
for _,v in pairs(xe) do if re==v:GetLabelObject() then b=true end end
if b then return LOCATION_SZONE else return cm[10](re) end
end
cm[11]=Effect.GetActivateSequence
Effect.GetActivateSequence=function(re)
local rc=re:GetHandler()
local xe={}
if rc then xe={rc:IsHasEffect(m)} end
local ls=0
local seq=cm[11](re)
for _,v in pairs(xe) do
if re==v:GetLabelObject() then
ls=v:GetLabel()
break
end
end
if ls>0 then return ls-1 else return seq end
end
cm[12]=Duel.GetChainInfo
Duel.GetChainInfo=function(chainc,...)
local re=cm[12](chainc,CHAININFO_TRIGGERING_EFFECT)
local rc=re:GetHandler()
local xe={}
if rc then xe={rc:IsHasEffect(m)} end
local b=false
local ls=0
for _,v in pairs(xe) do
if re==v:GetLabelObject() then
b=true
ls=v:GetLabel()
break
end
end
local t={cm[12](chainc,...)}
if b then
for k,info in ipairs({...}) do
if info==CHAININFO_TYPE then t[k]=0x10002 end
if info==CHAININFO_EXTTYPE then t[k]=0x10002 end
if info==CHAININFO_TRIGGERING_LOCATION then t[k]=LOCATION_SZONE end
if info==CHAININFO_TRIGGERING_SEQUENCE and ls>0 then t[k]=ls-1 end
if info==CHAININFO_TRIGGERING_POSITION then t[k]=POS_FACEUP end
end
end
return table.unpack(t)
end
end end
SNNM.ActivatedAsSpellorTrapCheck(c)
end end
function cm.count(e,tp,eg,ep,ev,re,r,rp) function cm.count(e,tp,eg,ep,ev,re,r,rp)
local code=Duel.GetChainInfo(Duel.GetCurrentChain(),CHAININFO_TRIGGERING_CODE) local code=Duel.GetChainInfo(Duel.GetCurrentChain(),CHAININFO_TRIGGERING_CODE)
...@@ -145,8 +46,9 @@ function cm.condition(e,tp,eg,ep,ev,re,r,rp) ...@@ -145,8 +46,9 @@ function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2) and not e:GetHandler():IsPublic() return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2) and not e:GetHandler():IsPublic()
end end
function cm.filter(c,tp) function cm.filter(c,tp,e)
if not c:IsCode(53718001,53718002) then return false end if not c:IsCode(53718001,53718002) then return false end
if e and c:IsImmuneToEffect(e) then return false end
local ae=c:GetActivateEffect() local ae=c:GetActivateEffect()
if not ae then return false end if not ae then return false end
local e1=ae:Clone() local e1=ae:Clone()
...@@ -157,7 +59,7 @@ function cm.filter(c,tp) ...@@ -157,7 +59,7 @@ function cm.filter(c,tp)
pro1=pro1|EFFECT_FLAG_UNCOPYABLE pro1=pro1|EFFECT_FLAG_UNCOPYABLE
e1:SetProperty(pro1,pro2) e1:SetProperty(pro1,pro2)
c:RegisterEffect(e1,true) c:RegisterEffect(e1,true)
local e2=cm.regi(c,e1) local e2=SNNM.AASTregi(c,e1)
local res=false local res=false
if e1:IsActivatable(tp) then res=true end if e1:IsActivatable(tp) then res=true end
e2:Reset() e2:Reset()
...@@ -170,7 +72,7 @@ end ...@@ -170,7 +72,7 @@ end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
local b=Duel.GetFlagEffect(0,m)>0 and Duel.GetFlagEffect(0,m+33)>0 local b=Duel.GetFlagEffect(0,m)>0 and Duel.GetFlagEffect(0,m+33)>0
if chk==0 then return (cm.GetSZoneCount(tp)>0 and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND,0,1,nil,tp)) or (Duel.GetFlagEffect(0,m)>0 and Duel.GetFlagEffect(0,m+33)>0 and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode())) end if chk==0 then return (cm.GetSZoneCount(tp)>0 and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND,0,1,nil,tp,nil)) or (Duel.GetFlagEffect(0,m)>0 and Duel.GetFlagEffect(0,m+33)>0 and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode())) end
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_PUBLIC) e1:SetCode(EFFECT_PUBLIC)
...@@ -187,14 +89,14 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -187,14 +89,14 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function cm.operation(e,tp,eg,ep,ev,re,r,rp) function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if Duel.GetFlagEffect(0,m)>0 and Duel.GetFlagEffect(0,m+33)>0 and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode()) and (not (Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND,0,1,nil,tp)) or Duel.SelectYesNo(tp,aux.Stringid(m,1))) then if Duel.GetFlagEffect(0,m)>0 and Duel.GetFlagEffect(0,m+33)>0 and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode()) and (not (cm.GetSZoneCount(tp)>0 and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND,0,1,nil,tp,e)) or Duel.SelectYesNo(tp,aux.Stringid(m,1))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil,c:GetCode()) local sg=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil,c:GetCode())
Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg) Duel.ConfirmCards(1-tp,sg)
else else
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,2)) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,2))
local tc=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_HAND,0,1,1,nil,tp):GetFirst() local tc=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_HAND,0,1,1,nil,tp,e):GetFirst()
if not tc then return end if not tc then return end
Duel.ConfirmCards(1-tp,tc) Duel.ConfirmCards(1-tp,tc)
Duel.ShuffleHand(tp) Duel.ShuffleHand(tp)
...@@ -212,28 +114,15 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -212,28 +114,15 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return ev==ct end) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return ev==ct end)
tc:RegisterEffect(e1,true) tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(tc) local _,e1_1,e2,e3=SNNM.ActivatedAsSpellorTrap(tc,0x10002,LOCATION_HAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1_1:SetLabelObject(e1)
e2:SetCode(EVENT_ADJUST) e1_1:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetRange(LOCATION_HAND)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetLabelObject(e1) e2:SetLabelObject(e1)
e2:SetOperation(cm.adjustop)
e2:SetReset(RESET_EVENT+RESETS_STANDARD) e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(tc)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_HAND)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetTargetRange(1,0)
e3:SetLabelObject(e1) e3:SetLabelObject(e1)
e3:SetTarget(cm.actarget)
e3:SetCost(cm.costchk)
e3:SetOperation(cm.costop)
e3:SetReset(RESET_EVENT+RESETS_STANDARD) e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3,true) Duel.AdjustAll()
Duel.RaiseEvent(Group.FromCards(tc),EVENT_CUSTOM+m,e,0x40,tp,tp,ct) Duel.RaiseEvent(Group.FromCards(tc),EVENT_CUSTOM+m,e,0x40,tp,tp,ct)
end end
end end
...@@ -288,194 +177,3 @@ function cm.GetSZoneCount(tp) ...@@ -288,194 +177,3 @@ function cm.GetSZoneCount(tp)
local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) local ft=Duel.GetLocationCount(tp,LOCATION_SZONE)
return ft+Duel.GetMatchingGroupCount(cm.sfilter,tp,LOCATION_SZONE,0,nil) return ft+Duel.GetMatchingGroupCount(cm.sfilter,tp,LOCATION_SZONE,0,nil)
end end
function cm.regi(c,e)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(m)
e1:SetLabelObject(e)
c:RegisterEffect(e1,true)
return e1
end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
local c=te:GetHandler()
local xe={c:IsHasEffect(m)}
for _,v in pairs(xe) do v:Reset() end
local p=te:GetHandlerPlayer()
local pe={Duel.IsPlayerAffectedByEffect(p,EFFECT_CANNOT_ACTIVATE)}
local ae={Duel.IsPlayerAffectedByEffect(p,EFFECT_ACTIVATE_COST)}
local t1,t2={},{}
for _,v in pairs(pe) do
local val=v:GetValue()
if aux.GetValueType(val)=="number" or val(v,te,p) then
table.insert(t1,v)
table.insert(t2,1)
end
end
for _,v in pairs(ae) do
local cost=v:GetCost()
if not v:GetLabelObject() and cost and not cost(v,te,p) then
local tg=v:GetTarget()
if not tg or tg(v,te,p) then
table.insert(t1,v)
table.insert(t2,2)
end
end
end
local xe1=cm.regi(c,te)
local t3,t4={},{}
for _,v in pairs(pe) do
local val=v:GetValue()
if aux.GetValueType(val)=="number" or val(v,te,p) then
table.insert(t3,v)
table.insert(t4,1)
end
end
for _,v in pairs(ae) do
local cost=v:GetCost()
if not v:GetLabelObject() and cost and not cost(v,te,p) then
local tg=v:GetTarget()
if not tg or tg(v,te,p) then
table.insert(t3,v)
table.insert(t4,2)
end
end
end
xe1:Reset()
local ret1,ret2={},{}
for k,v1 in pairs(t1) do
local equal=false
for _,v2 in pairs(t3) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret1,v1)
table.insert(ret2,t2[k])
end
end
local ret3,ret4={},{}
for k,v1 in pairs(t3) do
local equal=false
for _,v2 in pairs(t1) do
if v1==v2 then
equal=true
break
end
end
if not equal then
table.insert(ret3,v1)
table.insert(ret4,t4[k])
end
end
for k,v in pairs(ret1) do
if ret2[k]==1 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,te,p) then
v:SetValue(cm.chval(val,false,te))
end
end
if ret2[k]==2 then
local cost=v:GetCost()
if not v:GetLabelObject() and cost and not cost(v,te,p) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg(aux.TRUE,false,te))
elseif tg(v,te,p) then
v:SetTarget(cm.chtg(tg,false,te))
end
end
end
end
local xe1=cm.regi(c,te)
for k,v in pairs(ret3) do
if ret4[k]==1 then
local val=v:GetValue()
if aux.GetValueType(val)=="number" then val=aux.TRUE end
if val(v,te,p) then
v:SetValue(cm.chval(val,true,te))
end
end
if ret4[k]==2 then
local cost=v:GetCost()
if not v:GetLabelObject() and cost and not cost(v,te,p) then
local tg=v:GetTarget()
if not tg then
v:SetTarget(cm.chtg(aux.TRUE,true,te))
elseif tg(v,te,p) then
v:SetTarget(cm.chtg(tg,true,te))
end
end
end
end
xe1:Reset()
end
function cm.bchval(_val,te)
return function(e,re,...)
if re==te then return false end
return _val(e,re,...)
end
end
function cm.chval(_val,res,te)
return function(e,re,...)
if re==te then return res end
return _val(e,re,...)
end
end
function cm.chtg(_tg,res,te)
return function(e,re,...)
if re==te then return res end
return _tg(e,re,...)
end
end
function cm.actarget(e,te,tp)
return te:GetHandler()==e:GetHandler() and te==e:GetLabelObject()
end
function cm.costchk(e,te,tp)
return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
local c=te:GetHandler()
local xe1=cm.regi(c,te)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CHANGE_TYPE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(0x10002)
c:RegisterEffect(e0,true)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false)
xe1:SetLabel(c:GetSequence()+1)
e0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
c:CreateEffectRelation(te)
local ev0=Duel.GetCurrentChain()+1
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetCountLimit(1)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return ev==ev0 end)
e1:SetOperation(cm.rsop)
e1:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if e:GetCode()==EVENT_CHAIN_SOLVING and rc:IsRelateToEffect(re) then
rc:SetStatus(STATUS_EFFECT_ENABLED,true)
if not rc:IsHasEffect(EFFECT_REMAIN_FIELD) then rc:CancelToGrave(false) end
end
if e:GetCode()==EVENT_CHAIN_NEGATED and rc:IsRelateToEffect(re) and not (rc:IsOnField() and rc:IsFacedown()) then
rc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
rc:CancelToGrave(false)
end
local xe={rc:IsHasEffect(m)}
for _,v in pairs(xe) do if v:GetLabelObject()==re then v:Reset() end end
end
--无尽镜界 --无尽镜界
if not require and loadfile then
function require(str)
require_list=require_list or {}
if not require_list[str] then
if string.find(str,"%.") then
require_list[str]=loadfile(str)
else
require_list[str]=loadfile(str..".lua")
end
require_list[str]()
return require_list[str]
end
return require_list[str]
end
end
if not pcall(require,"expansions/script/c65199999") then pcall(require,"script/c65199999") end if not pcall(require,"expansions/script/c65199999") then pcall(require,"script/c65199999") end
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
......
--无尽镜界 --无尽镜界
local s,id,o=GetID() local s,id,o=GetID()
if not require and loadfile then
function require(str)
require_list=require_list or {}
if not require_list[str] then
if string.find(str,"%.") then
require_list[str]=loadfile(str)
else
require_list[str]=loadfile(str..".lua")
end
require_list[str]()
return require_list[str]
end
return require_list[str]
end
end
if not pcall(require,"expansions/script/c65199999") then pcall(require,"script/c65199999") end if not pcall(require,"expansions/script/c65199999") then pcall(require,"script/c65199999") end
function s.initial_effect(c) function s.initial_effect(c)
--spsummon --spsummon
...@@ -103,7 +118,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -103,7 +118,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
if value==code then if value==code then
table.remove(Mirrors_World_Card,i) table.remove(Mirrors_World_Card,i)
break break
end end
end end
local cg=Group.CreateGroup() local cg=Group.CreateGroup()
......
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