Commit ec74cffc authored by nanahira's avatar nanahira

new

parent 86dc7967
No preview for this file type
--Sound Voltex
local m=37564567
local cm=_G["c"..m]
xpcall(function() require("expansions/script/c37564765") end,function() require("script/c37564765") end)
cm.Senya_desc_with_nanahira=true
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_GRAVE)
e1:SetCost(aux.bfgcost)
e1:SetTarget(cm.target1)
e1:SetOperation(cm.activate1)
c:RegisterEffect(e1)
end
function cm.sfilter(c)
return c.Senya_desc_with_nanahira and (c:IsSpecialSummonable(SUMMON_TYPE_LINK) or c:IsSpecialSummonable(SUMMON_TYPE_SYNCHRO) or c:IsSpecialSummonable(SUMMON_TYPE_XYZ))
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.sfilter,tp,LOCATION_EXTRA,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.sfilter,tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummonRule(tp,tc)
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function cm.filter(c,e)
local code=c:GetOriginalCode()
return c:IsFaceup() and c:IsCanBeEffectTarget(e) and (code==37564765 or code==37564565)
end
function cm.xyzfilter(c,mg)
return c:IsXyzSummonable(mg,2,2)
end
function cm.mfilter1(c,mg,exg,tp)
return mg:IsExists(cm.mfilter2,1,c,c,exg,tp)
end
function cm.mfilter2(c,mc,exg,tp)
local code1=c:GetOriginalCode()
local code2=mc:GetOriginalCode()
local g=Group.FromCards(c,mc)
return code1~=code2 and exg:IsExists(Card.IsXyzSummonable,1,nil,g) and Duel.GetLocationCountFromEx(tp,tp,g)>0
end
function cm.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local mg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_MZONE,0,nil,e)
local exg=Duel.GetMatchingGroup(cm.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
if chk==0 then return mg:IsExists(cm.mfilter1,1,nil,mg,exg,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local sg1=mg:FilterSelect(tp,cm.mfilter1,1,1,nil,mg,exg,tp)
local tc1=sg1:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local sg2=mg:FilterSelect(tp,cm.mfilter2,1,1,tc1,tc1,exg,tp)
sg1:Merge(sg2)
Duel.SetTargetCard(sg1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.tfilter(c,e)
return c:IsRelateToEffect(e) and c:IsFaceup()
end
function cm.activate1(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(cm.tfilter,nil,e)
if g:GetCount()<2 then return end
if Duel.GetLocationCountFromEx(tp,tp,g)<=0 then return end
local xyzg=Duel.GetMatchingGroup(cm.xyzfilter,tp,LOCATION_EXTRA,0,nil,g)
if xyzg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
local xyzmt=getmetatable(xyz)
local oldf=xyzmt.SetMaterial
xyzmt.SetMaterial=cm.ReplaceSetMaterial
Duel.XyzSummon(tp,xyz,g)
xyzmt.SetMaterial=oldf
end
end
function cm.ReplaceSetMaterial(c,...)
local res={Card.SetMaterial(c,...)}
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_ADJUST)
e2:SetRange(LOCATION_MZONE)
e2:SetLabel(Senya.order_table_new({}))
e2:SetOperation(cm.op)
e2:SetReset(RESET_EVENT+0xfe0000)
c:RegisterEffect(e2,true)
local ex=Effect.CreateEffect(c)
ex:SetType(EFFECT_TYPE_SINGLE)
ex:SetCode(m-1000)
ex:SetRange(LOCATION_MZONE)
ex:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
ex:SetReset(RESET_EVENT+0xfe0000)
c:RegisterEffect(ex,true)
return table.unpack(res)
end
function cm.copyfilter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and not c:IsType(TYPE_TRAPMONSTER)
end
function cm.gfilter(c,g)
if not g then return true end
return not g:IsContains(c)
end
function cm.gfilter1(c,g)
if not g then return true end
return not g:IsExists(cm.gfilter2,1,nil,c:GetOriginalCode())
end
function cm.gfilter2(c,code)
return c:GetOriginalCode()==code
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local copyt=Senya.order_table[e:GetLabel()]
local exg=Group.CreateGroup()
for tc,cid in pairs(copyt) do
if tc and cid then exg:AddCard(tc) end
end
local g=Duel.GetMatchingGroup(cm.copyfilter,tp,0,LOCATION_MZONE,nil)
local dg=exg:Filter(cm.gfilter,nil,g)
for tc in aux.Next(dg) do
c:ResetEffect(copyt[tc],RESET_COPY)
exg:RemoveCard(tc)
copyt[tc]=nil
end
local cg=g:Filter(cm.gfilter1,nil,exg)
local f=Card.RegisterEffect
Card.RegisterEffect=function(tc,e,forced)
e:SetCondition(cm.rcon(e:GetCondition(),tc,copyt))
f(tc,e,forced)
end
for tc in aux.Next(cg) do
copyt[tc]=c:CopyEffect(tc:GetOriginalCode(),RESET_EVENT+0x1fe0000,1)
end
Card.RegisterEffect=f
end
function cm.rcon(con,tc,copyt)
return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsHasEffect(m-1000) then
c:ResetEffect(c,copyt[tc],RESET_COPY)
copyt[tc]=nil
return false
end
return not con or con(e,tp,eg,ep,ev,re,r,rp)
end
end
\ No newline at end of file
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