Commit d2b1b113 authored by JoyJ's avatar JoyJ

fix c20010001 and c20059999

parent 62181253
No preview for this file type
......@@ -10,34 +10,34 @@ function c20010001.initial_effect(c)
c:RegisterEffect(e1)
end
function c20010001.ceget(c,tp)
c20010001.card_effect_cache=Senya.sin_cache or {}
c20010001.card_effect_cache={}
local code=c:GetOriginalCode()
if c20010001.card_effect_cache[code] then return c20010001.card_effect_cache[code] end
local orig = Card.RegisterEffect
local eset={}
Duel.RegisterEffect = function(c,e,f)
local typ = e:GetType()
if (typ & EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_EQUIP+EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT+EFFECT_TYPE_XMATERIAL+EFFECT_TYPE_TARGET)>0 then
table.insert(eset,e:Clone())
if not c20010001.card_effect_cache[code] then
c20010001.card_effect_cache[code]={}
local orig = Card.RegisterEffect
Duel.RegisterEffect = function(c,e,f)
local ccode=c:GetOriginalCode()
local typ = e:GetType()
if (typ & EFFECT_TYPE_ACTIONS)>0 then
table.insert(c20010001.card_effect_cache[code],e:Clone())
end
end
return temp(tc,e,f)
Duel.DisableActionCheck(true)
Duel.CreateToken(tp,code)
Duel.DisableActionCheck(false)
Card.RegisterEffect = orig
return
end
Duel.DisableActionCheck(true)
Duel.CreateToken(tp,code)
Duel.DisableActionCheck(false)
Card.RegisterEffect = orig
return eset
return c20010001.card_effect_cache[code]
end
function c20010001.cfilter(c,tp)
local effects=c20010001.ceget(c,tp)
local canUse = false
for i,ev in ipairs(effects) do
if ev:IsHasType(EFFECT_TYPE_ACTIONS) then
c:RegisterEffect(ev)
local f = ev:GetTarget()
if f(ev,tp,nil,tp,0,nil,0,tp,0) then canUse = true end
ev:Reset()
end
c:RegisterEffect(ev)
local f = ev:GetTarget()
if f(ev,tp,nil,tp,0,nil,0,tp,0) then canUse = true end
ev:Reset()
end
return c:IsType(TYPE_FLIP) and canUse
end
......@@ -55,14 +55,16 @@ function c20010001.operation(e,tp,eg,ep,ev,re,r,rp)
local effects=c20010001.ceget(tc,tp)
for i,ev in ipairs(effects) do
if ev:IsHasType(EFFECT_TYPE_ACTIONS) then
c:RegisterEffect(ev)
local f = ev:GetTarget()
if f == nil or f(ev,tp,nil,tp,0,nil,0,tp,0) then
Duel.RaiseEvent(tc,EVENT_CHAIN_ACTIVATING,ev,REASON_EFFECT,tp,tp,ev)
if not f == nil then f(ev,tp,nil,tp,0,nil,0,tp,1) end
Duel.RaiseEvent(tc,EVENT_CHAIN_SOLVING,ev,REASON_EFFECT,tp,tp,ev)
f = ev:GetOperation()
if not f == nil then f(ev,tp,nil,tp,nil,0,tp) end
Duel.RaiseEvent(tc,EVENT_CHAIN_SOLVED,ev,REASON_EFFECT,tp,tp,ev)
Duel.RaiseEvent(tc,EVENT_CHAIN_END,ev,REASON_EFFECT,tp,tp,ev)
end
ev:Reset()
end
end
end
......
......@@ -25,6 +25,7 @@ function c20059999.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_FZONE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetValue(500)
c:RegisterEffect(e2)
......@@ -33,15 +34,16 @@ function c20059999.initial_effect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_FZONE)
e3:SetCode(EFFECT_PATRICIAN_OF_DARKNESS)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetTargetRange(0,1)
c:RegisterEffect(e3)
--negate
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DISABLE)
e4:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_CHAINING)
e4:SetRange(LOCATION_HAND)
e4:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e4:SetCost(c20059999.discost)
e4:SetTarget(c20059999.distg)
e4:SetOperation(c20059999.disop)
......@@ -56,13 +58,16 @@ function c20059999.initial_effect(c)
end
function c20059999.discost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
if chk==0 then return c:IsAbleToGraveAsCost() end
Duel.SendtoGrave(c,REASON_COST)
end
function c20059999.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not re:GetHandler():IsStatus(STATUS_DISABLED) and Duel.IsChainDisablable(ev) end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
function c20059999.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
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