Commit 6c4ee7cd authored by Vury Leo's avatar Vury Leo Committed by wind2009

Add 魔鍵 to new fusion

parent ae0a925d
--繋がれし魔鍵 --繋がれし魔鍵
function c51510279.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
--- fusion effect
local e0=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter,
matfilter=aux.NecroValleyFilter(),
sumpos=POS_FACEUP_DEFENSE
})
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
...@@ -7,83 +14,58 @@ function c51510279.initial_effect(c) ...@@ -7,83 +14,58 @@ function c51510279.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(c51510279.target) e1:SetTarget(s.target)
e1:SetOperation(c51510279.activate) e1:SetOperation(s.activate)
e1:SetLabelObject(e0)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c51510279.thfilter(c)
function s.thfilter(c)
return (c:IsType(TYPE_NORMAL) or c:IsSetCard(0x165) and c:IsType(TYPE_MONSTER)) and c:IsAbleToHand() return (c:IsType(TYPE_NORMAL) or c:IsSetCard(0x165) and c:IsType(TYPE_MONSTER)) and c:IsAbleToHand()
end end
function c51510279.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c51510279.thfilter(chkc) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(c51510279.thfilter,tp,LOCATION_GRAVE,0,1,nil) end if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c51510279.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end end
function c51510279.ffilter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsSetCard(0x165)
end end
function c51510279.ffilter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x165) and (not f or f(c)) function s.rfilter(c,e,tp)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false,POS_FACEUP_DEFENSE) and c:CheckFusionMaterial(m,nil,chkf)
end
function c51510279.rfilter(c,e,tp)
return c:IsSetCard(0x165) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true,POS_FACEUP_DEFENSE) return c:IsSetCard(0x165) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true,POS_FACEUP_DEFENSE)
end end
function c51510279.activate(e,tp,eg,ep,ev,re,r,rp)
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local th=Duel.GetFirstTarget() local th=Duel.GetFirstTarget()
if not th:IsRelateToEffect(e) or Duel.SendtoHand(th,nil,REASON_EFFECT)==0 or not th:IsLocation(LOCATION_HAND) then return end if not th:IsRelateToEffect(e) or Duel.SendtoHand(th,nil,REASON_EFFECT)==0 or not th:IsLocation(LOCATION_HAND) then return end
local chkf=tp local fusion_effect=e:GetLabelObject()
local fmg1=Duel.GetFusionMaterial(tp):Filter(c51510279.ffilter1,nil,e)
local fsg1=Duel.GetMatchingGroup(c51510279.ffilter2,tp,LOCATION_EXTRA,0,nil,e,tp,fmg1,nil,chkf)
local fmg2=nil
local fsg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
fmg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
fsg2=Duel.GetMatchingGroup(c51510279.ffilter2,tp,LOCATION_EXTRA,0,nil,e,tp,fmg2,mf,chkf)
end
local rmg1=Duel.GetRitualMaterial(tp) local rmg1=Duel.GetRitualMaterial(tp)
local rsg=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,c51510279.rfilter,e,tp,rmg1,nil,Card.GetLevel,"Greater") local rsg=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,s.rfilter,e,tp,rmg1,nil,Card.GetLevel,"Greater")
local off=1 local off=1
local ops={} local ops={}
local opval={} local opval={}
ops[off]=aux.Stringid(51510279,0) ops[off]=aux.Stringid(id,0)
opval[off-1]=0 opval[off-1]=0
off=off+1 off=off+1
if fsg1:GetCount()>0 or (fsg2~=nil and fsg2:GetCount()>0) then if fusion_effect:GetTarget()(e,tp,eg,ep,ev,re,r,rp,0) then
ops[off]=aux.Stringid(51510279,1) ops[off]=aux.Stringid(id,1)
opval[off-1]=1 opval[off-1]=1
off=off+1 off=off+1
end end
if rsg:GetCount()>0 then if rsg:GetCount()>0 then
ops[off]=aux.Stringid(51510279,2) ops[off]=aux.Stringid(id,2)
opval[off-1]=2 opval[off-1]=2
off=off+1 off=off+1
end end
local op=Duel.SelectOption(tp,table.unpack(ops)) local op=Duel.SelectOption(tp,table.unpack(ops))
if opval[op]==1 then if opval[op]==1 then
Duel.BreakEffect() Duel.BreakEffect()
local sg=fsg1:Clone() fusion_effect:GetOperation()(e,tp,eg,ep,ev,re,r,rp)
if fsg2 then sg:Merge(fsg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=sg:Select(tp,1,1,nil):GetFirst()
fmg1:RemoveCard(tc)
if fsg1:IsContains(tc) and (fsg2==nil or not fsg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,fmg1,nil,chkf)
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_DEFENSE)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,fmg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
elseif opval[op]==2 then elseif opval[op]==2 then
::rcancel:: ::rcancel::
Duel.BreakEffect() Duel.BreakEffect()
......
--魔鍵-マフテア --魔鍵-マフテア
function c99426088.initial_effect(c) local s,id,o=GetID()
function s.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_DECKDES) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_DECKDES)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c99426088.target) e1:SetTarget(s.target)
e1:SetOperation(c99426088.activate) e1:SetOperation(s.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c99426088.exconfilter(c)
function s.exconfilter(c)
return c:IsFaceup() and c:IsType(TYPE_NORMAL) return c:IsFaceup() and c:IsType(TYPE_NORMAL)
end end
function c99426088.excon(tp)
return Duel.IsExistingMatchingCard(c99426088.exconfilter,tp,LOCATION_MZONE,0,1,nil) function s.excon(tp)
return Duel.IsExistingMatchingCard(s.exconfilter,tp,LOCATION_MZONE,0,1,nil)
end end
function c99426088.ffilter1(c,e)
return not c:IsImmuneToEffect(e) function s.fusfilter(c)
return c:IsSetCard(0x165)
end end
function c99426088.ffilter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x165) and (not f or f(c)) --- @type FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) function s.pre_select_mat_location(tc,tp)
local location=LOCATION_HAND|LOCATION_MZONE
--- Add Deck if controls a Normal Monster
if Duel.IsExistingMatchingCard(function(c) return c:IsFaceup() and c:IsType(TYPE_NORMAL) end,tp,LOCATION_MZONE,0,1,nil) then
location=location|LOCATION_DECK
end
return location
end end
function c99426088.fexfilter(c)
return c:IsType(TYPE_NORMAL) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave() function s.fusion_spell_matfilter(c)
--- material from Deck must be Normal Monster
if c:IsLocation(LOCATION_DECK) and not c:IsType(TYPE_NORMAL) then
return false
end
return true
end end
function c99426088.rfilter(c,e,tp)
function s.rfilter(c,e,tp)
return c:IsSetCard(0x165) return c:IsSetCard(0x165)
end end
function c99426088.rexfilter(c)
function s.rexfilter(c)
return c:IsType(TYPE_NORMAL) and c:IsLevelAbove(1) and c:IsAbleToGrave() return c:IsType(TYPE_NORMAL) and c:IsLevelAbove(1) and c:IsAbleToGrave()
end end
function c99426088.frcheck(tp,sg,fc)
function s.rcheck(tp,sg,fc)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1 return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1
end end
function c99426088.gcheck(sg,ec)
function s.gcheck(sg,ec)
return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1 return sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1
end end
function c99426088.target(e,tp,eg,ep,ev,re,r,rp,chk)
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp local fusion_effect=FusionSpell.CreateSummonEffect(e:GetHandler(),{
local fmg1=Duel.GetFusionMaterial(tp) fusfilter=s.fusfilter,
if c99426088.excon(tp) then pre_select_mat_location=s.pre_select_mat_location,
local fmg2=Duel.GetMatchingGroup(c99426088.fexfilter,tp,LOCATION_DECK,0,nil) fusion_spell_matfilter=s.fusion_spell_matfilter
if fmg2:GetCount()>0 then })
fmg1:Merge(fmg2) if fusion_effect:GetTarget()(e,tp,eg,ep,ev,re,r,rp,0) then
aux.FCheckAdditional=c99426088.frcheck return true
aux.GCheckAdditional=c99426088.gcheck
end
end end
local res=Duel.IsExistingMatchingCard(c99426088.ffilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,fmg1,nil,chkf)
aux.FCheckAdditional=nil local rmg1=Duel.GetRitualMaterial(tp)
aux.GCheckAdditional=nil local rmg2
if not res then if s.excon(tp) then
local ce=Duel.GetChainMaterial(tp) rmg2=Duel.GetMatchingGroup(s.rexfilter,tp,LOCATION_DECK,0,nil)
if ce~=nil then
local fgroup=ce:GetTarget()
local fmg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c99426088.ffilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,fmg3,mf,chkf)
end
end
if not res then
local rmg1=Duel.GetRitualMaterial(tp)
local rmg2
if c99426088.excon(tp) then
rmg2=Duel.GetMatchingGroup(c99426088.rexfilter,tp,LOCATION_DECK,0,nil)
end
aux.RCheckAdditional=c99426088.frcheck
aux.RGCheckAdditional=c99426088.gcheck
res=Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,1,nil,c99426088.rfilter,e,tp,rmg1,rmg2,Card.GetLevel,"Greater")
aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil
end end
aux.RCheckAdditional=s.rcheck
aux.RGCheckAdditional=s.gcheck
local res=Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,1,nil,s.rfilter,e,tp,rmg1,rmg2,Card.GetLevel,"Greater")
aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil
return res return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_EXTRA)
end end
function c99426088.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp function s.activate(e,tp,eg,ep,ev,re,r,rp)
local fmg1=Duel.GetFusionMaterial(tp):Filter(c99426088.ffilter1,nil,e) local fusion_effect=FusionSpell.CreateSummonEffect(e:GetHandler(),{
local exmat=false fusfilter=s.fusfilter,
if c99426088.excon(tp) then matfilter=aux.NecroValleyFilter(),
local fmg2=Duel.GetMatchingGroup(c99426088.fexfilter,tp,LOCATION_DECK,0,nil) pre_select_mat_location=s.pre_select_mat_location,
if fmg2:GetCount()>0 then fusion_spell_matfilter=s.fusion_spell_matfilter
fmg1:Merge(fmg2) })
exmat=true local can_fusion=fusion_effect:GetTarget()(e,tp,eg,ep,ev,re,r,rp,0)
end
end
if exmat then
aux.FCheckAdditional=c99426088.frcheck
aux.GCheckAdditional=c99426088.gcheck
end
local fsg1=Duel.GetMatchingGroup(c99426088.ffilter2,tp,LOCATION_EXTRA,0,nil,e,tp,fmg1,nil,chkf)
aux.FCheckAdditional=nil
aux.GCheckAdditional=nil
local fmg3=nil
local fsg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
fmg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
fsg2=Duel.GetMatchingGroup(c99426088.ffilter2,tp,LOCATION_EXTRA,0,nil,e,tp,fmg3,mf,chkf)
end
local rmg1=Duel.GetRitualMaterial(tp) local rmg1=Duel.GetRitualMaterial(tp)
local rmg2 local rmg2
if c99426088.excon(tp) then if s.excon(tp) then
rmg2=Duel.GetMatchingGroup(c99426088.rexfilter,tp,LOCATION_DECK,0,nil) rmg2=Duel.GetMatchingGroup(s.rexfilter,tp,LOCATION_DECK,0,nil)
end end
aux.RCheckAdditional=c99426088.frcheck aux.RCheckAdditional=s.rcheck
aux.RGCheckAdditional=c99426088.gcheck aux.RGCheckAdditional=s.gcheck
local rsg=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,c99426088.rfilter,e,tp,rmg1,rmg2,Card.GetLevel,"Greater") local rsg=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,s.rfilter,e,tp,rmg1,rmg2,Card.GetLevel,"Greater")
aux.RCheckAdditional=nil aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil aux.RGCheckAdditional=nil
local off=1 local off=1
local ops={} local ops={}
local opval={} local opval={}
if fsg1:GetCount()>0 or (fsg2~=nil and fsg2:GetCount()>0) then if can_fusion then
ops[off]=aux.Stringid(99426088,0) ops[off]=aux.Stringid(id,0)
opval[off-1]=1 opval[off-1]=1
off=off+1 off=off+1
end end
if rsg:GetCount()>0 then if rsg:GetCount()>0 then
ops[off]=aux.Stringid(99426088,1) ops[off]=aux.Stringid(id,1)
opval[off-1]=2 opval[off-1]=2
off=off+1 off=off+1
end end
if off==1 then return end if off==1 then return end
local op=Duel.SelectOption(tp,table.unpack(ops)) local op=Duel.SelectOption(tp,table.unpack(ops))
if opval[op]==1 then if opval[op]==1 then
local sg=fsg1:Clone() fusion_effect:GetOperation()(e,tp,eg,ep,ev,re,r,rp)
if fsg2 then sg:Merge(fsg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=sg:Select(tp,1,1,nil):GetFirst()
fmg1:RemoveCard(tc)
if fsg1:IsContains(tc) and (fsg2==nil or not fsg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
if exmat then
aux.FCheckAdditional=c99426088.frcheck
aux.GCheckAdditional=c99426088.gcheck
end
local mat1=Duel.SelectFusionMaterial(tp,tc,fmg1,nil,chkf)
aux.FCheckAdditional=nil
aux.GCheckAdditional=nil
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)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,fmg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
else else
::rcancel:: ::rcancel::
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=rsg:Select(tp,1,1,nil):GetFirst() local tc=rsg:Select(tp,1,1,nil):GetFirst()
aux.RCheckAdditional=c99426088.frcheck aux.RCheckAdditional=s.rcheck
aux.RGCheckAdditional=c99426088.gcheck aux.RGCheckAdditional=s.gcheck
local rmg=rmg1:Filter(Card.IsCanBeRitualMaterial,tc,tc) local rmg=rmg1:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if rmg2 then rmg:Merge(rmg2) end if rmg2 then rmg:Merge(rmg2) end
if tc.mat_filter then if tc.mat_filter 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