Commit e4ffe3c3 authored by POLYMER's avatar POLYMER

fix

parent da7d8fad
--OneInAMillion
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,13020032)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--back
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(0x10)
e3:SetCountLimit(1,id)
e3:SetCost(s.spcost)
e3:SetTarget(s.target)
e3:SetOperation(s.activate)
c:RegisterEffect(e3)
--白露未已
local cm, m, o = GetID()
local yr = 13020010
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
function s.ckfi1ter(c)
return c:GetSequence()==0
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
c:EnableReviveLimit()
local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCountLimit(1, m)
e2:SetCondition(cm.condition)
e2:SetOperation(cm.operation)
c:RegisterEffect(e2)
local e11 = Effect.CreateEffect(c)
-- e11:SetDescription(aux.Stringid(m, 0))
e11:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
e11:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
e11:SetProperty(EFFECT_FLAG_DELAY)
e11:SetCode(EVENT_SPSUMMON_SUCCESS)
e11:SetCost(cm.cost)
e11:SetTarget(cm.drtg)
e11:SetOperation(cm.drop)
c:RegisterEffect(e11)
if not cm.global_check then
cm.global_check = true
local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_ADJUST)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e4:SetOperation(cm.adop)
Duel.RegisterEffect(e4, tp)
end
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0x01,0)>0 end
function cm.cfilter(c, e, tp, sc)
return c:IsAbleToDeckAsCost() and aux.IsCodeListed(c, yr) and (c:IsLocation(QY_sk) or
Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0)
end
function s.rlgck(g,sc,tp)
Duel.SetSelectedCard(g)
return g:CheckWithSumGreater(Card.GetLevel,sc:GetLevel())
and Duel.GetMZoneCount(tp,g)>0
end
function s.rspfi1ter(c,e,tp)
local g=Duel.GetMatchingGroup(s.matfilter,c:GetControler(),0x36,0,c)
return c:IsType(TYPE_RITUAL) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true)
and g:CheckSubGroup(s.rlgck,1,1,c,tp)
end
function s.matfilter(c)
return ((c:IsLocation(0x32) and c:IsAbleToDeck())
or (c:IsLocation(0x04) and c:IsReleasableByEffect()))
and c:IsType(TYPE_RITUAL) and c:IsLevelAbove(1)
function cm.cfilter2(c, e, tp, sc)
return c:IsAbleToExtraAsCost() and Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(s.ckfi1ter,tp,0x01,0,nil)
if #g>0 then
local tc=g:GetFirst()
Duel.MoveSequence(tc,SEQ_DECKTOP)
Duel.ConfirmDecktop(tp,2)
local hg=Duel.GetFieldGroup(tp,0x02,0)
local dg=Duel.GetDecktopGroup(tp,2)
dg:Merge(hg)
local gg=dg:Filter(s.filter111,nil)
local Check=false
if #gg>0 then
Check=true
end
Duel.MoveSequence(tc,SEQ_DECKBOTTOM)
if Check and Duel.IsExistingMatchingCard(s.rspfi1ter,tp,0x70,0,1,c,e,tp) then
s.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.condition(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local tp = c:GetControler()
local g = Duel.GetMatchingGroup(cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil, e, tp, c)
local g2 = Duel.GetMatchingGroup(cm.cfilter2, tp, LOCATION_ONFIELD, 0, nil, e, tp, c)
return #g > 0 and #g2 > 0
end
function s.filter111(c)
return c:IsType(TYPE_RITUAL)
function cm.operation(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local tp = c:GetControler()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g1 = Duel.SelectMatchingCard(tp, cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, 1, 1, nil, e, tp, c)
local g2 = Duel.SelectMatchingCard(tp, cm.cfilter2, tp, LOCATION_ONFIELD, 0, 1, 1, g1, e, tp, c)
g2:Merge(g1)
c:SetMaterial(g2)
Duel.SendtoDeck(g2, tp, SEQ_DECKSHUFFLE, REASON_COST + REASON_MATERIAL)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then return end
::cancel::
local mg=Duel.GetMatchingGroup(s.matfilter,tp,0x32,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,s.rspfi1ter,tp,0x70,0,1,1,nil,e,tp,mg)
if tg:GetCount()>0 then
local tc=tg:GetFirst()
mg:RemoveCard(tc)
local lv=tc:GetLevel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local mat=mg:SelectSubGroup(tp,s.rlgck,false,1,1,tc,tp)
if not mat then goto cancel end
tc:SetMaterial(mat)
local check=false
local matg=mat:Filter(Card.IsCode,nil,13020032)
if mat:FilterCount(Card.IsLocation,nil,0x0c)>0 then
check=true
elseif #matg>0 then
local ctc=matg:GetFirst()
if ctc:IsLocation(0x02) then Duel.ConfirmCards(1-tp,ctc) end
if ctc:IsLocation(0x10) then Duel.HintSelection(matg) end
check=true
end
local mg1=mat:Filter(Card.IsLocation,nil,0x32)
local mg2=mat:Filter(Card.IsLocation,nil,0x04)
if #mg1>0 then Duel.SendtoDeck(mg1,nil,2,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL) end
if #mg2>0 then Duel.Release(mg2,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL) end
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
if check then
local g=Duel.GetFieldGroup(tp,0x1c,0x1c):Filter(Card.IsAbleToHand,nil)
if #g>0 then
Duel.Hint(3,tp,505)
local sg=g:Select(tp,1,1,nil)
Duel.HintSelection(sg)
Duel.SendtoHand(sg,nil,0x40)
end
end
end
function cm.cfilter3(c, e, tp, sc)
return (c:IsAbleToRemove() or c:IsAbleToGrave()) and aux.IsCodeListed(c, yr)
end
function s.CheckRel(c,tp)
if c:IsReleasableByEffect(c) then return true end
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_RELEASE) and c:IsType(TYPE_TRAP+TYPE_SPELL) then
local re={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_RELEASE)}
for i,v in ipairs(re) do
if val(v,c) then
return false
end
end
end
return true
function cm.cost(e, tp, eg, ep, ev, re, r, rp, chk)
local g = Duel.GetMatchingGroup(cm.cfilter3, tp, QY_kz, 0, nil)
if chk == 0 then return #g > 0 end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
if #g == 0 then return end
local sg = g:Select(tp, 1, 1, nil):GetFirst()
local off = 1
local ops = {}
local opval = {}
if sg:IsAbleToRemove() then
ops[off] = aux.Stringid(m, 0)
opval[off - 1] = 1
off = off + 1
end
if sg:IsAbleToGrave() then
ops[off] = aux.Stringid(m, 1)
opval[off - 1] = 2
off = off + 1
end
local op = Duel.SelectOption(tp, table.unpack(ops))
if opval[op] == 1 then
Duel.SendtoGrave(sg, REASON_EFFECT)
elseif opval[op] == 2 then
Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
end
e:SetLabel(sg:GetCode())
end
function cm.cfilter4(c, code)
return c:IsAbleToHand() and aux.IsCodeListed(c, yr) and not c:IsCode(code)
end
function cm.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
local c = e:GetHandler()
local code = e:GetLabel()
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
if chk == 0 then return #g > 0 end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, QY_kz + QY_md + QY_cw)
end
function cm.drop(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local code = e:GetLabel()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
local sg = g:Select(tp, 1, 1, nil)
Duel.SendtoHand(sg, tp, REASON_EFFECT)
if Duel.SelectYesNo(tp, aux.Stringid(m, 2)) then
-- local g = Duel.GetFieldGroup(tp, LOCATION_HAND, 0):Select(tp, 1, 1, nil)
-- if g:GetCount() > 0 then
-- Duel.BreakEffect()
-- if Duel.SendtoDeck(g, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) ~= 0 then
Duel.RegisterFlagEffect(tp, m, RESET_PHASE + PHASE_END, 0, 2)
-- end
-- end
end
end
function cm.adop(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local ng = Duel.GetMatchingGroup(cm.filsn, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + QY_kz, 0, nil)
local nc = ng:GetFirst()
while nc do
if not cm.reg then
cm.reg = Card.RegisterEffect
Card.RegisterEffect = cm.reg2
cm.rq = cm.rq or {}
local limit = Effect.SetCountLimit
Effect.SetCountLimit = function(e, id, ida)
if cm.rq[e] and cm.rq[e] ~= nil then
limit(cm.rq[e], id + 1, ida)
end
return limit(e, id, ida)
end
end
nc:RegisterFlagEffect(m, 0, 0, 1)
nc:ReplaceEffect(nc:GetOriginalCodeRule(), 0)
nc = ng:GetNext()
end
end
function cm.filsn(c)
return aux.IsCodeListed(c, yr) and c:GetFlagEffect(m) == 0
end
function cm.reg2(c, ie, ob)
local b = ob or false
local p = ie:GetCode()
local id, ida = ie:GetCountLimit()
if not aux.IsCodeListed(c, yr) or not ie:IsActivated() then
--bit.band(ie:GetProperty(), EFFECT_FLAG_CARD_TARGET) == 0) and or (not id and not ida) then
return cm.reg(c, ie, b)
end
local co = ie:GetCondition()
local ie2 = ie:Clone()
if id and ida then
ie2:SetCountLimit(id + 1, ida)
elseif id then
ie2:SetCountLimit(id + 1)
end
cm.rq[ie] = ie2
ie2:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code > 0
end)
if bit.band(ie2:GetProperty(), EFFECT_FLAG_CARD_TARGET) ~= 0 then
local tn = ie:GetTarget()
ie2:SetProperty(ie2:GetProperty() - EFFECT_FLAG_CARD_TARGET)
ie2:SetTarget(function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
local exis = Duel.IsExistingTarget
local exis2 = Duel.SelectTarget
local operat = Duel.SetOperationInfo
Duel.IsExistingTarget = function(fun, tp2, s1, o1, num, cg, ...)
-- cm[ie2] = { tp, fun, tp2, s1, o1, num, cg, ... }
return Duel.IsExistingMatchingCard(fun, tp2, s1, o1, num, cg, ...)
end
Duel.SelectTarget = function(tp1, fun, tp2, s1, o1, min, max, cg, ...)
local t = { ... }
for _, va in ipairs(t) do
if aux.GetValueType(va) == "Group" then
Group.KeepAlive(va)
end
end
cm[ie2] = { tp1, fun, tp2, s1, o1, min, max, cg, { ... } }
-- Duel.ConfirmCards(tp, table.unpack({ ... }))
return Group.CreateGroup()
end
Duel.SetOperationInfo = function(chainc, category, targets, count, target_player, target_param)
return operat(chainc, category, nil, count, target_player, target_param)
end
local jg = tn(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
Duel.IsExistingTarget = exis
Duel.SelectTarget = exis2
Duel.SetOperationInfo = operat
return jg
end)
local op = ie:GetOperation()
ie2:SetOperation(function(e, tp, eg, ep, ev, re, r, rp)
local ma = cm[ie2]
local g = Duel.SelectMatchingCard(ma[1], ma[2], ma[3], ma[4], ma[5], ma[6], ma[7], ma[8],
table.unpack(ma[9]))
--ma[0], ma[1], ma[2], ma[3], ma[4], 1, ma[5],ma[6], table.unpack(ma[7])
-- local g = Group.CreateGroup()
local xta = Duel.GetFirstTarget
Duel.GetFirstTarget = function() return g:GetFirst(), g:GetNext(), g:GetNext(), g:GetNext() end
for tc in aux.Next(g) do
tc:CreateEffectRelation(e)
end
op(e, tp, eg, ep, ev, re, r, rp)
Duel.GetFirstTarget = xta
end)
end
ie:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code == 0
end)
cm.reg(c, ie, b)
return cm.reg(c, ie2, b)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.CheckRel,tp,0x02,0,1,nil,tp)
and e:GetHandler():IsAbleToDeckAsCost() end
Duel.Hint(3,tp,500)
local g=Duel.SelectMatchingCard(tp,s.CheckRel,tp,0x02,0,1,1,nil,tp)
Duel.SendtoGrave(g,REASON_COST+REASON_RELEASE)
Duel.SendtoDeck(e:GetHandler(),nil,2,REASON_COST)
end
\ No newline at end of file
......@@ -111,14 +111,20 @@ function xg.epp2(c, id, cf, co, ta, qy, h1, h2, h3, h4, zc) --XG.epp2(c,m,2,nil,
elseif ta ~= nil then
c3 = c3|ta
end
e1:SetProperty(c3)
if qy ~= nil then
e1:SetRange(qy)
end
e1:SetType(c1)
e1:SetCode(c2)
e1:SetProperty(c3)
if zc == true then
c:RegisterEffect(e1)
if id ~= nil then
if aux.GetValueType(id) == "number" and id < 99 then
e1:SetCountLimit(id)
elseif aux.GetValueType(id) == "number" and id >= 99 then
e1:SetCountLimit(1, id)
elseif aux.GetValueType(id) == "table" then
e1:SetCountLimit(id[1], id[2])
end
end
if h1 ~= nil then
e1:SetCondition(h1)
......@@ -132,6 +138,9 @@ function xg.epp2(c, id, cf, co, ta, qy, h1, h2, h3, h4, zc) --XG.epp2(c,m,2,nil,
if h4 ~= nil then
e1:SetOperation(h4)
end
if zc == true then
c:RegisterEffect(e1)
end
return e1
end
......@@ -205,7 +214,7 @@ end
--魂精
hj = hj or {}
--泛用
--泛用便利函数
function it.GetEffectValue(e, ...) --检测e的val是否函数,是的场合执行函数内容
local v = e:GetValue()
if aux.GetValueType(v) == "function" then
......@@ -253,41 +262,41 @@ function it.num(num, tp) --检测无尽贪婪已减少多少张卡的使用
return num
end
function it.sxbl() --所谓伊人相关检测全种族全属性全等级可特招
local zzjc = { RACE_WARRIOR, --战士
RACE_SPELLCASTER, --魔法师
RACE_FAIRY, --天使
RACE_FIEND, --恶魔
RACE_ZOMBIE, --不死
RACE_MACHINE, --机械
RACE_AQUA, --水
RACE_PYRO, --炎
RACE_ROCK, --岩石
RACE_WINDBEAST, --鸟兽
RACE_PLANT, --植物
RACE_INSECT, --昆虫
RACE_THUNDER, --雷
RACE_DRAGON, --龙
RACE_BEAST, --兽
RACE_BEASTWARRIOR, --兽战士
RACE_DINOSAUR, --恐龙
RACE_FISH, --鱼
RACE_SEASERPENT, --海龙
RACE_REPTILE, --爬虫类
RACE_PSYCHO, --念动力
RACE_DIVINE, --幻神兽
RACE_CREATORGOD, --创造神
RACE_WYRM, --幻龙
RACE_CYBERSE, --电子界
RACE_ILLUSION --幻想魔
function it.sxbl() --所谓伊人相关检测全种族全属性全等级可特招
local zzjc = { RACE_WARRIOR, --战士
RACE_SPELLCASTER, --魔法师
RACE_FAIRY, --天使
RACE_FIEND, --恶魔
RACE_ZOMBIE, --不死
RACE_MACHINE, --机械
RACE_AQUA, --水
RACE_PYRO, --炎
RACE_ROCK, --岩石
RACE_WINDBEAST, --鸟兽
RACE_PLANT, --植物
RACE_INSECT, --昆虫
RACE_THUNDER, --雷
RACE_DRAGON, --龙
RACE_BEAST, --兽
RACE_BEASTWARRIOR, --兽战士
RACE_DINOSAUR, --恐龙
RACE_FISH, --鱼
RACE_SEASERPENT, --海龙
RACE_REPTILE, --爬虫类
RACE_PSYCHO, --念动力
RACE_DIVINE, --幻神兽
RACE_CREATORGOD, --创造神
RACE_WYRM, --幻龙
RACE_CYBERSE, --电子界
RACE_ILLUSION --幻想魔
}
local sxjc = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40 }
local zzl = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
local zzx = 0 --可选种族
local sxjc = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40 } --可选属性
local zzl = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } --可选等级
local zzx = 0 --可选种族数
for _, z in ipairs(zzjc) do
zzx = zzx + z
end
local sxx = 0 --可选属性
local sxx = 0 --可选属性
for _, z in ipairs(sxjc) do
sxx = sxx + z
end
......@@ -340,6 +349,40 @@ function it.sxblx(tp, kx, zzx, sxx, zzl) --宣言1个可特招的种族属性等
return zz, sx, lv
end
function it.FZSzone(c, co, fun1, fun2, lx) --快捷注册一个不入连锁把从额外卡放置在魔陷区的效果,co为条件,fun1为放置前执行部分,fun2为放置后执行部分,lx为变成的类型
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local tp = e:GetHandlerPlayer()
local c = e:GetHandler()
return Duel.GetTurnPlayer() == tp and (not co or co(e, tp, eg, ep, ev, re, r, rp)) and
(Duel.GetCurrentPhase() == PHASE_MAIN1 or Duel.GetCurrentPhase() == PHASE_MAIN2)
end)
e2:SetOperation(function(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
if fun1 then
fun1(e, tp, eg, ep, ev, re, r, rp)
end
if Duel.MoveToField(c, tp, tp, LOCATION_SZONE, POS_FACEUP, true) then
local e1 = Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
e1:SetValue(lx)
c:RegisterEffect(e1)
if fun2 then
fun2(e, tp, eg, ep, ev, re, r, rp)
end
end
end)
c:RegisterEffect(e2)
return e2
end
--为效果e添加模拟魔法发动,如自由时点效果变魔法发动,具体表现为发动前先移到场上,但并未修改实际发动位置,后续可能会有问题
function it.EmulateSZONE(c, e)
if not it.gall then
......@@ -667,7 +710,7 @@ function it.CopyEquip(tp, c1, c2, up)
Duel.RaiseEvent(eg, EVENT_EQUIP, nil, 0, tp, tp, 0)
end
--读取库时的初始化设置
--读取库时的对局初始化设置
local tableclone = function(tab, mytab)
local res = mytab or {}
for i, v in pairs(tab) do res[i] = v end
......@@ -676,6 +719,7 @@ end
local _Card = tableclone(Card)
local _Duel = tableclone(Duel)
local _Group = tableclone(Group)
local _Effect = tableclone(Effect)
--记录所有被写入到卡上的效果
Card.RegisterEffect = function(c, e, ...)
......@@ -688,6 +732,18 @@ Card.RegisterEffect = function(c, e, ...)
return _Card.RegisterEffect(c, e, ...)
end
--记录所有效果的id
Effect.SetCountLimit = function(e, ...)
if not it.coube then
it.coube = {}
end
if aux.GetValueType(e) ~= "Effect" then return _Effect.SetCountLimit(e, ...) end
local ab = it.coube
ab[e] = ab[e] or {}
ab[e][#ab[e] + 1] = { ... }
return _Effect.SetCountLimit(e, ...)
end
--尝试使用非k端时的代替函数 (失败了)
-- if not Effect.GetCountLimit then
-- local _SetCountLimit = Effect.SetCountLimit
......
......@@ -53,6 +53,15 @@ function s.initial_effect(c)
e7:SetCondition(s.leavecon)
e7:SetOperation(s.leaveop)
c:RegisterEffect(e7)
--Remove
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EFFECT_SEND_REPLACE)
e2:SetCondition(s.leavecon)
e2:SetTarget(s.reptg)
e2:SetValue(aux.TRUE)
--c:RegisterEffect(e2)
end
function s.actcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsFacedown()
......@@ -122,15 +131,30 @@ end
function s.stg(e,c)
return c:GetOriginalType()&(TYPE_SPELL+TYPE_TRAP)>0 and not c:IsLocation(LOCATION_OVERLAY) and not c:IsType(TYPE_MONSTER)
end
function s.sfilter(c)
return c:GetOriginalType()&(TYPE_SPELL+TYPE_TRAP)>0 and not c:IsLocation(LOCATION_OVERLAY) and not c:IsType(TYPE_MONSTER)
function s.sfilter(c,tp)
return c:GetOriginalType()&(TYPE_SPELL+TYPE_TRAP)>0 and c:IsControler(tp) and not c:IsLocation(LOCATION_OVERLAY) and not c:IsType(TYPE_MONSTER) and c:GetReason()&REASON_REDIRECT==0 and c:GetFlagEffect(id)==0
end
function s.leavecon(e,tp,eg,ep,ev,re,r,rp)
return r&REASON_REDIRECT==0 and eg:FilterCount(s.sfilter,nil)>0
return r&REASON_REDIRECT==0 and eg:FilterCount(s.sfilter,nil,tp)>0
end
function s.leaveop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(s.sfilter,nil)
local g=eg:Filter(s.sfilter,nil,tp)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT+REASON_REDIRECT)
for tc in aux.Next(g) do
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1)
end
r=r|REASON_EFFECT+REASON_REDIRECT
Duel.Remove(g,POS_FACEDOWN,r)
end
end
function s.repfilter(c,tp)
return c:IsOnField() and (c:IsFaceup() or c:GetDestination()==LOCATION_GRAVE) and c:IsControler(tp) and c:IsAbleToRemove() and c:GetOriginalType()&(TYPE_SPELL+TYPE_TRAP)>0 and not c:IsLocation(LOCATION_OVERLAY) and not c:IsType(TYPE_MONSTER)
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local g=eg:Filter(s.repfilter,nil,tp)
if chk==0 then return g:GetCount()>0 end
if Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT+REASON_REDIRECT)>0 then
return true
else return false end
end
\ No newline at end of file
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