Commit 317c1acb authored by xiaoye's avatar xiaoye

fixed 20240809/1328

parent a3da1ccd
...@@ -22,20 +22,61 @@ function VgD.RideUp(c) ...@@ -22,20 +22,61 @@ function VgD.RideUp(c)
e2:SetOperation(VgD.RideUpOperation) e2:SetOperation(VgD.RideUpOperation)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function VgD.RideUpFilter1(c,e,lv,code,rc) function VgD.RideUpMaterialCheck(c,rc)
if VgF.GetValueType(c.ride_material_code_chk)=="nil" and VgF.GetValueType(c.ride_material_setcard_chk)=="nil" then return true end
if VgF.GetValueType(c.ride_material_code_chk)=="number" then
if VgF.GetValueType(rc.ride_code)=="number" and c.ride_material_code_chk==rc.ride_code then return true
elseif VgF.GetValueType(rc.ride_code)=="tabel" then
for code in ipairs(rc.ride_code) do
if c.ride_material_code_chk==code then return true end
end
end
return c.ride_material_code_chk==rc:GetCode()
elseif VgF.GetValueType(c.ride_material_code_chk)=="tabel" then
for i in ipairs(c.ride_material_code_chk) do
if VgF.GetValueType(rc.ride_code)=="number" and i==rc.ride_code then return true
elseif VgF.GetValueType(rc.ride_code)=="tabel" then
for code in ipairs(rc.ride_code) do
if i==code then return true end
end
end
if rc:IsCode(i) then return true end
end
end
if VgF.GetValueType(c.ride_material_setcard_chk)=="number" then
if VgF.GetValueType(rc.ride_setcard)=="number" and c.ride_material_setcard_chk==rc.ride_setcard then return true
elseif VgF.GetValueType(rc.ride_setcard)=="tabel" then
for setcard in ipairs(rc.ride_setcard) do
if c.ride_material_code_chk==setcard then return true end
end
end
return rc:IsSetCard(c.ride_material_setcard_chk)
elseif VgF.GetValueType(c.ride_material_setcard_chk)=="tabel" then
for i in ipairs(c.ride_material_setcard_chk) do
if VgF.GetValueType(rc.ride_setcard)=="number" and i==rc.ride_setcard then return true
elseif VgF.GetValueType(rc.ride_setcard)=="tabel" then
for setcard in ipairs(rc.ride_setcard) do
if i==setcard then return true end
end
end
if rc:IsSetCard(i) then return true end
end
end
return false
end
function VgD.RideUpFilter1(c,lv,code,rc)
local tp=c:GetControler() local tp=c:GetControler()
if not c:IsType(TYPE_MONSTER) then return false end if not c:IsType(TYPE_MONSTER) then return false end
if rc:IsAttribute(SKILL_SELF_RIDE) and c:IsCode(code) then return false end if rc:IsAttribute(SKILL_SELF_RIDE) and c:IsCode(code) then return false end
if (c:IsLevel(lv,lv+1) and c:IsLocation(LOCATION_HAND)) then return true end if (c:IsLevel(lv,lv+1) and c:IsLocation(LOCATION_HAND)) then return VgD.RideUpMaterialCheck(c,rc) end
if (c:IsLevel(lv+1) and c:IsLocation(LOCATION_RIDE) and (VgF.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,1,nil) or (Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE) and VgF.GetVMonster(tp):GetOverlayCount()>0))) then return true end if (c:IsLevel(lv+1) and c:IsLocation(LOCATION_RIDE) and (VgF.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,1,nil) or (Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE) and VgF.GetVMonster(tp):GetOverlayCount()>0))) then return VgD.RideUpMaterialCheck(c,rc) end
return false return false
end end
function VgD.DisCardRideUpFilter(c,e,lv,code,rc) function VgD.DisCardRideUpFilter(c,e,lv,code,rc)
local tp=c:GetControler() local tp=c:GetControler()
return c:IsDiscardable() and VgF.IsExistingMatchingCard(VgD.RideUpFilter1,tp,LOCATION_HAND+LOCATION_RIDE,0,1,c,e,lv,code,rc) return c:IsDiscardable() and VgF.IsExistingMatchingCard(VgD.RideUpFilter1,tp,LOCATION_HAND+LOCATION_RIDE,0,1,c,lv,code,rc)
end end
function VgD.RideUpFilter2(c,e,lv,code,rc) function VgD.RideUpFilter2(c,lv,code,rc)
local tp=e:GetHandlerPlayer()
return c:IsLevel(lv) and c:IsType(TYPE_MONSTER) and c:IsCode(code) and rc:IsAttribute(SKILL_SELF_RIDE) return c:IsLevel(lv) and c:IsType(TYPE_MONSTER) and c:IsCode(code) and rc:IsAttribute(SKILL_SELF_RIDE)
end end
function VgD.RideUpCondition(e,tp,eg,ep,ev,re,r,rp) function VgD.RideUpCondition(e,tp,eg,ep,ev,re,r,rp)
...@@ -43,20 +84,20 @@ function VgD.RideUpCondition(e,tp,eg,ep,ev,re,r,rp) ...@@ -43,20 +84,20 @@ function VgD.RideUpCondition(e,tp,eg,ep,ev,re,r,rp)
if not rc then return false end if not rc then return false end
local lv=rc:GetLevel() local lv=rc:GetLevel()
local code=rc:GetCode() local code=rc:GetCode()
local rg1=Duel.GetMatchingGroup(VgD.RideUpFilter1,tp,LOCATION_HAND+LOCATION_RIDE,0,nil,e,lv,code,rc) local rg1=Duel.GetMatchingGroup(VgD.RideUpFilter1,tp,LOCATION_HAND+LOCATION_RIDE,0,nil,lv,code,rc)
local rg2=Duel.GetMatchingGroup(VgD.RideUpFilter2,tp,LOCATION_HAND,0,nil,e,lv,code,rc) local rg2=Duel.GetMatchingGroup(VgD.RideUpFilter2,tp,LOCATION_HAND,0,nil,lv,code,rc)
local a=rg1:GetCount()>0 local a=rg1:GetCount()>0
local b=rg2:GetCount()>0 local b=rg2:GetCount()>0
return Duel.GetTurnPlayer()==tp and VgF.RuleCardCondtion(e) and (a or b) return Duel.GetTurnPlayer()==tp and VgF.RuleCardCondtion(e) and (a or b)
end end
function VgD.RideUpOperation(e,tp,eg,ep,ev,re,r,rp) function VgD.RideUpOperation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local rc=Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst() local rc=VgF.GetVMonster(tp)
if not rc then return end if not rc then return end
local lv=rc:GetLevel() local lv=rc:GetLevel()
local code=rc:GetCode() local code=rc:GetCode()
local rg1=Duel.GetMatchingGroup(VgD.RideUpFilter1,tp,LOCATION_HAND+LOCATION_RIDE,0,nil,e,lv,code,rc) local rg1=Duel.GetMatchingGroup(VgD.RideUpFilter1,tp,LOCATION_HAND+LOCATION_RIDE,0,nil,lv,code,rc)
local rg2=Duel.GetMatchingGroup(VgD.RideUpFilter2,tp,LOCATION_HAND,0,nil,e,lv,code,rc) local rg2=Duel.GetMatchingGroup(VgD.RideUpFilter2,tp,LOCATION_HAND,0,nil,lv,code,rc)
local a=rg1:GetCount()>0 local a=rg1:GetCount()>0
local b=rg2:GetCount()>0 local b=rg2:GetCount()>0
local off=1 local off=1
...@@ -764,57 +805,187 @@ end ...@@ -764,57 +805,187 @@ end
---@param cost any|nil 作为指令卡的发动费用 ---@param cost any|nil 作为指令卡的发动费用
function VgD.SpellActivate(c,m,op,cost,con) function VgD.SpellActivate(c,m,op,cost,con)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
if m then e1:SetDescription(VgF.Stringid(m, 0)) end e1:SetDescription(VgF.Stringid(m, 0))
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,VgID+EFFECT_COUNT_CODE_OATH)
e1:SetCost(VgD.MixCost(cost)) e1:SetCost(VgD.MixCost(cost))
e1:SetCondition(VgD.SpellCondtion(con)) e1:SetCondition(VgD.SpellCondtion(con))
e1:Settarget(VgD.SpellTarget) e1:SetTarget(VgD.SpellTarget)
e1:SetOperation(VgD.SpellOperation(op)) e1:SetOperation(VgD.SpellOperation(op))
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function VgF.MixFilter(mg, cf, cval, bf, bmin, bmax, bval)
return function(g)
if cf and not cf(g, table.unpack(cval)) then return false end
return not bf or (mg - g):CheckSubGroup(bf, bmin, bmax, table.unpack(bval))
end
end
function VgD.MixCostFilter(c,e,tp,eg,ep,ev,re,r,rp,mc) function VgD.MixCostFilter(c,e,tp,eg,ep,ev,re,r,rp,mc)
if Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_MIX_DIFFERENT_NAME) and c:IsCode(mc:GetCode()) then return false end if Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_MIX_DIFFERENT_NAME) and c:IsCode(mc:GetCode()) then return false end
local ce = c:GetActivateEffect() local ce = c:GetActivateEffect()
if not ce or (ce:GetCost() and not ce:GetCost()(e,tp,eg,ep,ev,re,r,rp,chk)) then return false end if not ce or (ce:GetCost() and not ce:GetCost()(e,tp,eg,ep,ev,re,r,rp,0)) then return false end
local cg, cval = mc.cos_g, mc.cos_val --c.cos_from, c.cos_to, c.cos_filter, c.cos_val
local bg, bval = c.cos_g, c.cos_val local cfrom, cval, cfilter=c.cos_from, c.cos_val, c.cos_filter
if not (cg and bg and cval and bval) then return 1 end local mcfrom, mcval, mcfilter=mc.cos_from, mc.cos_val, mc.cos_filter
local mg = cg + bg if #cfrom>0 and #mcfrom>0 then
local cf = table.remove(cval, 1) for c_cost_from,cv in ipairs(cfrom) do
local min = table.remove(cval, 1) local pos=0
local max = table.remove(cval, 1) for mc_cost_from,mcv in ipairs(mcfrom) do
local bf = table.remove(bval, 1) if mc_cost_from==c_cost_from then
local bmin = table.remove(bval, 1) pos=mcv
local bmax = table.remove(bval, 1) local mc_cos_val=mcval[mcv]
local mix_f = VgF.MixFilter(mg, cf, cval, bf, bmin, bmax, bval) local c_cos_val=cval[cv]
return mg:CheckSubGroup(mix_f, min, max) and VgF.LvCondition(c) if mc_cost_from==LOCATION_OVERLAY and Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX) then mc_cos_val,c_cos_val=0,0 end
local mcg=VgF.GetMatchingGroup(mcfilter[mcv],tp,mc_cost_from,0,c,e,tp)
local cg=VgF.GetMatchingGroup(cfilter[cv],tp,c_cost_from,0,mc,e,tp)
if mcg:GetCount()<mc_cos_val or cg:GetCount()<c_cos_val then return false end
mcg:Merge(cg)
if mcg:GetCount()<mc_cos_val+c_cos_val then return false end
end
end
if pos>0 then
table.remove(mcfrom,pos)
table.remove(mcval,pos)
table.remove(mcfilter,pos)
else
local c_cos_val=cval[cv]
if c_cost_from==LOCATION_OVERLAY and Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX) then c_cos_val=0 end
local cg=VgF.GetMatchingGroup(cfilter[cv],tp,c_cost_from,0,mc,e,tp)
if cg:GetCount()<c_cos_val then return false end
end
end
if #mcfrom>0 then
for mc_cost_from,mcv in ipairs(mcfrom) do
local mc_cos_val=mcval[mcv]
if mc_cost_from==LOCATION_OVERLAY and Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX) then mc_cos_val=0 end
local mcg=VgF.GetMatchingGroup(mcfilter[mcv],tp,mc_cost_from,0,c,e,tp)
if mcg:GetCount()<mc_cos_val then return false end
end
end
end
return true--VgF.LvCondition(c)
end end
function VgD.MixCost(cost) function VgD.MixCost(cost)
return function(e,tp,eg,ep,ev,re,r,rp,chk,bool) return function(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then return VgF.GetValueType(cost)~="function" or cost(e,tp,eg,ep,ev,re,r,rp,chk) end if chk==0 then return VgF.GetValueType(cost)~="function" or cost(e,tp,eg,ep,ev,re,r,rp,chk) end
if not bool and (Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_MIX) and VgF.IsExistingMatchingCard(VgD.MixCostFilter,tp,LOCATION_DROP,0,1,nil,e,tp,eg,ep,ev,re,r,rp,c) and Duel.SelectYesNo(tp,VgF.Stringid(VgID,6))) then if --[[Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_MIX) and]] VgF.IsExistingMatchingCard(VgD.MixCostFilter,tp,LOCATION_DROP,0,1,nil,e,tp,eg,ep,ev,re,r,rp,c) and Duel.SelectYesNo(tp,VgF.Stringid(VgID,6)) then
local bc=Duel.SelectMatchingCard(tp,VgD.MixCostFilter,tp,LOCATION_DROP,0,1,1,nil,e,tp,eg,ep,ev,re,r,rp,c):GetFirst() local bc=Duel.SelectMatchingCard(tp,VgD.MixCostFilter,tp,LOCATION_DROP,0,1,1,nil,e,tp,eg,ep,ev,re,r,rp,c):GetFirst()
if cost then cost(e,tp,eg,ep,ev,re,r,rp) end --if VgF.GetValueType(cost)=="function" then cost(e,tp,eg,ep,ev,re,r,rp) end
if bc then if bc then
VgF.Sendto(LOCATION_REMOVED,bc,POS_FACEUP,REASON_COST) VgF.Sendto(LOCATION_LOCK,bc,POS_FACEUP,REASON_COST)
e:SetLabelObject(bc) e:SetLabelObject(bc)
local bce = bc:GetActivateEffect() --[[local bce = bc:GetActivateEffect()
if bce and bce:GetCost() then bce:GetCost()(e,tp,eg,ep,ev,re,r,rp,chk,true) end if bce and bce:GetCost() then bce:GetCost()(e,tp,eg,ep,ev,re,r,rp,chk,true) end]]
VgD.MixCostOperation(c,bc,e,tp)
end end
else else
if cost then cost(e,tp,eg,ep,ev,re,r,rp) end if VgF.GetValueType(cost)=="function" then cost(e,tp,eg,ep,ev,re,r,rp) end
end end
end end
end end
function VgD.MixCostOperation(c,bc,e,tp)
local cfrom, cto, cval, cval_max, cfilter=c.cos_from, c.cos_to, c.cos_val, c.cos_val_max, c.cos_filter
local bcfrom, bcto, bcval, bcval_max, bcfilter=bc.cos_from, bc.cos_to, bc.cos_val, bc.cos_val_max, bc.cos_filter
local g={}
local g_from={}
local g_to={}
local g_filter_c={}
local g_filter_bc={}
local g_val_c={}
local g_val_bc={}
local g_val_c_max={}
local g_val_bc_max={}
local except_group=Group.FromCards(c,bc)
for bc_cost_from,bcv in ipairs(bcfrom) do
local pos=0
for c_cost_from,cv in ipairs(cfrom) do
if bc_cost_from==c_cost_from and cto[cv]==bcto[bcv] then
pos=bcv
local sg=Duel.GetMatchingGroup(nil,tp,bc_cost_from,0,except_group)
table.insert(g,sg)
table.insert(g_from,c_cost_from)
table.insert(g_to,cto[cv])
table.insert(g_filter_c,cfilter[cv])
table.insert(g_filter_bc,bcfilter[bcv])
table.insert(g_val_c,cval[cv])
table.insert(g_val_bc,bcval[bcv])
table.insert(g_val_c_max,cval_max[cv])
table.insert(g_val_bc_max,bcval_max[bcv])
end
end
if pos>0 then
table.remove(bcfrom,pos)
table.remove(bcto,pos)
table.remove(bcval,pos)
table.remove(bcval_max,pos)
table.remove(bcfilter,pos)
else
local sg=Duel.GetMatchingGroup(nil,tp,bc_cost_from,0,except_group)
table.insert(g,sg)
table.insert(g_from,bc_cost_from)
table.insert(g_to,bcto[bcv])
table.insert(g_filter_c,nil)
table.insert(g_filter_bc,bcfilter[bcv])
table.insert(g_val_c,0)
table.insert(g_val_bc,bcval[bcv])
table.insert(g_val_c_max,0)
table.insert(g_val_bc_max,bcval_max[bcv])
end
end
if #cfrom>0 then
for c_cost_from,cv in ipairs(cfrom) do
local sg=Duel.GetMatchingGroup(nil,tp,c_cost_from,0,except_group)
table.insert(g,sg)
table.insert(g_to,cto[cv])
table.insert(g_filter_c,cfilter[cv])
table.insert(g_filter_bc,nil)
table.insert(g_val_c,cval[cv])
table.insert(g_val_bc,0)
table.insert(g_val_c_max,cval_max[cv])
table.insert(g_val_bc_max,0)
end
end
for i=1,#g do
local tg=g[i]
if tg:GetCount()==0 then goto continue end
local tg_from=g_from[i]
local tg_to=g_to[i]
local tg_filter_c=g_filter_c[i]
local tg_filter_bc=g_filter_bc[i]
local tg_val_c=g_val_c[i]
local tg_val_bc=g_val_bc[i]
local tg_val_c_max=g_val_c_max[i]
local tg_val_bc_max=g_val_bc_max[i]
local hintmsg=HINTMSG_SELECT
local ext_params={}
if VgF.GetValueType(tg_to)=="number" then
if tg_to==LOCATION_DROP then
if tg_from==LOCATION_MZONE then
hintmsg=HINTMSG_LEAVEONFIELD
elseif tg_from==LOCATION_OVERLAY then hintmsg=HINTMSG_REMOVEXYZ
else hintmsg=HINTMSG_TODROP end
ext_params={REASON_COST}
elseif bit.band(tg_to,LOCATION_LOCK)>0 then
hintmsg=HINTMSG_LOCK
if bit.band(tg_to,POS_FACEUP)>0 then ext_params={POS_FACEUP,REASON_COST} end
if bit.band(tg_to,POS_FACEDOWN)>0 then ext_params={POS_FACEDOWN,REASON_COST} end
elseif bit.band(tg_to,LOCATION_EXILE)>0 then
hintmsg=HINTMSG_REMOVE
if bit.band(tg_to,POS_FACEUP)>0 then ext_params={tp,POS_FACEUP,REASON_COST} end
if bit.band(tg_to,POS_FACEDOWN)>0 then ext_params={tp,POS_FACEDOWN,REASON_COST} end
elseif tg_to==LOCATION_DECK then
hintmsg=HINTMSG_TODECK
ext_params={tp,SEQ_DECKSHUFFLE,REASON_COST}
elseif tg_to==LOCATION_HAND then
hintmsg=HINTMSG_ATOHAND
ext_params={nil,REASON_COST}
elseif tg_to==LOCATION_OVERLAY then
hintmsg=HINTMSG_XMATERIAL
ext_params={VgF.GetVMonster(tp)}
end
elseif VgF.GetValueType(tg_to)=="string" then hintmsg=HINTMSG_POSCHANGE
end
Duel.Hint(HINT_SELECTMSG,tp,hintmsg)
local sg=tg:SelectDoubleSubGroup(tp,tg_filter_c,tg_val_c,tg_val_c_max,tg_filter_bc,tg_val_bc,tg_val_bc_max,Group.FromCards(c,bc))
VgF.Sendto(tg_to,sg,ext_params)
::continue::
end
end
function VgD.SpellCondtion(con) function VgD.SpellCondtion(con)
return function (e,tp,eg,ep,ev,re,r,rp) return function (e,tp,eg,ep,ev,re,r,rp)
if VgF.GetValueType(con)=="function" and not con(e,tp,eg,ep,ev,re,r,rp) then return false end if VgF.GetValueType(con)=="function" and not con(e,tp,eg,ep,ev,re,r,rp) then return false end
......
...@@ -729,7 +729,7 @@ HINTMSG_DISCARD =501 --请选择要丢弃的手牌 ...@@ -729,7 +729,7 @@ HINTMSG_DISCARD =501 --请选择要丢弃的手牌
HINTMSG_IMPRISON =502 --请选择要收容的卡 HINTMSG_IMPRISON =502 --请选择要收容的卡
HINTMSG_REMOVE =503 --请选择要除外的卡 HINTMSG_REMOVE =503 --请选择要除外的卡
HINTMSG_TODROP =504 --请选择要置入弃牌区的卡 HINTMSG_TODROP =504 --请选择要置入弃牌区的卡
HINTMSG_RTOHAND =505 --请选择要返回手牌的卡 HINTMSG_LOCK =505 --请选择要封锁的卡
HINTMSG_ATOHAND =506 --请选择要加入手牌的卡 HINTMSG_ATOHAND =506 --请选择要加入手牌的卡
HINTMSG_TODECK =507 --请选择要返回卡组的卡 HINTMSG_TODECK =507 --请选择要返回卡组的卡
HINTMSG_CALL =508 --请选择要Call到圆阵的卡 HINTMSG_CALL =508 --请选择要Call到圆阵的卡
...@@ -753,7 +753,7 @@ HINTMSG_POSCHANGE =528 --请选择要改变表示形式的怪兽 ...@@ -753,7 +753,7 @@ HINTMSG_POSCHANGE =528 --请选择要改变表示形式的怪兽
HINTMSG_SELF =529 --请选择自己的卡 HINTMSG_SELF =529 --请选择自己的卡
HINTMSG_OPPO =530 --请选择对方的卡 HINTMSG_OPPO =530 --请选择对方的卡
HINTMSG_TRIBUTE =531 --请选择上级召唤用需要解放的怪兽 HINTMSG_TRIBUTE =531 --请选择上级召唤用需要解放的怪兽
HINTMSG_DEATTACHFROM =532 --请选择要取除超量素材的怪兽 HINTMSG_REMOVEXYZ =532 --请选择要拔除的卡
HINTMSG_OVERLAY =533 --请选择要重叠的卡 HINTMSG_OVERLAY =533 --请选择要重叠的卡
HINTMSG_ATTACKTARGET =549 --请选择攻击的对象 HINTMSG_ATTACKTARGET =549 --请选择攻击的对象
HINTMSG_EFFECT =550 --请选择要发动的效果 HINTMSG_EFFECT =550 --请选择要发动的效果
...@@ -871,6 +871,7 @@ AFFECT_CODE_MIX_DIFFERENT_NAME =VgID+1 --魔合成(卡名不同) ...@@ -871,6 +871,7 @@ AFFECT_CODE_MIX_DIFFERENT_NAME =VgID+1 --魔合成(卡名不同)
AFFECT_CODE_BOTH_WING =VgID+2 --你的卡片的白翼能力和黑翼能力两方均有效 AFFECT_CODE_BOTH_WING =VgID+2 --你的卡片的白翼能力和黑翼能力两方均有效
AFFECT_CODE_NIGHT =VgID+3 --黑夜 AFFECT_CODE_NIGHT =VgID+3 --黑夜
AFFECT_CODE_DEEP_NIGHT =VgID+4 --深渊黑夜 AFFECT_CODE_DEEP_NIGHT =VgID+4 --深渊黑夜
AFFECT_CODE_OVERLAY_COST_FREE_WHEN_MIX =VgID+5 --魔合成可以不支付灵魂爆发
AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE =10501082 --不执行『选择手牌中的1张卡,舍弃』而是执行『灵魂爆发1』来将卡RIDE AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE =10501082 --不执行『选择手牌中的1张卡,舍弃』而是执行『灵魂爆发1』来将卡RIDE
......
...@@ -110,14 +110,14 @@ function VgF.ReturnCard(g) ...@@ -110,14 +110,14 @@ function VgF.ReturnCard(g)
end end
return tc return tc
end end
---返回g的前num张卡。 ---返回g的前val张卡。
---@param g Group 要操作的卡片组 ---@param g Group 要操作的卡片组
---@param num integer 要获取的卡片数量 ---@param val integer 要获取的卡片数量
function VgF.GetCardsFromGroup(g,num) function VgF.GetCardsFromGroup(g,val)
if VgF.GetValueType(g)=="Group" then if VgF.GetValueType(g)=="Group" then
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
for tc in VgF.Next(g) do for tc in VgF.Next(g) do
if sg:GetCount()>=num then break end if sg:GetCount()>=val then break end
sg:AddCard(tc) sg:AddCard(tc)
end end
return sg return sg
...@@ -497,122 +497,137 @@ function VgF.IsAbleToGZone(c,loc) ...@@ -497,122 +497,137 @@ function VgF.IsAbleToGZone(c,loc)
end end
return false return false
end end
---用于效果的Operation。它返回一个执行“[计数回充num]”的函数。 ---用于效果的Operation。它返回一个执行“[计数回充val]”的函数。
---@param num integer 计数回充的数量 ---@param val integer 计数回充的数量
---@return function 效果的Operation函数 ---@return function 效果的Operation函数
function VgF.DamageFill(num) function VgF.DamageFill(val)
return function (e,tp,eg,ep,ev,re,r,rp) return function (e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_DAMAGE,0,num,num,nil) local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_DAMAGE,0,val,val,nil)
Duel.ChangePosition(g,POS_FACEUP_ATTACK) Duel.ChangePosition(g,POS_FACEUP_ATTACK)
return Duel.GetOperatedGroup():GetCount() return Duel.GetOperatedGroup():GetCount()
end end
end end
---用于效果的Cost。它返回一个执行“【费用】[将手牌中的num张卡舍弃]”的函数。 ---用于效果的Cost。它返回一个执行“【费用】[将手牌中的val张卡舍弃]”的函数。
---@param num integer 要舍弃的卡的数量 ---@param val integer 要舍弃的卡的数量
---@return function 效果的Cost函数 ---@return function 效果的Cost函数
function VgF.DisCardCost(num) function VgF.DisCardCost(val)
return function (e,tp,eg,ep,ev,re,r,rp,chk) return function (e,tp,eg,ep,ev,re,r,rp,chk)
if VgF.GetValueType(num)~="number" then return 0 end if VgF.GetValueType(val)~="number" then return 0 end
local c=e:GetHandler() local c=e:GetHandler()
local m=c:GetOriginalCode() local m=c:GetOriginalCode()
local cm=_G["c"..m] local cm=_G["c"..m]
if chk==0 then if chk==0 then
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
cm.cos_g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND,0,nil) cm.cos_from={LOCATION_HAND}
cm.cos_val={nil,num,num} cm.cos_to={LOCATION_HAND}
cm.cos_val={val}
cm.cos_val_max={val}
cm.cos_filter={nil}
end end
return VgF.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,num,nil) return VgF.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,val,nil)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND,0,num,num,nil) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND,0,val,val,nil)
return VgF.Sendto(LOCATION_DROP,g,REASON_COST+REASON_DISCARD) return VgF.Sendto(LOCATION_DROP,g,REASON_COST+REASON_DISCARD)
end end
end end
---用于效果的Cost。它返回一个执行“【费用】[能量爆发num]”的函数。 ---用于效果的Cost。它返回一个执行“【费用】[能量爆发val]”的函数。
---@param num integer 能量爆发的数量 ---@param val integer 能量爆发的数量
---@return function 效果的Cost函数 ---@return function 效果的Cost函数
function VgF.EnergyCost(num) function VgF.EnergyCost(val)
return function (e,tp,eg,ep,ev,re,r,rp,chk) return function (e,tp,eg,ep,ev,re,r,rp,chk)
if VgF.GetValueType(num)~="number" then return 0 end if VgF.GetValueType(val)~="number" then return 0 end
local c=e:GetHandler() local c=e:GetHandler()
local m=c:GetOriginalCode() local m=c:GetOriginalCode()
local cm=_G["c"..m] local cm=_G["c"..m]
if chk==0 then if chk==0 then
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
cm.cos_g=Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_EMBLEM,0,nil,10800730) cm.cos_from={LOCATION_EMBLEM}
cm.cos_val={nil,num,num} cm.cos_to={"POSCHANGE"}
cm.cos_val={val}
cm.cos_val_max={val}
cm.cos_filter={function(tc) tc:IsCode(10800730) end}
end end
return VgF.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_EMBLEM,0,num,nil,10800730) return VgF.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_EMBLEM,0,val,nil,10800730)
end end
local sg=Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_EMBLEM,0,nil,10800730) local sg=Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_EMBLEM,0,nil,10800730)
local g=VgF.GetCardsFromGroup(sg,num) local g=VgF.GetCardsFromGroup(sg,val)
return VgF.Sendto(0,g,tp,POS_FACEUP,REASON_COST) return VgF.Sendto(0,g,tp,POS_FACEUP,REASON_COST)
end end
end end
---用于效果的Cost。它返回一个执行“【费用】[灵魂爆发num]”的函数。 ---用于效果的Cost。它返回一个执行“【费用】[灵魂爆发val]”的函数。
---@param num integer 灵魂爆发的数量 ---@param val integer 灵魂爆发的数量
---@return function 效果的Cost函数 ---@return function 效果的Cost函数
function VgF.OverlayCost(num) function VgF.OverlayCost(val)
return function (e,tp,eg,ep,ev,re,r,rp,chk) return function (e,tp,eg,ep,ev,re,r,rp,chk)
if VgF.GetValueType(num)~="number" then return 0 end if VgF.GetValueType(val)~="number" then return 0 end
local c=e:GetHandler() local c=e:GetHandler()
local m=c:GetOriginalCode() local m=c:GetOriginalCode()
local cm=_G["c"..m] local cm=_G["c"..m]
if chk==0 then if chk==0 then
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
cm.cos_g=Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil,nil):GetFirst():GetOverlayGroup() cm.cos_from={LOCATION_OVERLAY}
cm.cos_val={nil,num,num} cm.cos_to={LOCATION_DROP}
cm.cos_val={val}
cm.cos_val_max={val}
cm.cos_filter={nil}
end end
return Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil,nil):GetFirst():GetOverlayCount()>=num return Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil,nil):GetFirst():GetOverlayCount()>=val
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVEXYZ) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVEXYZ)
local g=Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst():GetOverlayGroup():Select(tp,nil,num,num,nil) local g=Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst():GetOverlayGroup():Select(tp,nil,val,val,nil)
return VgF.Sendto(LOCATION_DROP,g,REASON_COST) return VgF.Sendto(LOCATION_DROP,g,REASON_COST)
end end
end end
---用于效果的Cost或Operation。它返回一个执行“【费用】[灵魂填充num]”的函数。 ---用于效果的Cost或Operation。它返回一个执行“【费用】[灵魂填充val]”的函数。
---@param num integer 灵魂填充的数量 ---@param val integer 灵魂填充的数量
---@return function 效果的Cost或Operation函数 ---@return function 效果的Cost或Operation函数
function VgF.OverlayFill(num) function VgF.OverlayFill(val)
return function (e,tp,eg,ep,ev,re,r,rp,chk) return function (e,tp,eg,ep,ev,re,r,rp,chk)
if VgF.GetValueType(num)~="number" then return 0 end if VgF.GetValueType(val)~="number" then return 0 end
local c=e:GetHandler() local c=e:GetHandler()
local m=c:GetOriginalCode() local m=c:GetOriginalCode()
local cm=_G["c"..m] local cm=_G["c"..m]
if chk==0 then if chk==0 then
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
cm.cos_g=Duel.GetFieldGroup(tp,LOCATION_DECK,0) cm.cos_from={LOCATION_DECK}
cm.cos_val={nil,num,num} cm.cos_to={LOCATION_OVERLAY}
cm.cos_val={val}
cm.cos_val_max={val}
cm.cos_filter={nil}
end end
return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=num return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=val
end end
local rc=Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst() local rc=Duel.GetMatchingGroup(VgF.VMonsterFilter,tp,LOCATION_MZONE,0,nil):GetFirst()
local g=Duel.GetDecktopGroup(tp,num) local g=Duel.GetDecktopGroup(tp,val)
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
Duel.RaiseEvent(g,EVENT_CUSTOM+EVENT_OVERLAY_FILL,e,0,tp,tp,num) Duel.RaiseEvent(g,EVENT_CUSTOM+EVENT_OVERLAY_FILL,e,0,tp,tp,val)
return VgF.Sendto(LOCATION_OVERLAY,g,rc) return VgF.Sendto(LOCATION_OVERLAY,g,rc)
end end
end end
---用于效果的Cost。它返回一个执行“【费用】[计数爆发num]”的函数。 ---用于效果的Cost。它返回一个执行“【费用】[计数爆发val]”的函数。
---@param num integer 计数爆发的数量 ---@param val integer 计数爆发的数量
---@return function 效果的Cost函数 ---@return function 效果的Cost函数
function VgF.DamageCost(num) function VgF.DamageCost(val)
return function (e,tp,eg,ep,ev,re,r,rp,chk) return function (e,tp,eg,ep,ev,re,r,rp,chk)
if VgF.GetValueType(num)~="number" then return 0 end if VgF.GetValueType(val)~="number" then return 0 end
local c=e:GetHandler() local c=e:GetHandler()
local m=c:GetOriginalCode() local m=c:GetOriginalCode()
local cm=_G["c"..m] local cm=_G["c"..m]
if chk==0 then if chk==0 then
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
cm.cos_g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_DAMAGE,0,nil) cm.cos_from={LOCATION_DAMAGE}
cm.cos_val={nil,num,num} cm.cos_to={LOCATION_DROP}
cm.cos_val={val}
cm.cos_val_max={val}
cm.cos_filter={Card.IsFaceup}
end end
return VgF.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_DAMAGE,0,num,nil) return VgF.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_DAMAGE,0,val,nil)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DAMAGE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DAMAGE)
local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_DAMAGE,0,num,num,nil) local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_DAMAGE,0,val,val,nil)
Duel.ChangePosition(g,POS_FACEDOWN_ATTACK) Duel.ChangePosition(g,POS_FACEDOWN_ATTACK)
return Duel.GetOperatedGroup():GetCount() return Duel.GetOperatedGroup():GetCount()
end end
...@@ -715,6 +730,97 @@ function VgF.CheckGroupRecursiveCapture(c,sg,bg,f,min,max,ext_params) ...@@ -715,6 +730,97 @@ function VgF.CheckGroupRecursiveCapture(c,sg,bg,f,min,max,ext_params)
sg=sg-c sg=sg-c
return res return res
end end
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
VgF.SubGroupCaptured=Group.CreateGroup()
min=min or 1
max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in VgF.Next(fg) do
fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
for c in VgF.Next(g-sg) do
if not cg:IsContains(c) then
if VgF.CheckGroupRecursiveCapture(c,sg,eg,f,min,max,ext_params) then
cg:Merge(VgF.SubGroupCaptured)
else
eg:RemoveCard(c)
end
end
end
cg:Sub(sg)
finish=(#sg>=min and #sg<=max and f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
if not tc then break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
return nil
end
end
function Group.SelectDoubleSubGroup(g,p,f1,int_min1,int_max1,f2,int_min2,int_max2,except_g,...)
if VgF.GetValueType(f1)~="function" then f1=VgF.True end
if VgF.GetValueType(f2)~="function" then f2=VgF.True end
local result=Group.CreateGroup()
local g1=g:Filter(f1,except_g,...)
local g2=g:Filter(f2,except_g,...)
local g3=Group.__band(g1,g2)
if g:GetCount()<int_min1+int_min2 or g1:GetCount()<int_min1 or g2:GetCount()<int_min2 then return result end
if g1:GetCount()<int_max1 then int_max1=g1:GetCount() end
if g2:GetCount()<int_max2 then int_max2=g2:GetCount() end
if g3:GetCount()==g2:GetCount() and g3:GetCount()==g1:GetCount() then
local min=int_min1+int_min2
local max=int_max1+int_max2
return g3:SelectSubGroup(p,vgf.True,false,min,max)
end
local result1=Group.CreateGroup()
local result2=Group.CreateGroup()
while result1:GetCount()<int_max1 do
local sg=Group.__sub(g1,result1)
local check_group=Group.__sub(g2,result1)
for tc in VgF.Next(Group.__sub(g1,result1)) do
if g3:IsContains(tc) and not check_group:IsExists(VgF.True,int_min2,tc) then sg:RemoveCard(tc) end
end
local btok=false
if result1:GetCount()>=int_min1 then btok=true end
local tc=sg:SelectUnselect(result1,p,btok,false,int_min1,int_max1)
if not tc then break
elseif result1:IsContains(tc) then result1:RemoveCard(tc)
else result1:AddCard(tc) end
end
g2:Sub(result1)
while result2:GetCount()<int_max2 do
local sg=Group.__sub(g2,result2)
local btok=false
if result2:GetCount()>=int_min2 then btok=true end
local tc=sg:SelectUnselect(result2,p,btok,false,int_min2,int_max2)
if not tc then break
elseif result2:IsContains(tc) and not result1:IsContains(tc) then result2:RemoveCard(tc)
else result2:AddCard(tc) end
end
result=Group.__add(result1,result2)
return result
end
---返回p场上的先导者。 ---返回p场上的先导者。
---@param p integer 要获取先导者的玩家。不合法则返回nil。 ---@param p integer 要获取先导者的玩家。不合法则返回nil。
---@return Card|nil p场上的先导者 ---@return Card|nil p场上的先导者
...@@ -819,7 +925,7 @@ function VgF.EffectResetOperation(e,tp,eg,ep,ev,re,r,rp) ...@@ -819,7 +925,7 @@ function VgF.EffectResetOperation(e,tp,eg,ep,ev,re,r,rp)
e:Reset() e:Reset()
end end
function VgF.IsExistingMatchingCard(f,tp,loc_self,loc_op,int,except_g,...) function VgF.IsExistingMatchingCard(f,tp,loc_self,loc_op,int,except_g,...)
return VgF.GetMatchingGroupCount(f,tp,loc_self,loc_op,except_g,...)>int return VgF.GetMatchingGroupCount(f,tp,loc_self,loc_op,except_g,...)>=int
end end
function VgF.SelectMatchingCard(hintmsg,e,select_tp,f,tp,loc_self,loc_op,int_min,int_max,except_g,...) function VgF.SelectMatchingCard(hintmsg,e,select_tp,f,tp,loc_self,loc_op,int_min,int_max,except_g,...)
local a=false local a=false
...@@ -1035,4 +1141,21 @@ function VgF.DarkWing(e) ...@@ -1035,4 +1141,21 @@ function VgF.DarkWing(e)
return c:GetLevel()%2==0 return c:GetLevel()%2==0
end,tp,LOCATION_REMOVED,0,1,nil) end,tp,LOCATION_REMOVED,0,1,nil)
return (a and not b) or Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_BOTH_WING) return (a and not b) or Duel.IsPlayerAffectedByEffect(tp,AFFECT_CODE_BOTH_WING)
end
function VgF.AddRideMaterialSetCardCheck(c,m,...)
local cm=_G["c"..m]
cm.ride_material_setcard_chk={...}
end
function VgF.AddRideMaterialCodeCheck(c,m,...)
local cm=_G["c"..m]
cm.ride_material_code_chk={...}
end
function VgF.AddRideMaterialSetCard(c,m,...)
local cm=_G["c"..m]
cm.ride_setcard={...}
end
function VgF.AddRideMaterialCode(c,m,...)
local cm=_G["c"..m]
cm.ride_code={...}
end end
\ No newline at end of file
...@@ -5,14 +5,15 @@ function cm.initial_effect(c) ...@@ -5,14 +5,15 @@ function cm.initial_effect(c)
--通过【费用】[使用1张以上的你希望的张数的卡进行计数爆发]施放! --通过【费用】[使用1张以上的你希望的张数的卡进行计数爆发]施放!
--由于这个费用支付的计数爆发1每有1张,选择对手的1张后防者,退场。 --由于这个费用支付的计数爆发1每有1张,选择对手的1张后防者,退场。
vgd.SpellActivate(c,m,cm.op,cm.cost) vgd.SpellActivate(c,m,cm.op,cm.cost)
cm.cos_from={LOCATION_DAMAGE}
cm.cos_to={"POSCHANGE"}
cm.cos_val={1}
cm.cos_val_max={100}
cm.cos_filter={Card.IsFaceup}
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=vgf.GetMatchingGroupCount(Card.IsFaceup,tp,LOCATION_DAMAGE,0,nil) local ct=vgf.GetMatchingGroupCount(Card.IsFaceup,tp,LOCATION_DAMAGE,0,nil)
if chk==0 then if chk==0 then
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
cm.cos_g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_DAMAGE,0,nil)
cm.cos_val={nil,1,ct}
end
return vgf.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_DAMAGE,0,1,nil) return vgf.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_DAMAGE,0,1,nil)
end end
local g=vgf.SelectMatchingCard(HINTMSG_DAMAGE,e,tp,Card.IsFaceup,tp,LOCATION_DAMAGE,0,1,ct,nil) local g=vgf.SelectMatchingCard(HINTMSG_DAMAGE,e,tp,Card.IsFaceup,tp,LOCATION_DAMAGE,0,1,ct,nil)
......
...@@ -2,6 +2,11 @@ local cm,m,o=GetID() ...@@ -2,6 +2,11 @@ local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgf.VgCard(c) vgf.VgCard(c)
vgd.SpellActivate(c,m,cm.op,cm.cost) vgd.SpellActivate(c,m,cm.op,cm.cost)
cm.cos_from={LOCATION_OVERLAY}
cm.cos_to={LOCATION_DROP}
cm.cos_val={1}
cm.cos_val_max={1}
cm.cos_filter={function (tc) return tc:IsLevel(3) end}
end end
function cm.filter(c,p) function cm.filter(c,p)
return c:IsControler(p) and vgf.RMonsterFilter(c) return c:IsControler(p) and vgf.RMonsterFilter(c)
...@@ -22,8 +27,6 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -22,8 +27,6 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
cm.cos_g=vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil,nil):GetFirst():GetOverlayGroup():Filter(Card.IsLevel,nil,3)
cm.cos_val={nil,1,1}
if chk==0 then if chk==0 then
vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil,nil):GetFirst():GetOverlayGroup():IsExists(Card.IsLevel,1,nil,3) vgf.GetMatchingGroup(vgf.VMonsterFilter,tp,LOCATION_MZONE,0,nil,nil):GetFirst():GetOverlayGroup():IsExists(Card.IsLevel,1,nil,3)
end end
......
...@@ -8,7 +8,7 @@ function cm.initial_effect(c) ...@@ -8,7 +8,7 @@ function cm.initial_effect(c)
end end
function cm.condition(e,tp,eg,ep,ev,re,r,rp) function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
return vgf.RMonsterCondition and vgf.VMonsterFilter(Duel.GetAttackTarget()) and vgf.IsExistingMatchingCard(cm.filter,tp,LOCATION_REMOVED,0,1,nil,TYPE_SPELL) return vgf.RMonsterCondition and vgf.VMonsterFilter(Duel.GetAttackTarget()) and vgf.IsExistingMatchingCard(cm.filter,tp,LOCATION_LOCK,0,1,nil,TYPE_SPELL)
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()
......
...@@ -5,10 +5,13 @@ local cm,m,o=GetID() ...@@ -5,10 +5,13 @@ local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgf.VgCard(c) vgf.VgCard(c)
vgd.SpellActivate(c,m,cm.operation,cm.cost) vgd.SpellActivate(c,m,cm.operation,cm.cost)
cm.cos_from={LOCATION_MZONE}
cm.cos_to={LOCATION_DROP}
cm.cos_val={2}
cm.cos_val_max={2}
cm.cos_filter={vgf.RMonsterFilter}
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
cm.cos_g=Duel.GetMatchingGroup(vgf.RMonsterFilter,tp,LOCATION_MZONE,0,nil)
cm.cos_val={nil,2,2}
if chk==0 then return vgf.IsExistingMatchingCard(vgf.RMonsterFilter,tp,LOCATION_MZONE,0,2,nil) end if chk==0 then return vgf.IsExistingMatchingCard(vgf.RMonsterFilter,tp,LOCATION_MZONE,0,2,nil) end
local g=vgf.SelectMatchingCard(HINTMSG_LEAVEONFIELD,e,tp,vgf.RMonsterFilter,tp,LOCATION_MZONE,0,2,2,nil) local g=vgf.SelectMatchingCard(HINTMSG_LEAVEONFIELD,e,tp,vgf.RMonsterFilter,tp,LOCATION_MZONE,0,2,2,nil)
vgf.Sendto(LOCATION_DROP,g,REASON_COST) vgf.Sendto(LOCATION_DROP,g,REASON_COST)
......
local cm,m,o=GetID() local cm,m,o=GetID()
function cm.initial_effect(c) function cm.initial_effect(c)
vgf.VgCard(c) vgf.VgCard(c)
vgd.SpellActivate(c,m,cm.op,cm.cost)
cm.cos_from={LOCATION_HAND}
cm.cos_to={LOCATION_DROP}
cm.cos_val={1}
cm.cos_val_max={1}
cm.cos_filter={cm.filter}
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,2,REASON_EFFECT)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
return vgf.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND,0,1,nil)
end
local g=vgf.SelectMatchingCard(HINTMSG_TODROP,tp,cm.filter,tp,LOCATION_HAND,0,1,1,nil)
vgf.Sendto(LOCATION_DROP,g,REASON_COST)
end
function cm.filter(c)
return c:IsSetCard(0x201)
end
\ No newline at end of file
...@@ -26,8 +26,8 @@ function cm.initial_effect(c) ...@@ -26,8 +26,8 @@ function cm.initial_effect(c)
vgd.EffectTypeTrigger(c,m,nil,EFFECT_TYPE_SINGLE,EVENT_SPSUMMON_SUCCESS,cm.op,nil,cm.con1) vgd.EffectTypeTrigger(c,m,nil,EFFECT_TYPE_SINGLE,EVENT_SPSUMMON_SUCCESS,cm.op,nil,cm.con1)
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_REMOVED,0,1,nil) local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_LOCK,0,1,nil)
local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_REMOVED,0,1,nil) local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_LOCK,0,1,nil)
-- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效) -- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效)
return not a and b return not a and b
end end
...@@ -43,5 +43,5 @@ function cm.con1(e,tp,eg,ep,ev,re,r,rp) ...@@ -43,5 +43,5 @@ function cm.con1(e,tp,eg,ep,ev,re,r,rp)
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp) function cm.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetDecktopGroup(tp,1) local g=Duel.GetDecktopGroup(tp,1)
vgf.Sendto(LOCATION_REMOVED,g,POS_FACEUP,REASON_EFFECT) vgf.Sendto(LOCATION_LOCK,g,POS_FACEUP,REASON_EFFECT)
end end
\ No newline at end of file
...@@ -10,8 +10,8 @@ function cm.con1(e,tp,eg,ep,ev,re,r,rp) ...@@ -10,8 +10,8 @@ function cm.con1(e,tp,eg,ep,ev,re,r,rp)
return cm.con2(e,tp,eg,ep,ev,re,r,rp) and vgf.RMonsterCondition(e) return cm.con2(e,tp,eg,ep,ev,re,r,rp) and vgf.RMonsterCondition(e)
end end
function cm.con2(e,tp,eg,ep,ev,re,r,rp) function cm.con2(e,tp,eg,ep,ev,re,r,rp)
local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_REMOVED,0,1,nil) local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_LOCK,0,1,nil)
local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_REMOVED,0,1,nil) local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_LOCK,0,1,nil)
-- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效) -- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效)
return not a and b return not a and b
end end
......
...@@ -18,8 +18,8 @@ function cm.con(e,tp,eg,ep,ev,re,r,rp) ...@@ -18,8 +18,8 @@ function cm.con(e,tp,eg,ep,ev,re,r,rp)
return eg:IsContains(c) and cm.con1(e,tp,eg,ep,ev,re,r,rp) and vgf.RMonsterCondition(e) return eg:IsContains(c) and cm.con1(e,tp,eg,ep,ev,re,r,rp) and vgf.RMonsterCondition(e)
end end
function cm.con1(e,tp,eg,ep,ev,re,r,rp) function cm.con1(e,tp,eg,ep,ev,re,r,rp)
local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_REMOVED,0,1,nil) local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_LOCK,0,1,nil)
local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_REMOVED,0,1,nil) local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_LOCK,0,1,nil)
-- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效) -- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效)
return not a and b return not a and b
end end
......
...@@ -11,8 +11,8 @@ end ...@@ -11,8 +11,8 @@ end
end end
function cm.con1(e,tp,eg,ep,ev,re,r,rp) function cm.con1(e,tp,eg,ep,ev,re,r,rp)
local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_REMOVED,0,1,nil) local a=vgf.IsExistingMatchingCard(cm.filter1,tp,LOCATION_LOCK,0,1,nil)
local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_REMOVED,0,1,nil) local b=vgf.IsExistingMatchingCard(cm.filter2,tp,LOCATION_LOCK,0,1,nil)
-- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效) -- 白翼(你的封锁区中的卡只有奇数的等级的场合才有效)
return not a and b return not a and b
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