Commit cb1d8010 authored by Huangnan's avatar Huangnan

fix

parent 3a7d3cee
Pipeline #42127 failed with stages
in 3 minutes and 40 seconds
......@@ -50,9 +50,8 @@ function c11602210.spop(e,tp,eg,ep,ev,re,r,rp)
end
function c11602210.con(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and rp==tp
and rc:IsAllTypes(TYPE_SPELL) or rc:IsAllTypes(TYPE_TRAP) or rc:IsType(TYPE_QUICKPLAY)
and rc:IsSetCard(0x9548)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and rp==tp and rc:IsSetCard(0x9548)
and (rc:IsAllTypes(TYPE_SPELL) or rc:IsAllTypes(TYPE_TRAP) or rc:IsType(TYPE_QUICKPLAY))
end
function c11602210.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......
......@@ -53,7 +53,7 @@ function c11602265.op(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetBattleTarget()
local code=tc:GetCode()
--act limit
local e2=Effect.CreateEffect(c)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
......
......@@ -119,7 +119,7 @@ function c11602280.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c11602280.cfilter(c,tp)
return c:IsPreviousLocation(LOCATION_ONFIELD)
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp)
and c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp
end
function c11602280.condition(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -27,6 +27,15 @@ function cm.initial_effect(c)
e1:SetOperation(cm.cpop)
c:RegisterEffect(e1)
end
function cm.check_effect_usable(e,te,tp,eg,ep,ev,re,r,rp)
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
return e:IsActivatable(tp,true)
else
local tg=e:GetTarget() or aux.TRUE
local op=e:GetOperation()
return op~=nil and tg(te,tp,eg,ep,ev,re,r,rp,0)
end
end
function cm.rlcheck2(c,tp)
if not c:IsLocation(LOCATION_DECK) then return false end
if not c:IsSetCard(0x3cc7) or not Duel.IsPlayerAffectedByEffect(tp,16170021) then return false end
......@@ -108,10 +117,8 @@ function cm.cpfilter(c,e,tp,eg,ep,ev,re,r,rp)
local tab=c.activate_effect
if not c:IsSetCard(0x3cc7) or not c:IsType(TYPE_SPELL+TYPE_TRAP) or not c:IsFaceupEx() then return false end
if not tab then return false end
for _,te in ipairs(tab) do
local con=te:GetCondition() or aux.TRUE
local tg=te:GetTarget() or aux.TRUE
if te:GetOperation() and ((te:IsHasType(EFFECT_TYPE_ACTIVATE) and (te:GetCode()==EVENT_CHAINING or te:GetCode()==EVENT_FREE_CHAIN)) or not te:IsHasType(EFFECT_TYPE_ACTIVATE)) and con(e,tp,eg,ep,ev,re,r,rp) and tg(e,tp,eg,ep,ev,re,r,rp,0) then
for _,te in ipairs(tab) do
if cm.check_effect_usable(te,e,tp,eg,ep,ev,re,r,rp) then
return true
end
end
......@@ -132,9 +139,7 @@ function cm.cptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local desc_tab={}
if not tab then return false end
for _,te in ipairs(tab) do
local con=te:GetCondition() or aux.TRUE
local tg=te:GetTarget() or aux.TRUE
if te:GetOperation() and ((te:IsHasType(EFFECT_TYPE_ACTIVATE) and (te:GetCode()==EVENT_CHAINING or te:GetCode()==EVENT_FREE_CHAIN)) or not te:IsHasType(EFFECT_TYPE_ACTIVATE)) and con(e,tp,eg,ep,ev,re,r,rp) and tg(e,tp,eg,ep,ev,re,r,rp,0) then
if cm.check_effect_usable(te,e,tp,eg,ep,ev,re,r,rp) then
table.insert(res_tab,te)
table.insert(desc_tab,te:GetDescription())
end
......
......@@ -33,7 +33,7 @@ function cm.initial_effect(c)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e4:SetCountLimit(1,m)
e4:SetCountLimit(1,m+1)
e4:SetTarget(cm.cptg)
e4:SetOperation(cm.cpop)
c:RegisterEffect(e4)
......@@ -43,11 +43,15 @@ function cm.initial_effect(c)
c:RegisterEffect(e5)
local e6=e4:Clone()
e6:SetDescription(aux.Stringid(m,3))
e6:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e6:SetCode(EVENT_SUMMON_SUCCESS)
e6:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
c:RegisterEffect(e6)
local e7=e4:Clone()
e7:SetDescription(aux.Stringid(m,4))
e7:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e7:SetCode(EVENT_SPSUMMON_SUCCESS)
e7:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
c:RegisterEffect(e7)
local e8=e4:Clone()
e8:SetDescription(aux.Stringid(m,5))
......@@ -78,7 +82,7 @@ function cm.scost(e,c,tp)
end
function cm.scop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,cm.rlcheck,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil,tp)
local g=Duel.SelectMatchingCard(tp,cm.rlcheck,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,e:GetHandler(),tp)
Duel.Release(g,REASON_COST)
end
function cm.rlcheck2(c,tp)
......@@ -131,14 +135,22 @@ function cm.cpcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function cm.check_effect_usable(e,te,tp,eg,ep,ev,re,r,rp)
local tg=e:GetTarget() or aux.TRUE
local op=e:GetOperation()
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
if (te:GetCode()==e:GetCode() and Duel.CheckEvent(e:GetCode())) then
return e:IsActivatable(tp,true)
end
end
return op and tg(te,tp,eg,ep,ev,re,r,rp,0)
end
function cm.cpfilter(c,e,tp,eg,ep,ev,re,r,rp)
local tab=c.activate_effect
if not c:IsSetCard(0x3cc7) or not c:IsType(TYPE_SPELL+TYPE_TRAP) then return false end
if not tab then return false end
for _,te in ipairs(tab) do
local con=te:GetCondition() or aux.TRUE
local tg=te:GetTarget() or aux.TRUE
if te:GetOperation() and (Duel.CheckEvent(te:GetCode()) or not te:IsHasType(EFFECT_TYPE_ACTIVATE) or (te:GetCode()==EVENT_FREE_CHAIN and e:GetCode()==EVENT_FREE_CHAIN)) and con(e,tp,eg,ep,ev,re,r,rp) and tg(e,tp,eg,ep,ev,re,r,rp,0) then
if cm.check_effect_usable(te,e,tp,eg,ep,ev,re,r,rp) then
return true
end
end
......@@ -159,9 +171,7 @@ function cm.cptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local desc_tab={}
if not tab then return false end
for _,te in ipairs(tab) do
local con=te:GetCondition() or aux.TRUE
local tg=te:GetTarget() or aux.TRUE
if te:GetOperation() and (Duel.CheckEvent(te:GetCode()) or not te:IsHasType(EFFECT_TYPE_ACTIVATE) or (te:GetCode()==EVENT_FREE_CHAIN and e:GetCode()==EVENT_FREE_CHAIN)) and con(e,tp,eg,ep,ev,re,r,rp) and tg(e,tp,eg,ep,ev,re,r,rp,0) then
if cm.check_effect_usable(te,e,tp,eg,ep,ev,re,r,rp) then
table.insert(res_tab,te)
table.insert(desc_tab,te:GetDescription())
end
......
......@@ -42,11 +42,15 @@ function cm.initial_effect(c)
c:RegisterEffect(e5)
local e6=e4:Clone()
e6:SetDescription(aux.Stringid(m,3))
e6:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e6:SetCode(EVENT_SUMMON_SUCCESS)
e6:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
c:RegisterEffect(e6)
local e7=e4:Clone()
e7:SetDescription(aux.Stringid(m,4))
e7:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e7:SetCode(EVENT_SPSUMMON_SUCCESS)
e7:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
c:RegisterEffect(e7)
local e8=e4:Clone()
e8:SetDescription(aux.Stringid(m,5))
......@@ -123,14 +127,22 @@ function cm.cpcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function cm.check_effect_usable(e,te,tp,eg,ep,ev,re,r,rp)
local tg=e:GetTarget() or aux.TRUE
local op=e:GetOperation()
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
if (te:GetCode()==e:GetCode() and Duel.CheckEvent(e:GetCode())) then
return e:IsActivatable(tp,true)
end
end
return op and tg(te,tp,eg,ep,ev,re,r,rp,0)
end
function cm.cpfilter(c,e,tp,eg,ep,ev,re,r,rp)
local tab=c.activate_effect
if not c:IsSetCard(0x3cc7) or not c:IsType(TYPE_SPELL+TYPE_TRAP) then return false end
if not tab then return false end
for _,te in ipairs(tab) do
local con=te:GetCondition() or aux.TRUE
local tg=te:GetTarget() or aux.TRUE
if te:GetOperation() and (Duel.CheckEvent(te:GetCode()) or not te:IsHasType(EFFECT_TYPE_ACTIVATE) or (te:GetCode()==EVENT_FREE_CHAIN and e:GetCode()==EVENT_FREE_CHAIN)) and con(e,tp,eg,ep,ev,re,r,rp) and tg(e,tp,eg,ep,ev,re,r,rp,0) then
if cm.check_effect_usable(te,e,tp,eg,ep,ev,re,r,rp) then
return true
end
end
......@@ -149,11 +161,8 @@ function cm.cptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tab=tc.activate_effect
local res_tab={}
local desc_tab={}
if not tab then return false end
for _,te in ipairs(tab) do
local con=te:GetCondition() or aux.TRUE
local tg=te:GetTarget() or aux.TRUE
if te:GetOperation() and (Duel.CheckEvent(te:GetCode()) or not te:IsHasType(EFFECT_TYPE_ACTIVATE) or (te:GetCode()==EVENT_FREE_CHAIN and e:GetCode()==EVENT_FREE_CHAIN)) and con(e,tp,eg,ep,ev,re,r,rp) and tg(e,tp,eg,ep,ev,re,r,rp,0) then
if cm.check_effect_usable(te,e,tp,eg,ep,ev,re,r,rp) then
table.insert(res_tab,te)
table.insert(desc_tab,te:GetDescription())
end
......
......@@ -3,6 +3,7 @@ local s,id,o=GetID()
function s.initial_effect(c)
--对玩家效果
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_DELAY)
......@@ -16,6 +17,7 @@ function s.initial_effect(c)
c:RegisterEffect(e2)
--双倍战伤
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_GRAVE)
......@@ -25,6 +27,20 @@ function s.initial_effect(c)
c:RegisterEffect(e3)
s.activate_effect={e1,e2,e3}
local e12=e1:Clone()
e12:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e12:SetRange(LOCATION_GRAVE)
e12:SetCost(s.cost)
c:RegisterEffect(e12)
local e22=e2:Clone()
e22:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e22:SetRange(LOCATION_GRAVE)
e22:SetCost(s.cost)
c:RegisterEffect(e22)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,16170067)>0 end
Duel.ResetFlagEffect(tp,16170067)
end
function s.f1(c)
......@@ -40,11 +56,15 @@ function s.f3(c,tp,race)
end
function s.con1(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.f1,tp,LOCATION_MZONE,0,1,nil) and eg:IsExists(s.f2,1,nil,1-tp)
return Duel.IsExistingMatchingCard(s.f1,tp,LOCATION_MZONE,0,1,nil) and eg and eg:IsExists(s.f2,1,nil,1-tp)
end
function s.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
local g=eg:Filter(s.f2,nil,1-tp)
local sg=Group.CreateGroup()
if eg then
sg=eg:Clone()
end
local g=sg:Filter(s.f2,nil,1-tp)
local race=0
for tc in aux.Next(g) do
race=race|tc:GetRace()
......@@ -61,7 +81,7 @@ function s.op1(e,tp,eg,ep,ev,re,r,rp)
race=race|tc:GetRace()
end
local g2=Duel.GetMatchingGroup(s.f3,tp,0,LOCATION_MZONE+LOCATION_GRAVE,nil,tp,race)
Duel.Remove(g2,POS_FACEDOWN,REASON_RULE)
Duel.Remove(g2,POS_FACEUP,REASON_RULE)
end
function s.tg3(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -110,30 +110,35 @@ function c21379150.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=Duel.SelectMatchingCard(tp,c21379150.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)~=0 and Duel.IsExistingMatchingCard(aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(21379150,0)) then
Duel.BreakEffect()
local tc=Duel.SelectMatchingCard(tc,aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil):GetFirst()
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
tc:RegisterEffect(e2)
if tc:IsType(TYPE_TRAPMONSTER) then
local e3=e1:Clone()
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
tc:RegisterEffect(e3)
-- 先校验 sc 特殊召唤成功
if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local hasNegate = Duel.IsExistingMatchingCard(aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
if hasNegate and Duel.SelectYesNo(tp,aux.Stringid(21379150,0)) then
Duel.BreakEffect()
-- 1. 选中待无效卡牌,定义为 g(合法 Card 对象)
local g=Duel.SelectMatchingCard(tp,aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil):GetFirst()
-- 2. 关键:增加空值校验,避免传递 nil
if not g then return end
-- 3. 统一变量名,传递 g(合法 Card 对象),不再用 tc
Duel.NegateRelatedChain(g,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
g:RegisterEffect(e1) -- 传递 g(合法 Card)
local e2=e1:Clone()
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
g:RegisterEffect(e2) -- 传递 g(合法 Card)
if g:IsType(TYPE_TRAPMONSTER) then -- 传递 g(合法 Card)
local e3=e1:Clone()
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
g:RegisterEffect(e3) -- 传递 g(合法 Card)
end
end
end
end
function c21379150.rifilter(c,e,tp)
return c==e:GetHandler()
end
function c21379150.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal,chk)
if (filter and not filter(c,e,tp,chk)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
......
......@@ -2,7 +2,7 @@
local s,id,o=GetID()
function s.initial_effect(c)
c:EnableCounterPermit(0xd56)
aux.AddLinkProcedure(c,nil,3,nil,s.lcheck)
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_MACHINE),3,nil,s.lcheck)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
......
......@@ -84,8 +84,15 @@ end
-- 同调召唤条件检查
function c3435017.syncon(e,c)
if c==nil then return true end
return Duel.GetLocationCountFromEx(c:GetControler(),c:GetControler(),nil,c)>0
and Duel.IsExistingMatchingCard(c3435017.dreamfilter, c:GetControler(), LOCATION_MZONE, 0, 1, nil)
local tp=c:GetControler()
-- 检查是否有至少1只幻梦怪兽作为素材
local g=Duel.GetMatchingGroup(c3435017.dreamfilter, tp, LOCATION_MZONE, 0, nil)
if #g==0 then return false end
-- 计算当至少1只幻梦怪兽作为素材离场后,是否有足够的空间召唤同调怪兽
-- Duel.GetLocationCountFromEx的第三个参数传入素材组,会计算素材离场后腾出的空间
return Duel.GetLocationCountFromEx(tp,tp,g,c)>0
end
-- 同调素材选择目标
......@@ -95,37 +102,25 @@ function c3435017.syntg(e,tp,eg,ep,ev,re,r,rp,chk,c)
return Duel.IsExistingMatchingCard(c3435017.dreamfilter, tp, LOCATION_MZONE, 0, 1, nil)
end
-- 让玩家必须选择至少1只幻梦怪兽和其他可选怪兽作为素材
local dream_g=Duel.GetMatchingGroup(c3435017.dreamfilter, tp, LOCATION_MZONE, 0, nil)
-- 合并选择:让玩家选择至少1只幻梦怪兽和0-14只其他怪兽
local all_candidates=Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
-- 首先必须选择至少1只幻梦怪兽
local dream_selected=Duel.SelectMatchingCard(tp,c3435017.dreamfilter,tp,LOCATION_MZONE,0,1,#dream_g,nil)
if #dream_selected==0 then return false end
-- 创建一个过滤器,确保至少包含1只幻梦怪兽
local function checkFilter(sg)
return sg:FilterCount(c3435017.dreamfilter,nil)>=1
end
-- 然后可以选择其他怪兽
local other_candidates=Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, nil)
other_candidates:Sub(dream_selected) -- 移除已经选择的幻梦怪兽
local selected=Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, nil)
-- 使用SelectSubGroup让玩家一次选择所有素材,同时确保至少1只幻梦怪兽
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local other_selected=Group.CreateGroup()
if #other_candidates>0 then
other_selected=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_MZONE,0,0,14,nil) -- 最多再选14只
end
selected=selected:SelectSubGroup(tp,checkFilter,false,1,15) -- 最多选择15只怪兽
-- 合并选择的怪兽
local selected=Group.CreateGroup()
selected:Merge(dream_selected)
selected:Merge(other_selected)
if not selected or #selected==0 then return false end
if #selected>0 then
selected:KeepAlive()
e:SetLabelObject(selected)
return true
else
return false
end
selected:KeepAlive()
e:SetLabelObject(selected)
return true
end
-- 同调素材操作
......
......@@ -32,6 +32,8 @@ function c3435018.initial_effect(c)
e2:SetCondition(c3435018.condition)
e2:SetTarget(c3435018.target)
e2:SetOperation(c3435018.operation)
-- 效果发动及效果不会被无效化
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_INACTIVATE)
c:RegisterEffect(e2)
-- 效果2:这张卡不会被对方的效果破坏
......@@ -54,8 +56,15 @@ end
-- 同调召唤条件检查
function c3435018.syncon(e,c)
if c==nil then return true end
return Duel.GetLocationCountFromEx(c:GetControler(),c:GetControler(),nil,c)>0
and Duel.IsExistingMatchingCard(c3435018.dreamfilter, c:GetControler(), LOCATION_MZONE, 0, 1, nil)
local tp=c:GetControler()
-- 检查是否有至少1只幻梦怪兽作为素材
local g=Duel.GetMatchingGroup(c3435018.dreamfilter, tp, LOCATION_MZONE, 0, nil)
if #g==0 then return false end
-- 计算当至少1只幻梦怪兽作为素材离场后,是否有足够的空间召唤同调怪兽
-- Duel.GetLocationCountFromEx的第三个参数传入素材组,会计算素材离场后腾出的空间
return Duel.GetLocationCountFromEx(tp,tp,g,c)>0
end
-- 同调素材选择目标
......@@ -65,37 +74,25 @@ function c3435018.syntg(e,tp,eg,ep,ev,re,r,rp,chk,c)
return Duel.IsExistingMatchingCard(c3435018.dreamfilter, tp, LOCATION_MZONE, 0, 1, nil)
end
-- 让玩家必须选择至少1只幻梦怪兽和其他可选怪兽作为素材
local dream_g=Duel.GetMatchingGroup(c3435018.dreamfilter, tp, LOCATION_MZONE, 0, nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
-- 首先必须选择至少1只幻梦怪兽
local dream_selected=Duel.SelectMatchingCard(tp,c3435018.dreamfilter,tp,LOCATION_MZONE,0,1,#dream_g,nil)
-- 合并选择:让玩家选择至少1只幻梦怪兽和0-14只其他怪兽
local all_candidates=Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, nil)
if #dream_selected==0 then return false end
-- 创建一个过滤器,确保至少包含1只幻梦怪兽
local function checkFilter(sg)
return sg:FilterCount(c3435018.dreamfilter,nil)>=1
end
-- 然后可以选择其他怪兽
local other_candidates=Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, nil)
other_candidates:Sub(dream_selected) -- 移除已经选择的幻梦怪兽
local selected=Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, nil)
-- 使用SelectSubGroup让玩家一次选择所有素材,同时确保至少1只幻梦怪兽
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local other_selected=Group.CreateGroup()
if #other_candidates>0 then
other_selected=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_MZONE,0,0,14,nil) -- 最多再选14只
end
selected=selected:SelectSubGroup(tp,checkFilter,false,1,15) -- 最多选择15只怪兽
-- 合并选择的怪兽
local selected=Group.CreateGroup()
selected:Merge(dream_selected)
selected:Merge(other_selected)
if not selected or #selected==0 then return false end
if #selected>0 then
selected:KeepAlive()
e:SetLabelObject(selected)
return true
else
return false
end
selected:KeepAlive()
e:SetLabelObject(selected)
return true
end
-- 同调素材操作
......
......@@ -2,7 +2,7 @@
local s,id=GetID()
s.ui_hint_effect = s.ui_hint_effect or {}
local CORE_ID = 40020353
local ArmedIntervention = CORE_ID
local ArmedIntervention = CORE_ID
local ArmedIntervention_UI = CORE_ID + 10000
--CB
s.named_with_CelestialBeing=1
......@@ -41,9 +41,10 @@ function s.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_TRIGGER_O)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,id+100)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
......@@ -72,9 +73,14 @@ end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local loc = LOCATION_MZONE
if aux.IsCanBeQuickEffect(c,tp,40020377) then
loc = LOCATION_ONFIELD
local loc = LOCATION_MZONE
local has_special_card = Duel.IsExistingMatchingCard(function(tc)
return tc:IsFaceup() and tc:IsCode(40020377)
end, tp, LOCATION_ONFIELD, 0, 1, nil)
if has_special_card then
loc = LOCATION_ONFIELD
end
if chk==0 then
......
......@@ -2,7 +2,7 @@
local s,id=GetID()
s.ui_hint_effect = s.ui_hint_effect or {}
local CORE_ID = 40020353
local ArmedIntervention = CORE_ID
local ArmedIntervention = CORE_ID
local ArmedIntervention_UI = CORE_ID + 10000
--CB
s.named_with_CelestialBeing=1
......@@ -27,6 +27,7 @@ function s.Exia(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_Exia
end
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
......@@ -59,28 +60,29 @@ function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local owner=e:GetHandler():GetOwner()
return Duel.GetTurnPlayer()==tp and Duel.GetFlagEffect(owner,ArmedIntervention)>=7
end
function s.costfilter(c, use_extended)
if not (c:IsFaceup() and c:IsReleasable()) then return false end
if s.Exia(c) then
return use_extended or c:IsType(TYPE_MONSTER)
end
if s.oo(c) then
return c:IsType(TYPE_MONSTER)
end
return false
function s.costfilter(c,tp,loc)
return s.Exia(c) and c:IsControler(tp) and c:IsFaceup() and c:IsReleasable()
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local use_extended = aux.IsCanBeQuickEffect(c,tp,40020377)
local loc = LOCATION_MZONE
if use_extended then loc = LOCATION_ONFIELD end
local has_special_card = Duel.IsExistingMatchingCard(function(tc)
return tc:IsFaceup() and tc:IsCode(40020377)
end, tp, LOCATION_ONFIELD, 0, 1, nil)
if has_special_card then
loc = LOCATION_ONFIELD
end
if chk==0 then
return Duel.IsExistingMatchingCard(s.costfilter,tp,loc,0,1,nil,use_extended)
end
return Duel.IsExistingMatchingCard(s.costfilter,tp,loc,0,1,nil,tp,loc)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,loc,0,1,1,nil,use_extended)
Duel.Release(g,REASON_COST)
local rg=Duel.SelectMatchingCard(tp,s.costfilter,tp,loc,0,1,1,nil,tp,loc)
Duel.Release(rg,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......@@ -122,7 +124,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end
function s.tdfilter(c)
return (c:IsType(TYPE_MONSTER) and c:IsLevelAbove(5))or c:IsCode(40020383) and c:IsAbleToDeck()
return ((c:IsType(TYPE_MONSTER) and c:IsLevelAbove(5)) or c:IsCode(40020383)) and c:IsAbleToDeck()
end
function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -132,12 +134,11 @@ function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function s.descheck(g, lv_limit)
local sum = g:GetSum(function(c)
local val = 0
if c:GetLevel()>0 then val = val + c:GetLevel() end
if c:GetRank()>0 then val = val + c:GetRank() end
return val
end)
local sum = 0
for c in aux.Next(g) do
if c:GetLevel()>0 then sum = sum + c:GetLevel() end
if c:GetRank()>0 then sum = sum + c:GetRank() end
end
return sum <= lv_limit
end
......@@ -156,9 +157,13 @@ function s.lvop(e,tp,eg,ep,ev,re,r,rp)
e1:SetValue(3)
e1:SetReset(RESET_EVENT+RESETS_STANDARD_DISABLE)
c:RegisterEffect(e1)
local current_lv = c:GetLevel()
local dg = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
if #dg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
if #dg>0 and dg:CheckSubGroup(s.descheck, 1, #dg, current_lv)
and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
local sg = dg:SelectSubGroup(tp, s.descheck, false, 1, #dg, current_lv)
if sg and #sg>0 then
......@@ -169,4 +174,4 @@ function s.lvop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
end
end
\ No newline at end of file
......@@ -2,7 +2,7 @@
local s,id=GetID()
s.ui_hint_effect = s.ui_hint_effect or {}
local CORE_ID = 40020353
local ArmedIntervention = CORE_ID
local ArmedIntervention = CORE_ID
local ArmedIntervention_UI = CORE_ID + 10000
--CB
s.named_with_CelestialBeing=1
......@@ -56,28 +56,29 @@ function s.spcon(e,tp,eg,ep,ev,re,r,rp)
and Duel.GetFlagEffect(owner,ArmedIntervention)>=5
end
function s.costfilter(c, use_extended)
if not (c:IsFaceup() and c:IsReleasable()) then return false end
if s.Exia(c) then
return use_extended or c:IsType(TYPE_MONSTER)
end
if s.oo(c) then
return c:IsType(TYPE_MONSTER)
end
return false
function s.costfilter(c,tp,loc)
return s.Exia(c) and c:IsControler(tp) and c:IsFaceup() and c:IsReleasable()
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local use_extended = aux.IsCanBeQuickEffect(c,tp,40020377)
local loc = LOCATION_MZONE
if use_extended then loc = LOCATION_ONFIELD end
local has_special_card = Duel.IsExistingMatchingCard(function(tc)
return tc:IsFaceup() and tc:IsCode(40020377)
end, tp, LOCATION_ONFIELD, 0, 1, nil)
if has_special_card then
loc = LOCATION_ONFIELD
end
if chk==0 then
return Duel.IsExistingMatchingCard(s.costfilter,tp,loc,0,1,nil,use_extended)
end
return Duel.IsExistingMatchingCard(s.costfilter,tp,loc,0,1,nil,tp,loc)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,loc,0,1,1,nil,use_extended)
Duel.Release(g,REASON_COST)
local rg=Duel.SelectMatchingCard(tp,s.costfilter,tp,loc,0,1,1,nil,tp,loc)
Duel.Release(rg,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -2,7 +2,7 @@
local s,id=GetID()
s.ui_hint_effect = s.ui_hint_effect or {}
local CORE_ID = 40020353
local ArmedIntervention = CORE_ID
local ArmedIntervention = CORE_ID
local ArmedIntervention_UI = CORE_ID + 10000
local GLOBAL_END_PHASE_CHECK = id + 900
--CB
......@@ -27,7 +27,9 @@ function s.Exia(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_Exia
end
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
......@@ -41,7 +43,31 @@ function s.initial_effect(c)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(s.drawcon)
e2:SetTarget(s.drawtg)
e2:SetOperation(s.drawop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_BATTLE_START)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCondition(s.copycon) -- 增加条件检查标记
e3:SetTarget(s.copytg)
e3:SetOperation(s.copyop)
c:RegisterEffect(e3)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local owner=c:GetOwner()
......@@ -50,26 +76,31 @@ function s.spcon(e,tp,eg,ep,ev,re,r,rp)
and Duel.GetFlagEffect(owner,ArmedIntervention)>=9
end
function s.costfilter(c, use_extended)
if not (c:IsFaceup() and c:IsReleasable()) then return false end
if use_extended and s.Exia(c) then return true end
if not c:IsType(TYPE_MONSTER) then return false end
return s.Exia(c) or s.QanT(c) or s.ELS(c)
function s.costfilter(c,tp,loc)
return s.Exia(c) and c:IsControler(tp) and c:IsFaceup() and c:IsReleasable()
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local use_extended = aux.IsCanBeQuickEffect(c,tp,40020377)
local loc = LOCATION_MZONE
if use_extended then loc = LOCATION_ONFIELD end
local has_special_card = Duel.IsExistingMatchingCard(function(tc)
return tc:IsFaceup() and tc:IsCode(40020377)
end, tp, LOCATION_ONFIELD, 0, 1, nil)
if has_special_card then
loc = LOCATION_ONFIELD
end
if chk==0 then
return Duel.IsExistingMatchingCard(s.costfilter,tp,loc,0,1,nil,use_extended)
return Duel.IsExistingMatchingCard(s.costfilter,tp,loc,0,1,nil,tp,loc)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,loc,0,1,1,nil,use_extended)
Duel.Release(g,REASON_COST)
local rg=Duel.SelectMatchingCard(tp,s.costfilter,tp,loc,0,1,1,nil,tp,loc)
Duel.Release(rg,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......@@ -81,32 +112,14 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(s.drawtg)
e1:SetOperation(s.drawop)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,2))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_BATTLE_START)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCondition(s.copycon)
e2:SetTarget(s.copytg)
e2:SetOperation(s.copyop)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
c:RegisterFlagEffect(id, RESET_EVENT+0x1fe0000, 0, 1)
end
end
function s.drawcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)>0
end
function s.drawtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local c1=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
......@@ -115,6 +128,7 @@ function s.drawtg(e,tp,eg,ep,ev,re,r,rp,chk)
end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,0)
end
function s.drawop(e,tp,eg,ep,ev,re,r,rp)
local c1=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
local c2=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)
......@@ -128,8 +142,9 @@ function s.drawop(e,tp,eg,ep,ev,re,r,rp)
Duel.SkipPhase(turn_p, PHASE_MAIN2, RESET_PHASE+PHASE_END, 1)
end
end
function s.copycon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
return Duel.GetTurnPlayer()==tp and e:GetHandler():GetFlagEffect(id)>0
end
function s.copyfilter(c)
......@@ -150,4 +165,4 @@ function s.copyop(e,tp,eg,ep,ev,re,r,rp)
local code=tc:GetOriginalCode()
c:CopyEffect(code, RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END, 1)
end
end
end
\ No newline at end of file
......@@ -10,7 +10,7 @@ function s.CelestialBeing(c)
end
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(s,2))
e1:SetDescription(aux.Stringid(id,2))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
......
......@@ -101,15 +101,23 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.actcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not bit.band(r,REASON_EFFECT)~=0 then return false end
if bit.band(r,REASON_EFFECT)==0 then return false end
if not re then return false end
local rc=re:GetHandler()
return rc and s.CelestialBeing(rc)
end
function s.thfilter(c)
return s.CelestialBeing(c) and c:IsAbleToHand()
end
function s.acttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
......@@ -117,7 +125,10 @@ function s.actop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
......@@ -125,8 +136,8 @@ function s.actop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
local owner=c:GetOwner()
Duel.RegisterFlagEffect(owner,ArmedIntervention,0,0,0)
end
end
end
\ No newline at end of file
......@@ -2,7 +2,7 @@
local s,id=GetID()
s.ui_hint_effect = s.ui_hint_effect or {}
local CORE_ID = 40020353
local ArmedIntervention = CORE_ID
local ArmedIntervention = CORE_ID
local ArmedIntervention_UI = CORE_ID + 10000
--CB
s.named_with_CelestialBeing=1
......@@ -28,19 +28,19 @@ function s.initial_effect(c)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_EXTRA_SUMMON_COUNT)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_HAND+LOCATION_MZONE,0)
e2:SetTarget(s.estg)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_FZONE)
e3:SetCountLimit(1,id)
e3:SetCountLimit(1,id+200)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
......@@ -69,7 +69,7 @@ function s.lvtg(e,c)
end
function s.estg(e,c)
return s.CelestialBeing(c) and c:IsAttribute(ATTRIBUTE_WATER)
return s.CelestialBeing(c)
end
function s.spfilter(c,e,tp)
return s.CelestialBeing(c) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsLevelBelow(5)
......@@ -183,5 +183,7 @@ function s.eqop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
function s.eqlimit(e,c)
return c==e:GetLabelObject()
end
......@@ -153,6 +153,6 @@ function s.op6(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.f3,tp,LOCATION_REMOVED,0,nil)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
Duel.SendtoGrave(g:Select(tp,1,1,nil),REASON_EFFECT)
Duel.SendtoHand(g:Select(tp,1,1,nil),tp,REASON_EFFECT)
end
end
\ No newline at end of file
......@@ -45,7 +45,7 @@ function s.get_case(c)
elseif oppo_count>0 then
return 2 -- 只有对方
else
return 只有自己
return 1 -- 只有自己
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