Commit 7ceb6042 authored by Nemo Ma's avatar Nemo Ma

0310wd

parent c43a5563
...@@ -1593,6 +1593,15 @@ ...@@ -1593,6 +1593,15 @@
98920618 0 98920618 0
98920671 0 98920671 0
98920730 0 98920730 0
14010146 0
14010147 0
14010148 0
16670007 0
16670012 0
16670035 0
16670045 0
60010034 0
60010035 0
#Semi-Wild 1003 #Semi-Wild 1003
31409200 0 31409200 0
31409201 0 31409201 0
......
No preview for this file type
--恶鬼切目
local m=14010146
local cm=_G["c"..m]
function cm.initial_effect(c)
--handeffect
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0x3c0)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCountLimit(1,m)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
return not Duel.CheckEvent(EVENT_CHAINING)
end)
e1:SetCost(cm.ForbiddenCost(cm.DescriptionCost()))
e1:SetTarget(cm.CopyTarget)
e1:SetOperation(cm.CopyOperation)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAINING)
e2:SetCondition(aux.TRUE)
c:RegisterEffect(e2)
--graveeffect
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetRange(LOCATION_GRAVE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetHintTiming(0x3c0)
e3:SetCountLimit(1,m+1000)
e3:SetCost(aux.bfgcost)
e3:SetTarget(cm.thtg)
e3:SetOperation(cm.thop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,2))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetRange(LOCATION_GRAVE)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetHintTiming(0x3c0)
e4:SetCountLimit(1,m+1000)
e4:SetCost(cm.spcost)
e4:SetTarget(cm.sptg)
e4:SetOperation(cm.spop)
c:RegisterEffect(e4)
end
function cm.ForbiddenCost(costf)
return function(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
if not costf then return true end
return costf(e,tp,eg,ep,ev,re,r,rp,chk)
end
end
function cm.DescriptionCost(costf)
return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return (not costf or costf(e,tp,eg,ep,ev,re,r,rp,0)) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
if costf then costf(e,tp,eg,ep,ev,re,r,rp,1) end
end
end
--[[function cm.IgnoreActionCheck(f,...)
Duel.DisableActionCheck(true)
local cr=coroutine.create(f)
local ret={}
while coroutine.status(cr)~="dead" do
local sret={coroutine.resume(cr,...)}
for i=2,#sret do
table.insert(ret,sret[i])
end
end
Duel.DisableActionCheck(false)
return table.unpack(ret)
end--]]
function cm.ProtectedRun(f,...)
if not f then return true end
local params={...}
local ret={}
local res_test=pcall(function()
ret={f(table.unpack(params))}
end)
if not res_test then return false end
return table.unpack(ret)
end
function cm.GetHandEffect(c,tc)
cm.dis_cache=cm.dis_cache or {}
cm.urara_cache=cm.urara_cache or {}
local code=c:GetOriginalCode()
if cm.urara_cache[code] then return cm.urara_cache[code] end
local eset={}
local temp=Card.RegisterEffect
Card.RegisterEffect=function(tc,e,f)
if (e:GetRange()&LOCATION_HAND)>0 and e:IsHasType(EFFECT_TYPE_IGNITION+EFFECT_TYPE_QUICK_F+EFFECT_TYPE_QUICK_O+EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_TRIGGER_O) then
local found=false
local cost=e:GetCost()
local temp_=Effect.GetHandler
local IsDiscardable_=Card.IsDiscardable
Effect.GetHandler=function(e2)
if e==e2 then return tc end
return temp_(e2)
end
Card.IsDiscardable=function(tc2,...)
if tc2==tc then found=true end
return IsDiscardable_(tc2,...)
end
pcall(function()
cost(e,tp,eg,ep,ev,re,r,rp,0)
end)
Card.IsDiscardable=IsDiscardable_
Effect.GetHandler=temp_
if found then table.insert(eset,e:Clone()) end
end
return true --temp(tc,e,f)
end
--local tempc=cm.IgnoreActionCheck(Duel.CreateToken,c:GetControler(),code)
if not _G["c"..code] then return false end
local ini=_G["c"..code].initial_effect
local tempc=tc
if ini then c.initial_effect(tc) end
Card.RegisterEffect=temp
local found=false
for _,te in ipairs(eset) do
local cost=te:GetCost()
if cost then
local mt=getmetatable(tempc)
local temp_=Effect.GetHandler
Effect.GetHandler=function(e)
if e==te then return tempc end
return temp_(e)
end
mt.IsDiscardable=function(tc,...)
if tempc==tc then found=true end
return Card.IsDiscardable(tc,...)
end
pcall(function()
cost(te,tp,eg,ep,ev,re,r,rp,0)
end)
mt.IsDiscardable=nil
Effect.GetHandler=temp_
end
end
cm.urara_cache[code]=eset
cm.dis_cache[code]=(found and 1 or 0)
if found and found==false then return false end
return eset
end
function cm.CheckHandEffect(c,sec,e,tp,eg,ep,ev,re,r,rp)
local eset=cm.GetHandEffect(c,e:GetHandler())
if eset==false then return false end
if #eset==0 then return false end
local ee,teg,tep,tev,tre,tr,trp
for _,te in ipairs(eset) do
local tres=false
local types=te:GetType()
local code=te:GetCode()
if code and code~=EVENT_CHAINING and code~=EVENT_FREE_CHAIN then
tres,teg,tep,tev,tre,tr,trp=Duel.CheckEvent(code,true)
elseif sec or code==EVENT_FREE_CHAIN then
tres=true
teg,tep,tev,tre,tr,trp=eg,ep,ev,re,r,rp
end
if types==EFFECT_TYPE_IGNITION then
tres=true
teg,tep,tev,tre,tr,trp=eg,ep,ev,re,r,rp
end
if tres then
local con=te:GetCondition()
local tg=te:GetTarget()
if cm.ProtectedRun(con,e,tp,teg,tep,tev,tre,tr,trp) and cm.ProtectedRun(tg,e,tp,teg,tep,tev,tre,tr,trp,0) then
ee=te
break
end
end
end
if ee then
return true,ee,teg,tep,tev,tre,tr,trp
else
return false
end
end
function cm.CopyFilter(c,sec,e,tp,eg,ep,ev,re,r,rp)
return c:IsType(TYPE_MONSTER) and not c:IsCode(m)
and c:IsAbleToGraveAsCost() and cm.CheckHandEffect(c,sec,e,tp,eg,ep,ev,re,r,rp)
end
function cm.CopyTarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
local te=e:GetLabelObject()
local tg=te:GetTarget()
return te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and cm.ProtectedRun(tg,e,tp,eg,ep,ev,re,r,rp,0,chkc)
end
local c=e:GetHandler()
local og=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
local sec=(e:GetCode()==EVENT_CHAINING)
if chk==0 then
if e:GetLabel()==0 then return false end
e:SetLabel(0)
return og:IsExists(cm.CopyFilter,1,nil,sec,e,tp,eg,ep,ev,re,r,rp) and c:IsDiscardable()
end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=og:FilterSelect(tp,cm.CopyFilter,1,1,nil,sec,e,tp,eg,ep,ev,re,r,rp)
local _,te,ceg,cep,cev,cre,cr,crp=cm.CheckHandEffect(g:GetFirst(),sec,e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(g,REASON_COST)
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
e:SetLabel(te:GetLabel())
local tg=te:GetTarget()
cm.ProtectedRun(tg,e,tp,ceg,cep,cev,cre,cr,crp,1)
te:SetLabelObject(e:GetLabelObject())
e:SetLabelObject(te)
local ex=Effect.GlobalEffect()
ex:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ex:SetCode(EVENT_CHAIN_END)
ex:SetLabelObject(e)
ex:SetOperation(function(e)
e:GetLabelObject():SetLabel(0)
ex:Reset()
end)
Duel.RegisterEffect(ex,tp)
end
function cm.CopyOperation(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if not te then return end
e:SetLabelObject(te:GetLabelObject())
local op=te:GetOperation()
if te:IsHasType(EFFECT_TYPE_ACTIVATE) then
e:GetHandler():ReleaseEffectRelation(e)
end
cm.ProtectedRun(op,e,tp,eg,ep,ev,re,r,rp)
end
function cm.thfilter(c)
return c:IsType(TYPE_TUNER) and c:IsAttack(0) and c:IsDefense(1800) and c:IsAbleToHand() and not c:IsCode(m)
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost()
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end
function cm.filter(c)
return c:IsSpecialSummonable(SUMMON_TYPE_LINK)
end
function cm.spfilter(c,e,tp)
return c:IsType(TYPE_TUNER) and c:IsAttack(0) and c:IsDefense(1800) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and cm.spfilter(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(cm.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cm.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local b1=Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,nil)
local b2=Duel.IsExistingMatchingCard(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,nil,nil)
local b3=Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_EXTRA,0,1,nil)
if b1 or b2 or b3 then
if not Duel.SelectYesNo(tp,aux.Stringid(m,3)) then return end
else
return
end
local off=1
local ops,opval={},{}
if b1 then
ops[off]=aux.Stringid(m,4)
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=aux.Stringid(m,5)
opval[off-1]=2
off=off+1
end
if b3 then
ops[off]=aux.Stringid(m,6)
opval[off-1]=3
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
local sel=opval[op]
if sel==1 then
local g=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,nil)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SynchroSummon(tp,sg:GetFirst(),nil)
end
elseif sel==2 then
local g=Duel.GetMatchingGroup(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,nil,nil)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=g:Select(tp,1,1,nil)
Duel.XyzSummon(tp,tg:GetFirst(),nil)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummonRule(tp,tc,SUMMON_TYPE_LINK)
end
end
end
end
end
\ No newline at end of file
--破名椛
local m=14010147
local cm=_G["c"..m]
function cm.initial_effect(c)
--limit
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,m)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsDiscardable() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp)
Duel.SetTargetParam(ac)
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,ANNOUNCE_CARD)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
e:GetHandler():SetHint(CHINT_CARD,ac)
--splimit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetTarget(cm.splimit)
e1:SetLabel(ac)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
--actlimit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetLabel(ac)
e2:SetValue(cm.aclimit)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
function cm.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsCode(e:GetLabel())
end
function cm.aclimit(e,re,tp)
return re:GetHandler():IsCode(e:GetLabel())
end
\ No newline at end of file
--亡都祭
local m=14010148
local cm=_G["c"..m]
function cm.initial_effect(c)
--tograve
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,m)
e1:SetCost(cm.cost)
e1:SetCondition(cm.condition)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsDiscardable() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_FZONE,1,nil)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if chk==0 then return #g>0 end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,tp,LOCATION_ONFIELD)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
end
\ No newline at end of file
--久远的传承
local m=16670007
local cm=_G["c"..m]
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
-- e1:SetCategory(CATEGORY_CONTROL)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_DUEL+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
--
if not c16670007.global_check then
c16670007.global_check={}
-- local ge1=Effect.GlobalEffect(c)
-- ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
-- ge1:SetCode(EVENT_TO_GRAVE)
-- ge1:SetCondition(c16670007.checkcon)
-- ge1:SetOperation(c16670007.checkop)
-- Duel.RegisterEffect(ge1,0)
end
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
local code1=g:GetFirst()
local code=g:GetFirst():GetOriginalCodeRule()
local cid=0
local cid2=0
local ua=false
local token=true
local mt={}
for tc,num in pairs(c16670007.global_check) do
cid=num
token=Duel.CreateToken(tp,num)
mt=getmetatable(token)
cm.reg =Card.RegisterEffect
Card.RegisterEffect = cm.reg2
if mt.initial_effect then
mt.initial_effect(code1)
end
Card.RegisterEffect = cm.reg
-- cid2=code1:CopyEffect(cid,RESET_EVENT+RESETS_STANDARD,1)
-- Duel.MajesticCopy(code1,token)
end
for i,v in pairs(c16670007.global_check) do
if v==code then
ua=true
end
end
if ua==false then
table.insert(c16670007.global_check,code)
end
local e1_1=Effect.CreateEffect(c)
e1_1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1_1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1_1:SetRange(LOCATION_MZONE)
e1_1:SetCode(EVENT_LEAVE_FIELD)
e1_1:SetTarget(cm.tg1)
e1_1:SetOperation(cm.op1)
-- e1_1:SetReset(RESET_EVENT+0x1fe0000)
code1:RegisterEffect(e1_1)
--
local e1_2=Effect.CreateEffect(c)
e1_2:SetDescription(aux.Stringid(16670007,0))
e1_2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1_2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1_2:SetRange(LOCATION_MZONE)
e1_2:SetCode(EVENT_LEAVE_FIELD)
e1_2:SetReset(RESET_EVENT+0x1fe0000)
code1:RegisterEffect(e1_2)
--
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCountLimit(1)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
e3:SetLabelObject(e1_1)
e3:SetLabel(cid2)
e3:SetOperation(cm.rstop)
code1:RegisterEffect(e3)
--
end
local ap=e:GetType()
if ap~=EFFECT_TYPE_ACTIVATE then
e:Reset()
end
end
--
function cm.rstop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local cid=e:GetLabel()
if cid~=0 then
c:ResetEffect(cid,RESET_COPY)
c:ResetEffect(RESET_DISABLE,RESET_EVENT)
end
local e1=e:GetLabelObject()
local e2=e:GetProperty()
e1:Reset()
end
function cm.reg2(c,e,ob)
local b=ob or false
if e:IsHasType(EFFECT_TYPE_QUICK_F) then
e:SetType((e:GetType()-EFFECT_TYPE_QUICK_F)|EFFECT_TYPE_QUICK_O)
local flag1,flag2=e:GetProperty()
e:SetProperty(flag1|EFFECT_FLAG_DELAY,flag2)
end
if e:IsHasType(EFFECT_TYPE_TRIGGER_F) then
e:SetType((e:GetType()-EFFECT_TYPE_TRIGGER_F)|EFFECT_TYPE_TRIGGER_O)
end
e:SetReset(RESET_EVENT+RESETS_STANDARD)
if not e:IsActivated() then e:Reset()
else
cm.reg(c,e,b)
end
end
--惊喜礼盒
local m=16670012
local cm=_G["c"..m]
cm.loaded_metatable_list={}
cm.loaded_metatable_list2={}
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
--e1:SetCountLimit(3,m+EFFECT_COUNT_CODE_OATH)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
c:RegisterEffect(e2)
--
if not cm.global_check then
cm.global_check=true
local e11=Effect.CreateEffect(c)
e11:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e11:SetCode(EVENT_PHASE+PHASE_DRAW)
e11:SetCountLimit(1)
e11:SetOperation(cm.thop)
-- Duel.RegisterEffect(e11,0)
end
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local s=math.random(0,9)
local s1=s*1000000
local s2=s1+999999
for i=1,9999999 do
local mt1=cm.load_metatable(i)
if mt1 then
local token=Duel.CreateToken(tp,l)
if token and (token:IsType(TYPE_SPELL) or token:IsType(TYPE_TRAP)) then
table.insert(cm.loaded_metatable_list2,i)
end
end
end
e:Reset()
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
return true
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then
if e:GetLabel()==0 then return false end
e:SetLabel(0)
return true
end
e:SetLabel(0)
local c=e:GetHandler()
--[[
local codelist={}
local s=math.random(0,9)
local s1=s*1000000
local s2=s1+999999
math.randomseed(tostring(os.time()):reverse():sub(1, 6))
]]--
local codelist2=0
for i=1,9999999 do
if codelist2~=0 then
break
end
local l=Duel.GetRandomNumber(1,9999999)--math.random(1,9999999)
--local l=math.random(1,#cm.loaded_metatable_list2)
--local mt=cm.load_metatable(l)
local mt=cm.load_metatable_load(l)
if mt then
local token=Duel.CreateToken(tp,l)
if token and (token:IsType(TYPE_SPELL) or token:IsType(TYPE_TRAP)) and not token:IsType(TYPE_EQUIP)
and-- not token:IsType(TYPE_CONTINUOUS) and
not token:IsType(TYPE_FIELD)
-- and not token:IsType(TYPE_FIELD) and not token:IsType(TYPE_CONTINUOUS)
and token:CheckActivateEffect(false,true,false)~=nil
and token:CheckActivateEffect(false,true,false):GetOperation()~=nil then
-- table.insert(codelist,i)
--[[local ab=codelist--cm.get_announce(codelist)
for i=1,5 do
local p=math.random(1,#ab)
table.insert(codelist2,1,ab[p])
end
local ac=codelist2[1] ]]--
--if token:CheckActivateEffect(true,true,false)==nil then
-- e:SetLabelObject(nil)
-- else
-- c:SetHint(CHINT_CARD,l)
Duel.Hint(HINT_CARD,tp,l)
Duel.Hint(HINT_CODE,1-tp,l)
Duel.Hint(HINT_CODE,tp,l)
local te,ceg,cep,cev,cre,cr,crp=token:CheckActivateEffect(true,true,true)
e:SetProperty(te:GetProperty())
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET,0,1,0,0)
local tg=te:GetTarget()
if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end
te:SetLabelObject(e:GetLabelObject())
e:SetLabelObject(te)
Duel.ClearOperationInfo(0)
--end
codelist2=codelist2+1
end
end
end
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te=e:GetLabelObject()
if not te then return end
e:SetLabelObject(te:GetLabelObject())
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
local num=c:GetFlagEffect(m)
if c:IsRelateToEffect(e) and c:IsCanTurnSet() and e:IsHasType(EFFECT_TYPE_ACTIVATE) and c:IsLocation(LOCATION_SZONE)
and num<2 then
Duel.BreakEffect()
c:CancelToGrave()
Duel.ChangePosition(c,POS_FACEDOWN)
Duel.RaiseEvent(c,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
end
end
function cm.get_announce(t)
local rt={t[1],OPCODE_ISCODE}
for i=2,#t do
if not t[i] then break end
table.insert(rt,t[i])
table.insert(rt,OPCODE_ISCODE)
table.insert(rt,OPCODE_OR)
end
table.insert(rt,TYPE_TRAP)
table.insert(rt,OPCODE_ISTYPE)
table.insert(rt,TYPE_SPELL)
table.insert(rt,OPCODE_ISTYPE)
table.insert(rt,OPCODE_AND)
table.insert(rt,OPCODE_AND)
return rt
end
function cm.load_metatable(code)
--local m1=_G["c"..code]
--if m1 then return m1 end
local m2=cm.loaded_metatable_list[code]
if m2 then return m2 end
_G["c"..code]={}
if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then
local mt=_G["c"..code]
_G["c"..code]=nil
if mt then
-- cm.loaded_metatable_list[code]=mt
return mt
end
else
_G["c"..code]=nil
end
end
function cm.load_metatable_load(code)
local type=Duel.ReadCard(code,CARDDATA_TYPE)
return type
end
function cm.load_metatable2(code)
local m2=cm.loaded_metatable_list[code]
if m2 then return m2 end
_G["c"..code]={}
if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then
local mt=_G["c"..code]
_G["c"..code]=nil
if mt then
cm.loaded_metatable_list[code]=mt
return mt
end
else
_G["c"..code]=nil
end
end
\ No newline at end of file
--军火大师
local m=16670035
local cm=_G["c"..m]
function cm.initial_effect(c)
--
local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_PREDRAW)
e0:SetRange(0xfff)
e0:SetCountLimit(1,m+EFFECT_COUNT_CODE_DUEL)
e0:SetOperation(cm.autoop)
c:RegisterEffect(e0)
--
end
function cm.autoop(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
Duel.Hint(HINT_CARD,1-tp,m)
Duel.ConfirmCards(1-tp,c)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0xfff,0,nil)
local g2=Duel.GetMatchingGroup(aux.TRUE,tp,0,0xfff-LOCATION_OVERLAY,nil)
Duel.Exile(g,REASON_RULE)
for tc in aux.Next(g2) do
local ac=tc:GetOriginalCode()
local token=Duel.CreateToken(tp,ac)
if tc:IsLocation(LOCATION_DECK) then
Duel.SendtoDeck(token,tp,SEQ_DECKBOTTOM,REASON_RULE)
elseif tc:IsLocation(LOCATION_HAND) then
Duel.SendtoHand(token,tp,REASON_RULE)
elseif tc:IsLocation(LOCATION_ONFIELD) then
local q=tc:GetPosition()
local w=tc:GetSequence()
local a=false
if tc:IsFaceup() then
a=true
end
if tc:IsLocation(LOCATION_MZONE) then
Duel.MoveToField(token,tp,tp,LOCATION_MZONE,q,a,w)
else
Duel.MoveToField(token,tp,tp,LOCATION_SZONE,q,a,w)
end
elseif tc:IsLocation(LOCATION_GRAVE) then
Duel.SendtoGrave(token,REASON_RULE)
elseif tc:IsLocation(LOCATION_EXTRA) then
if tc:IsFaceup() then
Duel.SendtoExtraP(token,nil,REASON_RULE)
else
Duel.SendtoDeck(token,tp,SEQ_DECKBOTTOM,REASON_RULE)
end
elseif tc:IsLocation(LOCATION_REMOVED) then
local q=tc:GetPosition()
Duel.Remove(token,q,REASON_RULE)
end
if tc:GetOverlayGroup()~=nil then
local g3=tc:GetOverlayGroup()
for tz in aux.Next(g3) do
local az=tz:GetOriginalCode()
local token2=Duel.CreateToken(tp,az)
Duel.SendtoDeck(token2,tp,SEQ_DECKBOTTOM,REASON_RULE)
Duel.Overlay(token,token2)
end
end
end
--[[
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_DRAW_COUNT)
e2:SetTargetRange(1,0)
e2:SetValue(2)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_SET_SUMMON_COUNT_LIMIT)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,0)
e3:SetValue(2)
Duel.RegisterEffect(e3,tp)
]]--
g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_DECK,0,nil)
Duel.ConfirmCards(tp,g)
end
--血源猎手 永世的沉沦鲸梦
local cm,m,o=GetID()
function cm.initial_effect(c)
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_ADJUST)
e1:SetCondition(cm.rcon)
e1:SetOperation(cm.rop)
c:RegisterEffect(e1)
--
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,0))
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_REMOVED)
e3:SetCountLimit(1,m)
e3:SetTarget(cm.otg)
e3:SetOperation(cm.oop)
c:RegisterEffect(e3)
end
cm.toss_dice=true
function cm.rcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_HAND) and e:GetHandler():IsAbleToRemove()
end
function cm.rop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.Remove(c,POS_FACEUP,REASON_EFFECT)~=0 and Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_HAND,0)<=1 then
Duel.Draw(e:GetHandlerPlayer(),1,REASON_EFFECT)
end
end
function cm.otg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_DECK,0)>0 end
end
function cm.oop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local x=Duel.TossDice(tp,1)
Duel.Draw(tp,x,REASON_EFFECT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local hg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,0,nil):Select(tp,x,x,nil)
Duel.SendtoDeck(hg,tp,0,REASON_EFFECT)
local hg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,0,nil)
local fst=false
local scd=false
local trd=false
if hg:IsExists(Card.IsType,2,nil,TYPE_SPELL) then fst=true end
if hg:IsExists(Card.IsType,2,nil,TYPE_MONSTER) then scd=true end
if hg:IsExists(Card.IsType,1,nil,TYPE_MONSTER) and hg:IsExists(Card.IsType,1,nil,TYPE_SPELL) and hg:IsExists(Card.IsType,1,nil,TYPE_TRAP) then trd=true end
if fst==true then
Duel.ConfirmDecktop(tp,x)
local g=Duel.GetDecktopGroup(tp,x)
if g:GetCount()>0 then
local gc=g:GetFirst()
for i=1,g:GetCount() do
if gc:IsType(TYPE_SPELL) and gc:CheckActivateEffect(false,false,false)~=nil then
local te=gc:GetActivateEffect()
if gc:IsType(TYPE_FIELD) then
Duel.MoveToField(gc,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
Duel.RaiseEvent(gc,4179255,te,0,tp,tp,Duel.GetCurrentChain())
else
Duel.MoveToField(gc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
te:UseCountLimit(tp,1,true)
cm.ActivateCard(gc,tp,e)
if not (gc:IsType(TYPE_CONTINUOUS) or gc:IsType(TYPE_FIELD) or gc:IsType(TYPE_EQUIP)) then
Duel.SendtoGrave(gc,REASON_RULE)
end
end
gc=g:GetNext()
end
end
end
if scd==true then
Duel.ConfirmDecktop(tp,x)
local g=Duel.GetDecktopGroup(tp,x)
if g:GetCount()>0 then
local gc=g:GetFirst()
for i=1,g:GetCount() do
if gc:IsType(TYPE_MONSTER) and gc:IsCanBeSpecialSummoned(e,0,tp,false,false) then
Duel.SpecialSummon(gc,0,tp,tp,false,false,POS_FACEUP)
end
gc=g:GetNext()
end
end
end
if trd==true then
Duel.ConfirmDecktop(tp,x)
local hhg=Duel.GetDecktopGroup(tp,x)
local mth=math.min(hhg:Filter(Card.IsType,nil,TYPE_MONSTER):GetCount(),hhg:Filter(Card.IsType,nil,TYPE_SPELL):GetCount(),hhg:Filter(Card.IsType,nil,TYPE_TRAP):GetCount())
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if g:GetCount()>0 then
Duel.ConfirmCards(1-tp,g)
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_DISCARD)
local sg=g:Select(tp,1,mth,nil)
Duel.SendtoGrave(sg,REASON_EFFECT+REASON_DISCARD)
Duel.ShuffleHand(1-tp)
end
end
end
function cm.ActivateCard(c,tp,oe)
local e=c:GetActivateEffect()
local cos,tg,op=e:GetCost(),e:GetTarget(),e:GetOperation()
if e and (not cos or cos(e,tp,eg,ep,ev,re,r,rp,0)) and (not tg or tg(e,tp,eg,ep,ev,re,r,rp,0)) then
oe:SetProperty(e:GetProperty())
local code=c:GetOriginalCode()
Duel.Hint(HINT_CARD,tp,code)
Duel.Hint(HINT_CARD,1-tp,code)
e:UseCountLimit(tp,1,true)
c:CreateEffectRelation(e)
if cos then cos(e,p,eg,ep,ev,re,r,rp,1) end
if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g and #g~=0 then
local tg=g:GetFirst()
while tg do
tg:CreateEffectRelation(e)
tg=g:GetNext()
end
end
if op then op(e,tp,eg,ep,ev,re,r,rp) end
c:ReleaseEffectRelation(e)
if g then
tg=g:GetFirst()
while tg do
tg:ReleaseEffectRelation(e)
tg=g:GetNext()
end
end
end
end
--血源猎手 碎裂的大洋涡流
local cm,m,o=GetID()
function cm.initial_effect(c)
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_ADJUST)
e1:SetCondition(cm.rcon)
e1:SetOperation(cm.rop)
c:RegisterEffect(e1)
--
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,0))
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_REMOVED)
e3:SetCountLimit(1,m)
e3:SetTarget(cm.otg)
e3:SetOperation(cm.oop)
c:RegisterEffect(e3)
end
cm.toss_dice=true
function cm.rcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_HAND) and e:GetHandler():IsAbleToRemove()
end
function cm.rop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.Remove(c,POS_FACEUP,REASON_EFFECT)~=0 and Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_HAND,0)<=1 then
Duel.Draw(e:GetHandlerPlayer(),1,REASON_EFFECT)
end
end
function cm.otg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_DECK,0)>0 end
end
function cm.oop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local x=Duel.TossDice(tp,1)
Duel.Draw(tp,x,REASON_EFFECT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local hg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,0,nil):Select(tp,x,x,nil)
Duel.SendtoDeck(hg,tp,0,REASON_EFFECT)
local hg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,0,nil)
local fst=false
local scd=false
local trd=false
if #Group.Filter(hg,Card.IsType,nil,TYPE_MONSTER)==1 and #Group.Filter(hg,Card.IsType,nil,TYPE_SPELL)==1 and #Group.Filter(hg,Card.IsType,nil,TYPE_TRAP)==1 then fst=true end
if not hg:IsExists(Card.IsType,1,nil,TYPE_SPELL+TYPE_TRAP) then scd=true end
if not hg:IsExists(Card.IsType,1,nil,TYPE_MONSTER) then trd=true end
if fst==true then
local dg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_DECK,0,nil):Select(tp,x,x,nil)
local tc=dg:GetFirst()
while tc do
Duel.MoveSequence(tc,SEQ_DECKTOP)
tc=dg:GetNext()
end
Duel.SortDecktop(tp,tp,x)
end
if scd==true then
Duel.ConfirmDecktop(tp,x)
local hhg=Duel.GetDecktopGroup(tp,x)
local yy=hhg:Filter(Card.IsType,nil,TYPE_MONSTER):GetCount()
Duel.RegisterFlagEffect(e:GetHandler(),m,RESET_PHASE+PHASE_END,0,yy)
--negate
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DISABLE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_CHAINING)
e3:SetOperation(cm.negop1)
e3:SetReset(RESET_PHASE+PHASE_END,1)
Duel.RegisterEffect(e3,tp)
end
if trd==true then
Duel.ConfirmDecktop(tp,x)
local hhg=Duel.GetDecktopGroup(tp,x)
local yy=hhg:Filter(Card.IsType,nil,TYPE_SPELL):GetCount()+hhg:Filter(Card.IsType,nil,TYPE_TRAP):GetCount()
Duel.RegisterFlagEffect(e:GetHandler(),m+20000000,RESET_PHASE+PHASE_END,0,yy)
--negate
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DISABLE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_CHAINING)
e3:SetOperation(cm.negop2)
e3:SetReset(RESET_PHASE+PHASE_END,1)
Duel.RegisterEffect(e3,tp)
end
end
function cm.negop1(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if rc:GetControler()~=tp and rc:IsType(TYPE_MONSTER) and Duel.SelectEffectYesNo(tp,e:GetHandler()) then
Duel.NegateEffect(ev)
Duel.RegisterFlagEffect(e:GetHandler(),m+10000000,RESET_PHASE+PHASE_END,0,1)
if Duel.GetFlagEffect(e:GetHandler(),m)==Duel.GetFlagEffect(e:GetHandler(),m+10000000) then
e:Reset()
end
end
end
function cm.negop2(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if rc:GetControler()~=tp and (rc:IsType(TYPE_SPELL) or rc:IsType(TYPE_TRAP)) and Duel.SelectEffectYesNo(tp,e:GetHandler()) then
Duel.NegateEffect(ev)
Duel.RegisterFlagEffect(e:GetHandler(),m+30000000,RESET_PHASE+PHASE_END,0,1)
if Duel.GetFlagEffect(e:GetHandler(),m+20000000)==Duel.GetFlagEffect(e:GetHandler(),m+30000000) then
e:Reset()
end
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