Commit 581dae8d authored by wind2009's avatar wind2009

Merge branch 'new-fusion-Artmegia' into 'master'

Add アルトメギア to new fusion

See merge request !22
parents 7726d8f3 2a28c533
...@@ -11,18 +11,18 @@ function s.initial_effect(c) ...@@ -11,18 +11,18 @@ function s.initial_effect(c)
e1:SetTargetRange(1,0) e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit) e1:SetTarget(s.splimit)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--special summon --fusion summon
local e2=Effect.CreateEffect(c) local e2=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter,
gc=s.gc
})
e2:SetDescription(aux.Stringid(id,0)) e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e2:SetCountLimit(1,id) e2:SetCountLimit(1,id)
e2:SetCondition(s.spcon) e2:SetCondition(s.spcon)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--search --search
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
...@@ -37,87 +37,37 @@ function s.initial_effect(c) ...@@ -37,87 +37,37 @@ function s.initial_effect(c)
e3:SetOperation(s.thop) e3:SetOperation(s.thop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function s.splimit(e,c) function s.splimit(e,c)
return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA) return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA)
end end
function s.spcon(e,tp,eg,ep,ev,re,r,rp) function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsMainPhase() return Duel.IsMainPhase()
end end
function s.spfilter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsSetCard(0x1cd) or c:IsCode(53589300)
end end
function s.spfilter2(c,e,tp,m,f,gc,chkf)
return c:IsType(TYPE_FUSION) and (c:IsSetCard(0x1cd) or c:IsCode(53589300)) and (not f or f(c)) function s.gc(e)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,gc,chkf) return e:GetHandler()
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(s.spfilter1,nil,e)
local res=Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,c,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,c,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local chkf=tp
if not c:IsRelateToChain() or c:IsImmuneToEffect(e) then return end
local mg1=Duel.GetFusionMaterial(tp):Filter(s.spfilter1,nil,e)
local sg1=Duel.GetMatchingGroup(s.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,c,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,c,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
::cancel::
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or ce and not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,c,chkf)
if #mat1<2 then goto cancel end
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
elseif ce then
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,c,chkf)
if #mat2<2 then goto cancel end
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end end
function s.thcon(e,tp,eg,ep,ev,re,r,rp) function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND+LOCATION_ONFIELD) return e:GetHandler():IsPreviousLocation(LOCATION_HAND+LOCATION_ONFIELD)
end end
function s.thfilter(c,tp) function s.thfilter(c,tp)
return c:IsSetCard(0x1cd) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() return c:IsSetCard(0x1cd) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
and not Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,c:GetCode()) and not Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,c:GetCode())
end end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end end
function s.thop(e,tp,eg,ep,ev,re,r,rp) function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp)
......
...@@ -2,16 +2,14 @@ ...@@ -2,16 +2,14 @@
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=FusionSpell.CreateSummonEffect(c,{
additional_fcheck=s.fcheck,
stage_x_operation=s.stage_x_operation
})
e1:SetDescription(aux.Stringid(id,0)) e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e1:SetCountLimit(1,id) e1:SetCountLimit(1,id)
e1:SetCondition(s.fscon) e1:SetCondition(s.fscon)
e1:SetTarget(s.fstg)
e1:SetOperation(s.fsop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--to deck --to deck
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
...@@ -25,69 +23,23 @@ function s.initial_effect(c) ...@@ -25,69 +23,23 @@ function s.initial_effect(c)
e2:SetOperation(s.tdop) e2:SetOperation(s.tdop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function s.fscon(e,tp,eg,ep,ev,re,r,rp) function s.fscon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsMainPhase() return Duel.IsMainPhase()
end end
function s.filter(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c)) --- @type FUSION_FGCHECK_FUNCTION
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) function s.fcheck(tp,mg,fc,mg_all)
end --- Must include one Artmegia monster
function s.check(tp,g,fc) if not mg_all:IsExists(function(c) return c:IsFusionSetCard(0x1cd) end,1,nil) then
return g:IsExists(Card.IsFusionSetCard,1,nil,0x1cd) return false
end
function s.fstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e)
aux.FCheckAdditional=s.check
local res=Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
aux.FCheckAdditional=nil
return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) return true
end end
function s.fsop(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp --- @type FUSION_SPELL_STAGE_X_CALLBACK_FUNCTION
local mg1=Duel.GetFusionMaterial(tp):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e) function s.stage_x_operation(e,tc,tp,stage)
aux.FCheckAdditional=s.check if stage==FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then
local sg1=Duel.GetMatchingGroup(s.filter,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2,sg2=nil,nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if #sg1>0 or (sg2~=nil and #sg2>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
::cancel::
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=sg:Select(tp,1,1,nil):GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or ce and not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
if #mat==0 then goto cancel end
tc:SetMaterial(mat)
Duel.SendtoGrave(mat,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
elseif ce then
local mat=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
if #mat==0 then goto cancel end
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat)
end
tc:CompleteProcedure()
if Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil) then if Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil) then
Duel.BreakEffect() Duel.BreakEffect()
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
...@@ -98,11 +50,12 @@ function s.fsop(e,tp,eg,ep,ev,re,r,rp) ...@@ -98,11 +50,12 @@ function s.fsop(e,tp,eg,ep,ev,re,r,rp)
tc:RegisterEffect(e1) tc:RegisterEffect(e1)
end end
end end
aux.FCheckAdditional=nil
end end
function s.tdfilter(c) function s.tdfilter(c)
return c:IsSetCard(0x1cd) and c:IsAbleToDeck() and c:IsCanBeEffectTarget() return c:IsSetCard(0x1cd) and c:IsAbleToDeck() and c:IsCanBeEffectTarget()
end end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_GRAVE,0,e:GetHandler()) local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_GRAVE,0,e:GetHandler())
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end
...@@ -112,6 +65,7 @@ function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -112,6 +65,7 @@ function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetTargetCard(sg) Duel.SetTargetCard(sg)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
end end
function s.tdop(e,tp,eg,ep,ev,re,r,rp) function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetTargetsRelateToChain():Filter(aux.NecroValleyFilter(),nil) local g=Duel.GetTargetsRelateToChain():Filter(aux.NecroValleyFilter(),nil)
if g:GetCount()>0 then if g:GetCount()>0 then
......
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