Commit e4ffe3c3 authored by POLYMER's avatar POLYMER

fix

parent da7d8fad
This diff is collapsed.
...@@ -111,14 +111,20 @@ function xg.epp2(c, id, cf, co, ta, qy, h1, h2, h3, h4, zc) --XG.epp2(c,m,2,nil, ...@@ -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 elseif ta ~= nil then
c3 = c3|ta c3 = c3|ta
end end
e1:SetProperty(c3)
if qy ~= nil then if qy ~= nil then
e1:SetRange(qy) e1:SetRange(qy)
end end
e1:SetType(c1) e1:SetType(c1)
e1:SetCode(c2) e1:SetCode(c2)
e1:SetProperty(c3) if id ~= nil then
if zc == true then if aux.GetValueType(id) == "number" and id < 99 then
c:RegisterEffect(e1) 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 end
if h1 ~= nil then if h1 ~= nil then
e1:SetCondition(h1) 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, ...@@ -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 if h4 ~= nil then
e1:SetOperation(h4) e1:SetOperation(h4)
end end
if zc == true then
c:RegisterEffect(e1)
end
return e1 return e1
end end
...@@ -205,7 +214,7 @@ end ...@@ -205,7 +214,7 @@ end
--魂精 --魂精
hj = hj or {} hj = hj or {}
--泛用 --泛用便利函数
function it.GetEffectValue(e, ...) --检测e的val是否函数,是的场合执行函数内容 function it.GetEffectValue(e, ...) --检测e的val是否函数,是的场合执行函数内容
local v = e:GetValue() local v = e:GetValue()
if aux.GetValueType(v) == "function" then if aux.GetValueType(v) == "function" then
...@@ -253,41 +262,41 @@ function it.num(num, tp) --检测无尽贪婪已减少多少张卡的使用 ...@@ -253,41 +262,41 @@ function it.num(num, tp) --检测无尽贪婪已减少多少张卡的使用
return num return num
end end
function it.sxbl() --所谓伊人相关检测全种族全属性全等级可特招 function it.sxbl() --所谓伊人相关检测全种族全属性全等级可特招
local zzjc = { RACE_WARRIOR, --战士 local zzjc = { RACE_WARRIOR, --战士
RACE_SPELLCASTER, --魔法师 RACE_SPELLCASTER, --魔法师
RACE_FAIRY, --天使 RACE_FAIRY, --天使
RACE_FIEND, --恶魔 RACE_FIEND, --恶魔
RACE_ZOMBIE, --不死 RACE_ZOMBIE, --不死
RACE_MACHINE, --机械 RACE_MACHINE, --机械
RACE_AQUA, --水 RACE_AQUA, --水
RACE_PYRO, --炎 RACE_PYRO, --炎
RACE_ROCK, --岩石 RACE_ROCK, --岩石
RACE_WINDBEAST, --鸟兽 RACE_WINDBEAST, --鸟兽
RACE_PLANT, --植物 RACE_PLANT, --植物
RACE_INSECT, --昆虫 RACE_INSECT, --昆虫
RACE_THUNDER, --雷 RACE_THUNDER, --雷
RACE_DRAGON, --龙 RACE_DRAGON, --龙
RACE_BEAST, --兽 RACE_BEAST, --兽
RACE_BEASTWARRIOR, --兽战士 RACE_BEASTWARRIOR, --兽战士
RACE_DINOSAUR, --恐龙 RACE_DINOSAUR, --恐龙
RACE_FISH, --鱼 RACE_FISH, --鱼
RACE_SEASERPENT, --海龙 RACE_SEASERPENT, --海龙
RACE_REPTILE, --爬虫类 RACE_REPTILE, --爬虫类
RACE_PSYCHO, --念动力 RACE_PSYCHO, --念动力
RACE_DIVINE, --幻神兽 RACE_DIVINE, --幻神兽
RACE_CREATORGOD, --创造神 RACE_CREATORGOD, --创造神
RACE_WYRM, --幻龙 RACE_WYRM, --幻龙
RACE_CYBERSE, --电子界 RACE_CYBERSE, --电子界
RACE_ILLUSION --幻想魔 RACE_ILLUSION --幻想魔
} }
local sxjc = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40 } local sxjc = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40 } --可选属性
local zzl = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } local zzl = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } --可选等级
local zzx = 0 --可选种族 local zzx = 0 --可选种族数
for _, z in ipairs(zzjc) do for _, z in ipairs(zzjc) do
zzx = zzx + z zzx = zzx + z
end end
local sxx = 0 --可选属性 local sxx = 0 --可选属性
for _, z in ipairs(sxjc) do for _, z in ipairs(sxjc) do
sxx = sxx + z sxx = sxx + z
end end
...@@ -340,6 +349,40 @@ function it.sxblx(tp, kx, zzx, sxx, zzl) --宣言1个可特招的种族属性等 ...@@ -340,6 +349,40 @@ function it.sxblx(tp, kx, zzx, sxx, zzl) --宣言1个可特招的种族属性等
return zz, sx, lv return zz, sx, lv
end 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添加模拟魔法发动,如自由时点效果变魔法发动,具体表现为发动前先移到场上,但并未修改实际发动位置,后续可能会有问题 --为效果e添加模拟魔法发动,如自由时点效果变魔法发动,具体表现为发动前先移到场上,但并未修改实际发动位置,后续可能会有问题
function it.EmulateSZONE(c, e) function it.EmulateSZONE(c, e)
if not it.gall then if not it.gall then
...@@ -667,7 +710,7 @@ function it.CopyEquip(tp, c1, c2, up) ...@@ -667,7 +710,7 @@ function it.CopyEquip(tp, c1, c2, up)
Duel.RaiseEvent(eg, EVENT_EQUIP, nil, 0, tp, tp, 0) Duel.RaiseEvent(eg, EVENT_EQUIP, nil, 0, tp, tp, 0)
end end
--读取库时的初始化设置 --读取库时的对局初始化设置
local tableclone = function(tab, mytab) local tableclone = function(tab, mytab)
local res = mytab or {} local res = mytab or {}
for i, v in pairs(tab) do res[i] = v end for i, v in pairs(tab) do res[i] = v end
...@@ -676,6 +719,7 @@ end ...@@ -676,6 +719,7 @@ end
local _Card = tableclone(Card) local _Card = tableclone(Card)
local _Duel = tableclone(Duel) local _Duel = tableclone(Duel)
local _Group = tableclone(Group) local _Group = tableclone(Group)
local _Effect = tableclone(Effect)
--记录所有被写入到卡上的效果 --记录所有被写入到卡上的效果
Card.RegisterEffect = function(c, e, ...) Card.RegisterEffect = function(c, e, ...)
...@@ -688,6 +732,18 @@ Card.RegisterEffect = function(c, e, ...) ...@@ -688,6 +732,18 @@ Card.RegisterEffect = function(c, e, ...)
return _Card.RegisterEffect(c, e, ...) return _Card.RegisterEffect(c, e, ...)
end 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端时的代替函数 (失败了) --尝试使用非k端时的代替函数 (失败了)
-- if not Effect.GetCountLimit then -- if not Effect.GetCountLimit then
-- local _SetCountLimit = Effect.SetCountLimit -- local _SetCountLimit = Effect.SetCountLimit
......
...@@ -53,6 +53,15 @@ function s.initial_effect(c) ...@@ -53,6 +53,15 @@ function s.initial_effect(c)
e7:SetCondition(s.leavecon) e7:SetCondition(s.leavecon)
e7:SetOperation(s.leaveop) e7:SetOperation(s.leaveop)
c:RegisterEffect(e7) 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 end
function s.actcon(e,tp,eg,ep,ev,re,r,rp) function s.actcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsFacedown() return e:GetHandler():IsFacedown()
...@@ -122,15 +131,30 @@ end ...@@ -122,15 +131,30 @@ end
function s.stg(e,c) 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) return c:GetOriginalType()&(TYPE_SPELL+TYPE_TRAP)>0 and not c:IsLocation(LOCATION_OVERLAY) and not c:IsType(TYPE_MONSTER)
end end
function s.sfilter(c) function s.sfilter(c,tp)
return c:GetOriginalType()&(TYPE_SPELL+TYPE_TRAP)>0 and not c:IsLocation(LOCATION_OVERLAY) and not c:IsType(TYPE_MONSTER) 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 end
function s.leavecon(e,tp,eg,ep,ev,re,r,rp) 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 end
function s.leaveop(e,tp,eg,ep,ev,re,r,rp) 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 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
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 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