Commit bd7f275f authored by mercury233's avatar mercury233 Committed by DailyShana

new (#488)

parent e2fbe139
--メタルフォーゼ・ミスリエル
function c4688231.initial_effect(c)
--fusion material
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_FUSION_MATERIAL)
e1:SetCondition(c4688231.fscon)
e1:SetOperation(c4688231.fsop)
c:RegisterEffect(e1)
--return
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,4688231)
e2:SetTarget(c4688231.rettg)
e2:SetOperation(c4688231.retop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c4688231.spcon)
e3:SetTarget(c4688231.sptg)
e3:SetOperation(c4688231.spop)
c:RegisterEffect(e3)
end
function c4688231.filter1(c)
return c:IsFusionSetCard(0xe1)
end
function c4688231.filter2(c)
return c:IsType(TYPE_PENDULUM)
end
function c4688231.fscon(e,g,gc,chkfnf)
if g==nil then return true end
local f1=c4688231.filter1
local f2=c4688231.filter2
local chkf=bit.band(chkfnf,0xff)
local tp=e:GetHandlerPlayer()
local fg=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_MZONE,0,nil,77693536)
local fc=fg:GetFirst()
while fc do
g:Merge(fc:GetEquipGroup())
fc=fg:GetNext()
end
local mg=g:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler(),true)
if gc then
if not gc:IsCanBeFusionMaterial(e:GetHandler(),true) then return false end
return (f1(gc) and mg:IsExists(f2,1,gc))
or (f2(gc) and mg:IsExists(f1,1,gc)) end
local g1=Group.CreateGroup() local g2=Group.CreateGroup() local fs=false
local tc=mg:GetFirst()
while tc do
if f1(tc) then g1:AddCard(tc) if aux.FConditionCheckF(tc,chkf) then fs=true end end
if f2(tc) then g2:AddCard(tc) if aux.FConditionCheckF(tc,chkf) then fs=true end end
tc=mg:GetNext()
end
if chkf~=PLAYER_NONE then
return fs and g1:IsExists(aux.FConditionFilterF2,1,nil,g2)
else return g1:IsExists(aux.FConditionFilterF2,1,nil,g2) end
end
function c4688231.fsop(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
local f1=c4688231.filter1
local f2=c4688231.filter2
local chkf=bit.band(chkfnf,0xff)
local fg=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_MZONE,0,nil,77693536)
local fc=fg:GetFirst()
while fc do
eg:Merge(fc:GetEquipGroup())
fc=fg:GetNext()
end
local g=eg:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler(),true)
if gc then
local sg=Group.CreateGroup()
if f1(gc) then sg:Merge(g:Filter(f2,gc)) end
if f2(gc) then sg:Merge(g:Filter(f1,gc)) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local g1=sg:Select(tp,1,1,nil)
Duel.SetFusionMaterial(g1)
return
end
local sg=g:Filter(aux.FConditionFilterF2c,nil,f1,f2)
local g1=nil
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
if chkf~=PLAYER_NONE then
g1=sg:FilterSelect(tp,aux.FConditionCheckF,1,1,nil,chkf)
else g1=sg:Select(tp,1,1,nil) end
local tc1=g1:GetFirst()
sg:RemoveCard(tc1)
local b1=f1(tc1)
local b2=f2(tc1)
if b1 and not b2 then sg:Remove(aux.FConditionFilterF2r,nil,f1,f2) end
if b2 and not b1 then sg:Remove(aux.FConditionFilterF2r,nil,f2,f1) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local g2=sg:Select(tp,1,1,nil)
g1:Merge(g2)
Duel.SetFusionMaterial(g1)
end
function c4688231.retfilter1(c)
return c:IsSetCard(0xe1) and c:IsAbleToDeck()
end
function c4688231.retfilter2(c)
return c:IsAbleToHand()
end
function c4688231.rettg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c4688231.retfilter1,tp,LOCATION_GRAVE,0,2,nil)
and Duel.IsExistingTarget(c4688231.retfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g1=Duel.SelectTarget(tp,c4688231.retfilter1,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g2=Duel.SelectTarget(tp,c4688231.retfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,g1:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g2,1,0,0)
end
function c4688231.retop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
local g1=g:Filter(Card.IsLocation,nil,LOCATION_GRAVE)
if Duel.SendtoDeck(g1,nil,0,REASON_EFFECT)~=0 then
local og=Duel.GetOperatedGroup()
if og:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local g2=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD)
Duel.SendtoHand(g2,nil,REASON_EFFECT)
end
end
function c4688231.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c4688231.spfilter(c,e,tp)
return c:IsSetCard(0xe1) and c:IsType(TYPE_PENDULUM) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup())
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c4688231.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c4688231.spfilter,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_EXTRA)
end
function c4688231.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c4688231.spfilter,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,1,1,nil,e,tp)
if g:GetCount()>0 and not g:GetFirst():IsHasEffect(EFFECT_NECRO_VALLEY) then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
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