Commit 3bf93a75 authored by REIKAI's avatar REIKAI 💬

emergency update

parent 9e0a2f90
Pipeline #19862 passed with stage
in 20 minutes and 44 seconds
No preview for this file type
local m=15000392
local cm=_G["c"..m]
cm.name="替身名-『南北战争』"
function cm.initial_effect(c)
--public
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,15000392)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
--CivilWar
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetRange(LOCATION_MZONE+LOCATION_HAND)
e4:SetCode(EFFECT_SEND_REPLACE)
e4:SetTarget(cm.reptg)
e4:SetValue(cm.repval)
c:RegisterEffect(e4)
local g=Group.CreateGroup()
g:KeepAlive()
e4:SetLabelObject(g)
--CivilWar
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetRange(LOCATION_MZONE+LOCATION_HAND)
e3:SetCode(EFFECT_SEND_REPLACE)
e3:SetTarget(cm.rep2tg)
e3:SetValue(cm.repval)
c:RegisterEffect(e3)
local ag=Group.CreateGroup()
ag:KeepAlive()
e3:SetLabelObject(ag)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local fid=c:GetFieldID()
c:RegisterFlagEffect(15000391,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,fid,66)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_PUBLIC)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
function cm.repfilter(c,e)
local p=c:GetControler()
if c:IsLocation(LOCATION_OVERLAY) then p=c:GetOverlayTarget():GetControler() end
return c:GetDestination()==LOCATION_GRAVE and c:IsType(TYPE_MONSTER)
and c:IsCanBeSpecialSummoned(e,0,p,false,false)
and Duel.GetMZoneCount(1-p,c,p)>0
and not c:IsLocation(LOCATION_MZONE)
end
function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return ((e:GetHandler():IsPublic() and e:GetHandler():IsLocation(LOCATION_HAND)) or e:GetHandler():IsLocation(LOCATION_MZONE))
and eg:IsExists(cm.repfilter,1,nil,e) and ((not re) or re~=e) end
if eg:IsExists(cm.repfilter,1,nil,e) and ((not re) or re~=e) then
local container=e:GetLabelObject()
container:Clear()
local g=eg:Filter(cm.repfilter,nil,e)
local g1=g:Filter(Card.IsControler,nil,0)
local g2=g:Filter(Card.IsControler,nil,1)
local ct1=g1:GetCount()
local ct2=g2:GetCount()
local ct=ct1+ct2
local tc=g:GetFirst()
while tc do
local p=tc:GetControler()
if tc:IsLocation(LOCATION_OVERLAY) then p=tc:GetOverlayTarget():GetControler() end
local ft=Duel.GetMZoneCount(1-p,tc,p)
if not ((p==0 and ft>=ct1) or (p==1 and ft>=ct2)) then return false end
tc=g:GetNext()
end
local ag=Group.CreateGroup()
local tc=g:GetFirst()
while tc do
local p=tc:GetControler()
if tc:IsLocation(LOCATION_OVERLAY) then p=tc:GetOverlayTarget():GetControler() end
if Duel.SpecialSummonStep(tc,0,p,1-p,false,false,POS_FACEUP) then ag:AddCard(tc) end
tc:RegisterFlagEffect(15000392,RESET_EVENT+0x1de0000+RESET_PHASE+PHASE_END,0,1)
tc=g:GetNext()
end
Duel.SpecialSummonComplete()
container:Merge(g)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(m,1))
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetCondition(cm.tdcon)
e1:SetOperation(cm.tdop)
e1:SetReset(RESET_PHASE+PHASE_DRAW)
Duel.RegisterEffect(e1,tp)
return true
else return false end
end
function cm.rep2filter(c,e)
return c:GetDestination()==LOCATION_GRAVE and c:IsType(TYPE_MONSTER)
and c:IsControlerCanBeChanged()
and Duel.GetMZoneCount(1-c:GetControler(),c,c:GetControler())>0
and c:IsLocation(LOCATION_MZONE) and not c:IsLocation(LOCATION_OVERLAY)
end
function cm.rep2tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return ((e:GetHandler():IsPublic() and e:GetHandler():IsLocation(LOCATION_HAND)) or e:GetHandler():IsLocation(LOCATION_MZONE))
and eg:IsExists(cm.rep2filter,1,nil,e) and ((not re) or re~=e) end
if eg:IsExists(cm.rep2filter,1,nil,e) and ((not re) or re~=e) then
local container=e:GetLabelObject()
container:Clear()
local g=eg:Filter(cm.rep2filter,nil,e)
local g1=g:Filter(Card.IsControler,nil,0)
local g2=g:Filter(Card.IsControler,nil,1)
local ct1=g1:GetCount()
local ct2=g2:GetCount()
local ct=ct1+ct2
local tc=g:GetFirst()
while tc do
local ft=Duel.GetMZoneCount(1-tc:GetControler(),tc,tc:GetControler())
if not ((tc:GetControler()==0 and ft>=ct1) or (tc:GetControler()==1 and ft>=ct2)) then return false end
tc=g:GetNext()
end
local ag=Group.CreateGroup()
local tc=g:GetFirst()
while tc do
local p=tc:GetControler()
if Duel.GetControl(tc,1-p)~=0 then ag:AddCard(tc) end
tc:RegisterFlagEffect(15000392,RESET_EVENT+0x1de0000+RESET_PHASE+PHASE_END,0,1)
tc=g:GetNext()
end
container:Merge(g)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(m,1))
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetCondition(cm.tdcon)
e1:SetOperation(cm.tdop)
e1:SetReset(RESET_PHASE+PHASE_DRAW)
Duel.RegisterEffect(e1,tp)
return true
else return false end
end
function cm.repval(e,c)
return e:GetLabelObject():IsContains(c)
end
function cm.tdfilter(c)
return c:GetFlagEffect(15000392)~=0
end
function cm.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.tdfilter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.tdfilter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.HintSelection(g)
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
end
\ No newline at end of file
local m=15000394
local cm=_G["c"..m]
cm.name="替身名-『白蛇』"
function cm.initial_effect(c)
c:EnableCounterPermit(0xf31)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),aux.NonTuner(nil),1)
c:EnableReviveLimit()
--disable
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.distg)
e1:SetOperation(cm.disop)
c:RegisterEffect(e1)
--gain
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetTarget(cm.gtg)
e2:SetOperation(cm.gop)
c:RegisterEffect(e2)
end
function cm.notfilter1(c)
return c:IsFaceup() and aux.NegateMonsterFilter(c) and not c:IsCode(15000394)
end
function cm.notfilter2(c)
return c:IsFaceup() and not c:IsCode(15000394)
end
function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.notfilter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.notfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) and e:GetHandler():IsCanAddCounter(0xf31,1) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
local g=Duel.SelectTarget(tp,cm.notfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
local dis=0
if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e)
and not tc:IsImmuneToEffect(e) then
if ((not tc:IsDisabled()) and (not tc:IsAttack(0))) then dis=1 end
c:SetCardTarget(tc)
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetCondition(cm.rcon)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE)
e2:SetCondition(cm.rcon)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE_EFFECT)
e3:SetValue(RESET_TURN_SET)
e3:SetCondition(cm.rcon)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
if tc:IsType(TYPE_TRAPMONSTER) then
local e4=e2:Clone()
e4:SetCode(EFFECT_DISABLE_TRAPMONSTER)
tc:RegisterEffect(e4)
end
Duel.BreakEffect()
if tc:IsDisabled() and tc:IsAttack(0) and dis==1 and tc:IsType(TYPE_MONSTER) then
local code=tc:GetCode()
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetCode(15000394)
e5:SetRange(LOCATION_MZONE)
e5:SetLabel(code)
e5:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_ADJUST)
e6:SetRange(0xff)
e6:SetCondition(cm.regcon)
e6:SetOperation(cm.regop)
e6:SetLabelObject(e5)
e6:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e6)
c:AddCounter(0xf31,1)
end
end
end
function cm.rcon(e)
return e:GetOwner():IsHasCardTarget(e:GetHandler())
end
function cm.regcon(e)
return e:GetHandler():IsLocation(LOCATION_SZONE) or e:GetHandler():GetCounter(0xf31)==0
end
function cm.regop(e)
local ce=e:GetLabelObject()
if ce then
ce:Reset()
e:Reset()
end
end
function cm.gtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then
return Duel.IsExistingTarget(cm.notfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,c) and c:IsCanRemoveCounter(tp,0xf31,1,REASON_EFFECT) and c:IsHasEffect(15000394)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,cm.notfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c)
end
function cm.isinarray(t,val)
for _,v in ipairs(t) do
if v==val then return false end
end
return true
end
function cm.gop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and c:IsCanRemoveCounter(tp,0xf31,1,REASON_EFFECT) and c:IsHasEffect(15000394) and not tc:IsImmuneToEffect(e) then
local codes={}
if c:IsHasEffect(15000394) then
for _,i in ipairs{c:IsHasEffect(15000394)} do
local code=i:GetLabel()
if code and cm.isinarray(codes,code) then table.insert(codes,code) end
end
end
table.sort(codes)
local afilter={codes[1],OPCODE_ISCODE}
if #codes>1 then
--or ... or c:IsCode(codes[i])
for i=2,#codes do
table.insert(afilter,codes[i])
table.insert(afilter,OPCODE_ISCODE)
table.insert(afilter,OPCODE_OR)
end
end
table.insert(afilter,TYPE_MONSTER)
table.insert(afilter,OPCODE_ISTYPE)
table.insert(afilter,OPCODE_AND)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp,table.unpack(afilter))
if c:IsHasEffect(15000394) then
for _,i in ipairs{c:IsHasEffect(15000394)} do
local code=i:GetLabel()
if ac==code then
i:Reset()
break
end
end
end
if not c:RemoveCounter(tp,0xf31,1,REASON_EFFECT) then return end
Duel.BreakEffect()
c:SetCardTarget(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(ac)
e1:SetCondition(cm.rcon)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local cid=tc:ReplaceEffect(ac,RESET_EVENT+RESETS_STANDARD)
--local cid=tc:CopyEffect(ac,RESET_EVENT+RESETS_STANDARD,1)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_ADJUST)
e3:SetLabelObject(e1)
e3:SetLabel(cid)
e3:SetCondition(cm.rstcon)
e3:SetOperation(cm.rstop)
Duel.RegisterEffect(e3,tp)
if tc:IsType(TYPE_NORMAL) then
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_REMOVE_TYPE)
e4:SetValue(TYPE_NORMAL)
e4:SetCondition(cm.rcon)
e4:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e4,true)
end
if not tc:IsType(TYPE_EFFECT) then
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_ADD_TYPE)
e5:SetValue(TYPE_EFFECT)
e5:SetCondition(cm.rcon)
e5:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e5,true)
end
end
end
function cm.rstcon(e)
return not e:GetOwner():IsHasCardTarget(e:GetLabelObject():GetHandler())
end
function cm.rstop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetLabelObject():GetHandler()
if not c then e:Reset() return end
local cid=e:GetLabel()
if cid~=0 then
c:ResetEffect(cid,RESET_COPY)
c:ResetEffect(RESET_DISABLE,RESET_EVENT)
end
local e1=e:GetLabelObject()
if e1 then e1:Reset() end
Duel.HintSelection(Group.FromCards(c))
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
if c:IsLocation(LOCATION_HAND) then Duel.ShuffleHand(c:GetControler()) end
e:Reset()
end
\ No newline at end of file
--Fate/Grand Order·埃列什基伽勒
local m=30610015
local cm=_G["c"..m]
function cm.initial_effect(c)
c:SetUniqueOnField(1,0,30610015)
c:EnableCounterPermit(0x1)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.spcon0)
e1:SetOperation(cm.spop0)
c:RegisterEffect(e1)
--token
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(m,0))
e0:SetType(EFFECT_TYPE_QUICK_O)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetHintTiming(0,TIMING_MAIN_END)
e0:SetRange(LOCATION_MZONE)
e0:SetCountLimit(1,m)
e0:SetCost(cm.addcost)
e0:SetTarget(cm.tg)
e0:SetOperation(cm.op)
c:RegisterEffect(e0)
Duel.AddCustomActivityCounter(m,ACTIVITY_SPSUMMON,cm.counterfilter)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,2))
e3:SetCategory(CATEGORY_POSITION+CATEGORY_DEFCHANGE+CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCost(cm.flcost)
e3:SetCondition(cm.flcon)
e3:SetTarget(cm.fltg)
e3:SetOperation(cm.flop)
c:RegisterEffect(e3)
--atk
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_UPDATE_ATTACK)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(cm.atkcon)
e4:SetValue(1500)
c:RegisterEffect(e4)
--immune
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_IMMUNE_EFFECT)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_MZONE)
e5:SetCondition(cm.atkcon)
e5:SetValue(cm.efilter)
c:RegisterEffect(e5)
--act limit
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_CANNOT_TRIGGER)
e6:SetRange(LOCATION_MZONE)
e6:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e6:SetCondition(cm.atkcon)
e6:SetTarget(cm.disable)
e6:SetValue(1)
c:RegisterEffect(e6)
--Attribute Dark
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e7:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e7:SetRange(LOCATION_MZONE+LOCATION_GRAVE)
e7:SetValue(ATTRIBUTE_DIVINE)
c:RegisterEffect(e7)
--Summon
local e8=Effect.CreateEffect(c)
e8:SetDescription(aux.Stringid(m,3))
e8:SetCategory(CATEGORY_SPECIAL_SUMMON)
e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e8:SetProperty(EFFECT_FLAG_DELAY)
e8:SetCode(EVENT_TO_GRAVE)
e8:SetCountLimit(1,m+1)
e8:SetCondition(cm.discon)
e8:SetTarget(cm.sptg)
e8:SetOperation(cm.spop)
c:RegisterEffect(e8)
--remove counter
local e13=Effect.CreateEffect(c)
e13:SetDescription(aux.Stringid(m,6))
e13:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e13:SetRange(LOCATION_MZONE)
e13:SetCode(EVENT_PHASE+PHASE_END)
e13:SetCountLimit(1)
e13:SetCondition(cm.rccon)
e13:SetOperation(cm.rcop)
c:RegisterEffect(e13)
--Add counter
local e16=Effect.CreateEffect(c)
e16:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e16:SetCode(EVENT_CHAIN_SOLVING)
e16:SetProperty(EFFECT_FLAG_DELAY)
e16:SetRange(LOCATION_MZONE)
e16:SetOperation(cm.op0)
c:RegisterEffect(e16)
end
function cm.counterfilter(c)
return not c:IsSummonLocation(LOCATION_EXTRA)
end
function cm.spcfilter(c)
return c:IsType(TYPE_FIELD) and not c:IsPublic()
end
function cm.spcon0(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spcfilter,tp,LOCATION_HAND,0,1,nil)
end
function cm.spop0(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g=Duel.SelectMatchingCard(tp,cm.spcfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
end
function cm.addcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(m,tp,ACTIVITY_SPSUMMON)==0 and Duel.IsCanRemoveCounter(tp,1,0,0x1,3,REASON_COST) end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(cm.splimit)
Duel.RegisterEffect(e1,tp)
Duel.RemoveCounter(tp,1,0,0x1,3,REASON_COST)
end
function cm.splimit(e,c)
return c:IsSummonLocation(LOCATION_EXTRA)
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SOUND,0,aux.Stringid(m,4))
Duel.SelectOption(tp,aux.Stringid(m,0))
Duel.SelectOption(1-tp,aux.Stringid(m,0))
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
c:RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,1))
Duel.Hint(HINT_CARD,tp,30610016)
Duel.Hint(HINT_CARD,1-tp,30610016)
end
function cm.flcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(m,tp,ACTIVITY_SPSUMMON)==0 and Duel.IsCanRemoveCounter(tp,1,0,0x1,5,REASON_COST) end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(cm.splimit)
Duel.RegisterEffect(e1,tp)
Duel.RemoveCounter(tp,1,0,0x1,5,REASON_COST)
end
function cm.flcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(m)~=0
end
function cm.flfilter(c,tp)
return c:IsCode(30610020) and c:GetActivateEffect():IsActivatable(tp,true,true)
end
function cm.fltg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.flfilter,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,nil,tp) end
if not Duel.CheckPhaseActivity() then e:SetLabel(1) else e:SetLabel(0) end
end
function cm.flop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,0))
if e:GetLabel()==1 then Duel.RegisterFlagEffect(tp,m-1,RESET_CHAIN,0,1) end
local tc=Duel.SelectMatchingCard(tp,cm.flfilter,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,tp):GetFirst()
Duel.ResetFlagEffect(tp,m-1)
if tc then
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
local te=tc:GetActivateEffect()
te:UseCountLimit(tp,1,true)
local tep=tc:GetControler()
local cost=te:GetCost()
if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end
Duel.RaiseEvent(tc,4179255,te,0,tp,tp,Duel.GetCurrentChain())
end
Duel.BreakEffect()
Duel.Hint(HINT_SOUND,0,aux.Stringid(m,5))
Duel.Hint(HINT_CARD,tp,30610016)
Duel.Hint(HINT_CARD,1-tp,30610016)
Duel.Hint(HINT_CARD,tp,30610017)
Duel.Hint(HINT_CARD,1-tp,30610017)
Duel.Hint(HINT_CARD,tp,30610018)
Duel.Hint(HINT_CARD,1-tp,30610018)
Duel.Hint(HINT_CARD,tp,30610019)
Duel.Hint(HINT_CARD,1-tp,30610019)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
Duel.ChangePosition(g,POS_FACEUP_DEFENSE,true)
Duel.BreakEffect()
local tg1=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
local tcc=tg1:GetFirst()
while tcc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_DEFENSE)
e1:SetValue(1500)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tcc:RegisterEffect(e1)
tcc=tg1:GetNext()
end
Duel.BreakEffect()
local tg2=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=tg2:GetFirst()
while tc do
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_ATTACK_FINAL)
e2:SetValue(0)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
tc=tg2:GetNext()
end
end
function cm.atkfilter(c)
return c:IsFaceup() and c:IsCode(30610020)
end
function cm.atkcon(e)
local c=e:GetHandler()
return Duel.IsExistingMatchingCard(cm.atkfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
function cm.efilter(e,te)
return te:GetOwner()~=e:GetOwner()
end
function cm.discon(e)
local c=e:GetHandler()
return Duel.IsExistingMatchingCard(cm.atkfilter,tp,LOCATION_ONFIELD,0,1,nil)
end
function cm.disable(e,c)
return c:IsType(TYPE_EFFECT) and c~=e:GetHandler()
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.rccon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function cm.rcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
if c:IsCanRemoveCounter(tp,0x1,6,REASON_EFFECT) then
c:RemoveCounter(tp,0x1,6,REASON_EFFECT)
else
Duel.SendtoDeck(c,nil,SEQ_DECKBOTTOM,REASON_RULE)
end
end
end
function cm.op0(e,tp,eg,ep,ev,re,r,rp)
local c=re:GetHandler()
if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and c~=e:GetHandler() and rp==tp then
e:GetHandler():AddCounter(0x1,2)
end
end
--苏美尔的冥界
local m=30610020
local cm=_G["c"..m]
function cm.initial_effect(c)
c:EnableCounterPermit(0x1)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--race
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE+LOCATION_GRAVE)
e2:SetCode(EFFECT_CHANGE_RACE)
e2:SetCondition(cm.condition)
e2:SetValue(RACE_FIEND)
c:RegisterEffect(e2)
--remove counter
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetCountLimit(1)
e3:SetCondition(cm.rccon)
e3:SetOperation(cm.rcop)
c:RegisterEffect(e3)
--
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_CHANGE_GRAVE_RACE)
e5:SetRange(LOCATION_FZONE)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1,1)
e5:SetCondition(cm.condition)
e5:SetValue(RACE_FIEND)
c:RegisterEffect(e5)
--Add counter
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e6:SetCode(EVENT_CHAIN_SOLVING)
e6:SetProperty(EFFECT_FLAG_DELAY)
e6:SetRange(LOCATION_FZONE)
e6:SetOperation(cm.op)
c:RegisterEffect(e6)
end
function cm.condition(e)
local tp=e:GetHandlerPlayer()
return not Duel.IsPlayerAffectedByEffect(tp,EFFECT_NECRO_VALLEY)
and not Duel.IsPlayerAffectedByEffect(1-tp,EFFECT_NECRO_VALLEY)
end
function cm.rccon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function cm.rcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
if c:IsCanRemoveCounter(tp,0x1,10,REASON_EFFECT) then
c:RemoveCounter(tp,0x1,10,REASON_EFFECT)
else
Duel.Destroy(c,REASON_EFFECT)
end
end
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=re:GetHandler()
if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and c~=e:GetHandler() and rp==tp then
e:GetHandler():AddCounter(0x1,3)
end
end
--
function c64000000.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--summon with no tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(64000000,0))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetCondition(c64000000.ntcon)
c:RegisterEffect(e2)
local e7=e2:Clone()
e7:SetCode(EFFECT_SET_PROC)
c:RegisterEffect(e7)
--change atk
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SUMMON_COST)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetOperation(c64000000.atkop)
c:RegisterEffect(e3)
--summon in hand
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_HAND)
e4:SetCountLimit(1,64000000)
e4:SetCondition(c64000000.smcon)
e4:SetOperation(c64000000.smop)
c:RegisterEffect(e4)
--search
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_SUMMON_SUCCESS)
e5:SetCountLimit(1,64000007)
e5:SetTarget(c64000000.thtg)
e5:SetOperation(c64000000.thop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_FLIP)
c:RegisterEffect(e6)
end
function c64000000.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c64000000.atkcon(e)
return e:GetHandler():GetMaterialCount()==0
end
function c64000000.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c64000000.atkcon)
e1:SetValue(-600)
e1:SetReset(RESET_EVENT+0xff0000)
c:RegisterEffect(e1)
end
function c64000000.smfilter(c)
return c:GetOriginalRace()==RACE_INSECT
end
function c64000000.smcon(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or Duel.IsExistingMatchingCard(c64000000.smfilter,tp,LOCATION_MZONE,0,1,nil))
end
function c64000000.smtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,c,1,0,0)
end
function c64000000.smop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler()
if tc then
if tc:IsSummonable(true,nil) and (not tc:IsMSetable(true,nil)
or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,true,nil)
else Duel.MSet(tp,tc,true,nil)
end
end
end
function c64000000.thfilter(c)
return c:IsCode(64000001) and c:IsAbleToHand()
end
function c64000000.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000000.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c64000000.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c64000000.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
\ No newline at end of file
--混蛾虫 沙丽雅
function c64000001.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--summon with no tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(64000001,0))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetCondition(c64000001.ntcon)
c:RegisterEffect(e2)
local e7=e2:Clone()
e7:SetCode(EFFECT_SET_PROC)
c:RegisterEffect(e7)
--change atk
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SUMMON_COST)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetOperation(c64000001.atkop)
c:RegisterEffect(e3)
--summon in hand
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_HAND)
e4:SetCountLimit(1,64000001)
e4:SetCondition(c64000001.smcon)
e4:SetOperation(c64000001.smop)
c:RegisterEffect(e4)
--search
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_SUMMON_SUCCESS)
e5:SetCountLimit(1,64000008)
e5:SetTarget(c64000001.thtg)
e5:SetOperation(c64000001.thop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_FLIP)
c:RegisterEffect(e6)
end
function c64000001.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c64000001.atkcon(e)
return e:GetHandler():GetMaterialCount()==0
end
function c64000001.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c64000001.atkcon)
e1:SetValue(-600)
e1:SetReset(RESET_EVENT+0xff0000)
c:RegisterEffect(e1)
end
function c64000001.smfilter(c)
return c:GetOriginalRace()==RACE_INSECT
end
function c64000001.smcon(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or Duel.IsExistingMatchingCard(c64000001.smfilter,tp,LOCATION_MZONE,0,1,nil))
end
function c64000001.smtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,c,1,0,0)
end
function c64000001.smop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler()
if tc then
if tc:IsSummonable(true,nil) and (not tc:IsMSetable(true,nil)
or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,true,nil)
else Duel.MSet(tp,tc,true,nil)
end
end
end
function c64000001.thfilter(c)
return c:IsCode(64000000) and c:IsAbleToHand()
end
function c64000001.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000001.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c64000001.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c64000001.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
\ No newline at end of file
--巨虫的伏击
function c64000002.initial_effect(c)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,64000002+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c64000002.thtg)
e1:SetOperation(c64000002.thop)
c:RegisterEffect(e1)
--to deck
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetHintTiming(0,TIMING_BATTLE_START+TIMING_END_PHASE)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(c64000002.tdcon)
e2:SetCost(aux.bfgcost)
e2:SetCountLimit(1,64000002)
e2:SetTarget(c64000002.tdtg)
e2:SetOperation(c64000002.tdop)
c:RegisterEffect(e2)
end
function c64000002.thfilter(c)
return c:IsLevelAbove(5) and c:IsRace(RACE_INSECT) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c64000002.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000002.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c64000002.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c64000002.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c64000002.tdfilter(c)
return c:GetOriginalRace()==RACE_INSECT and c:IsLevelAbove(5)
end
function c64000002.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c64000002.tdfilter,tp,LOCATION_MZONE,0,1,nil)and Duel.GetTurnCount()~=e:GetHandler():GetTurnID()
end
function c64000002.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(1-tp) and chkc:IsAbleToDeck() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c64000002.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.DisableShuffleCheck()
Duel.SendtoDeck(tc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)
end
end
\ No newline at end of file
--迷夜璃幻蛛
function c64000003.initial_effect(c)
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,64000003+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c64000003.hspcon)
e1:SetOperation(c64000003.hspop)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetValue(c64000003.efilter)
c:RegisterEffect(e2)
--negative
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DISABLE)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCost(c64000003.cost)
e3:SetCountLimit(1,64000010)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetOperation(c64000003.ngop)
c:RegisterEffect(e3)
end
function c64000003.hspfilter(c,tp,sc)
return c:IsLevelAbove(5) and c:GetOriginalRace()==RACE_INSECT and c:IsControler(tp) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0 and not c:IsCode(64000003)
end
function c64000003.hspcon(e,c)
if c==nil then return true end
return Duel.CheckReleaseGroup(c:GetControler(),c64000003.hspfilter,1,nil,c:GetControler(),c)
end
function c64000003.hspop(e,tp,eg,ep,ev,re,r,rp,c)
local sug=Duel.SelectReleaseGroup(tp,c64000003.hspfilter,1,1,nil,tp,c)
c:SetMaterial(sug)
Duel.Release(sug,REASON_COST)
end
function c64000003.efilter(e,te)
if te:GetOwner()==e:GetOwner() then return false end
if not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local mc=tg:GetCount()
if mc~=1 then return true end
return not tg or not tg:IsContains(e:GetHandler())
end
function c64000003.filter1(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) or (c:IsType(TYPE_MONSTER) and c:IsReleasable())
end
function c64000003.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000003.filter1,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,e:GetHandler()) end
local fg=Duel.GetMatchingGroup(c64000003.filter1,tp,LOCATION_ONFIELD+LOCATION_HAND,0,e:GetHandler())
if fg:GetCount()==0 then return end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local og=fg:Select(tp,1,1,nil)
Duel.HintSelection(og)
local nc=og:GetFirst()
Duel.Release(nc,REASON_COST)
end
function c64000003.ngop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if g:GetCount()==0 then return end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local sg=g:Select(tp,1,1,nil)
Duel.HintSelection(sg)
local tc=sg:GetFirst()
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
tc:RegisterEffect(e2)
end
\ No newline at end of file
--灾临祸毒虫
function c64000004.initial_effect(c)
aux.AddFusionProcFunFun(c,c64000004.fusion,c64000004.fusion1,1)
c:EnableReviveLimit()
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64000004,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,64000004+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c64000004.hspcon)
e1:SetOperation(c64000004.hspop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(64000004,0))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetRange(LOCATION_EXTRA)
e2:SetCountLimit(1,64000004+EFFECT_COUNT_CODE_OATH)
e2:SetCondition(c64000004.hspcon1)
e2:SetOperation(c64000004.hspop1)
c:RegisterEffect(e2)
--immune
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetValue(c64000004.efilter)
c:RegisterEffect(e3)
--remove
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_REMOVE+CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,64000011)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetCondition(c64000004.rmcon)
e3:SetTarget(c64000004.rmtg)
e3:SetOperation(c64000004.rmop)
c:RegisterEffect(e3)
end
function c64000004.fusion(c)
return c:GetOriginalRace()==RACE_INSECT and c:IsLevelAbove(5) and c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL)
end
function c64000004.fusion1(c)
return c:GetOriginalRace()==RACE_INSECT and c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL)
end
function c64000004.hspfilter(c,tp,sc)
return c:GetOriginalRace()==RACE_INSECT and c:IsLevelAbove(5) and c:IsType(TYPE_MONSTER) and c:IsLevelAbove(5)
and c:IsControler(tp) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0
end
function c64000004.hspfilter1(c,tp,sc)
return c:GetOriginalRace()==RACE_INSECT and c:IsType(TYPE_MONSTER) and c:IsControler(tp) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0
end
function c64000004.hspfilter2(c,tp,sc)
return c:IsType(TYPE_MONSTER)
end
function c64000004.hspcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local fu=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_ONFIELD,0,1,nil,tp,c)
local fu1=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_GRAVE,0,1,nil,tp,c)
return fu:IsExists(c64000004.hspfilter,1,nil,tp,g,c) and fu1:IsExists(c64000004.hspfilter1,1,nil,tp,g,c)
end
function c64000004.hspop(e,tp,eg,ep,ev,re,r,rp,c)
local fu=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_ONFIELD,0,1,nil,tp,c)
local fu1=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_GRAVE,0,1,nil,tp,c)
local eu=fu:FilterSelect(tp,c64000004.hspfilter,1,1,nil,tp,c)
local du=eu:GetFirst()
local eu1=fu1:FilterSelect(tp,c64000004.hspfilter1,1,1,nil,tp,c)
local du1=eu1:GetFirst()
if du:IsPosition(POS_FACEDOWN) then
Duel.ConfirmCards(1-tp,du) end
eu:Merge(eu1)
Duel.SendtoDeck(eu,nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function c64000004.hspcon1(e,c)
if c==nil then return true end
local tp=c:GetControler()
local fu2=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_ONFIELD,0,1,nil,tp,c)
local fu3=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_GRAVE,0,1,nil,tp,c)
return fu3:IsExists(c64000004.hspfilter,1,nil,tp,g,c) and fu2:IsExists(c64000004.hspfilter1,1,nil,tp,g,c)
end
function c64000004.hspop1(e,tp,eg,ep,ev,re,r,rp,c)
local fu2=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_ONFIELD,0,1,nil,tp,c)
local fu3=Duel.GetMatchingGroup(c64000004.hspfilter2,tp,LOCATION_GRAVE,0,1,nil,tp,c)
local eu2=fu2:FilterSelect(tp,c64000004.hspfilter1,1,1,nil,tp,c)
local du2=eu2:GetFirst()
local eu3=fu3:FilterSelect(tp,c64000004.hspfilter,1,1,nil,tp,c)
local du3=eu3:GetFirst()
if du2:IsPosition(POS_FACEDOWN) then
Duel.ConfirmCards(1-tp,du2) end
eu2:Merge(eu3)
Duel.SendtoDeck(eu2,nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function c64000004.efilter(e,te)
if te:GetOwner()==e:GetOwner() then return false end
if not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local mc=tg:GetCount()
if mc~=1 then return true end
return not tg or not tg:IsContains(e:GetHandler())
end
function c64000004.rmcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,64000004)==0
end
function c64000004.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,2)
end
function c64000004.rmfilter(c,e,tp)
return c:IsRace(RACE_INSECT)
end
function c64000004.rmfilter1(c,e,tp)
return c:IsAbleToRemove()
end
function c64000004.rmop(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmDecktop(tp,5)
local g=Duel.GetDecktopGroup(tp,5)
local ct=g:FilterCount(c64000004.rmfilter,nil,e,tp)
local ct1=g:GetCount()
if ct>0
and Duel.SelectYesNo(tp,aux.Stringid(64000004,2)) then
Duel.DisableShuffleCheck()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rmg=Duel.SelectTarget(tp,c64000004.rmfilter1,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,e:GetHandler(),tp)
Duel.Remove(rmg,POS_FACEDOWN,REASON_EFFECT)
end
if ct1>0 then
Duel.SortDecktop(tp,tp,ct1)
for i=1,ct do
local mg=Duel.GetDecktopGroup(tp,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKTOP)
end
end
Duel.Draw(tp,1,REASON_EFFECT)
Duel.RegisterFlagEffect(tp,64000004,RESET_PHASE+PHASE_END,0,2)
end
\ No newline at end of file
--天魔幽女
function c64000005.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64000005,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetRange(LOCATION_MZONE+LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCountLimit(1,64000005)
e1:SetCost(c64000005.cost)
e1:SetTarget(c64000005.target)
e1:SetOperation(c64000005.operation)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetDescription(aux.Stringid(64000005,1))
e2:SetCode(EVENT_RETURN_TO_GRAVE)
e2:SetCondition(c64000005.condition)
c:RegisterEffect(e2)
end
function c64000005.filter(c)
return c:IsPreviousLocation(LOCATION_REMOVED)
end
function c64000005.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c64000005.filter,1,nil)
end
function c64000005.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c64000005.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end
local ct=3
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
end
function c64000005.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()>0 then
Duel.Remove(tg,nil,nil,REASON_EFFECT)
end
end
--再诞的圣灵
function c64000006.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,nil,2,2,c64000006.lcheck)
c:EnableReviveLimit()
--extra material
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(64000006,0))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(c64000006.linkcon)
e2:SetOperation(c64000006.linkop)
e2:SetValue(SUMMON_TYPE_LINK)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_EXTRA,0)
e3:SetTarget(c64000006.mattg)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetCountLimit(1,64000006)
e4:SetRange(LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetTarget(c64000006.sptg)
e4:SetOperation(c64000006.spop)
c:RegisterEffect(e4)
--link summon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(64000006,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END+EFFECT_FLAG_DAMAGE_STEP)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1,64000012)
e5:SetCondition(c64000006.lkcon)
e5:SetTarget(c64000006.lktg)
e5:SetOperation(c64000006.lkop)
c:RegisterEffect(e5)
--apply the effect
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(64000006,2))
e6:SetCategory(CATEGORY_REMOVE)
e6:SetType(EFFECT_TYPE_QUICK_O)
e6:SetCode(EVENT_FREE_CHAIN)
e6:SetRange(LOCATION_MZONE)
e6:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE+EFFECT_FLAG_DAMAGE_STEP)
e6:SetCountLimit(1,64000013)
e6:SetCondition(c64000006.effcon)
e6:SetTarget(c64000006.efftg)
e6:SetOperation(c64000006.effop)
c:RegisterEffect(e6)
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetCode(EFFECT_MATERIAL_CHECK)
e7:SetValue(c64000006.valcheck)
e7:SetLabelObject(e6)
c:RegisterEffect(e7)
end
function c64000006.lcheck(g,lc)
return g:IsExists(Card.IsLinkType,1,nil,TYPE_DUAL)
end
function c64000006.lmfilter(c,lc,tp,og,lmat)
return c:IsFaceup() and c:IsCanBeLinkMaterial(lc) and c:IsLinkCode(lc:GetCode()) and c:IsLinkType(TYPE_LINK)
and Duel.GetLocationCountFromEx(tp,tp,c,lc)>0 and aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_LMATERIAL)
and (not og or og:IsContains(c)) and (not lmat or lmat==c)
end
function c64000006.linkcon(e,c,og,lmat,min,max)
if c==nil then return true end
local tp=c:GetControler()
return Duel.IsExistingMatchingCard(c64000006.lmfilter,tp,LOCATION_MZONE,0,1,nil,c,tp,og,lmat)
end
function c64000006.linkop(e,tp,eg,ep,ev,re,r,rp,c,og,lmat,min,max)
local mg=Duel.SelectMatchingCard(tp,c64000006.lmfilter,tp,LOCATION_MZONE,0,1,1,nil,c,tp,og,lmat)
c:SetMaterial(mg)
Duel.SendtoGrave(mg,REASON_MATERIAL+REASON_LINK)
end
function c64000006.mattg(e,c)
return c:IsCode(64000006)
end
function c64000006.spfilter(c,e,sp)
return c:IsType(TYPE_DUAL) and c:IsCanBeSpecialSummoned(e,0,sp,false,false)
end
function c64000006.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c64000006.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingTarget(c64000006.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c64000006.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c64000006.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
tc:EnableDualState()
end
Duel.SpecialSummonComplete()
end
function c64000006.lkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2 or (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function c64000006.lktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsLinkSummonable,tp,LOCATION_EXTRA,0,1,nil,nil,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c64000006.lkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsControler(1-tp) or not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local g=Duel.GetMatchingGroup(Card.IsLinkSummonable,tp,LOCATION_EXTRA,0,nil,nil,c)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.LinkSummon(tp,sg:GetFirst(),nil,c)
end
end
function c64000006.valcheck(e,c)
local vg=c:GetMaterial()
if vg:IsExists(Card.IsLinkCode,1,nil,64000006) then
e:GetLabelObject():SetLabel(1)
else
e:GetLabelObject():SetLabel(0)
end
end
function c64000006.effcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) and e:GetLabel()==1
end
function c64000006.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_ONFIELD)
end
function c64000006.effop(e,tp,eg,ep,ev,re,r,rp)
local rmg=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.Remove(rmg,POS_FACEDOWN,REASON_EFFECT)
end
\ No newline at end of file
--幻星彩河之魔女
function c64000007.initial_effect(c)
aux.AddLinkProcedure(c,nil,2,3,c64000007.lcheck)
c:EnableReviveLimit()
--immune
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_ONFIELD)
e1:SetCondition(c64000007.efcon)
e1:SetValue(c64000007.efilter)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_ONFIELD,0)
e2:SetTarget(c64000007.eftg)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
--P Summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(64000007,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetCountLimit(1,64000013)
e3:SetCondition(c64000007.pcon)
e3:SetTarget(c64000007.ptg)
e3:SetOperation(c64000007.pop)
c:RegisterEffect(e3)
local e5=e3:Clone()
e5:SetCondition(c64000007.pcon1)
e5:SetOperation(c64000007.pop1)
c:RegisterEffect(e5)
local e6=e3:Clone()
e6:SetCondition(c64000007.pcon2)
e6:SetOperation(c64000007.pop2)
c:RegisterEffect(e6)
--change effect
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(64000007,1))
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_CHAINING)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1,64000014)
e4:SetCondition(c64000007.chcon)
e4:SetTarget(c64000007.chtg)
e4:SetOperation(c64000007.chop)
c:RegisterEffect(e4)
end
function c64000007.efcon(e)
return e:GetHandler():GetSequence()<=7
end
function c64000007.lcheck(g)
return g:IsExists(Card.IsLinkType,1,nil,TYPE_PENDULUM)
end
function c64000007.eftg(e,c)
return (c:IsType(TYPE_PENDULUM) and c:IsLocation(LOCATION_PZONE)) or e:GetHandler():GetLinkedGroup():IsContains(c)
end
function c64000007.efilter(e,te)
if te:GetHandlerPlayer()==e:GetHandlerPlayer() then return false end
if not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local mc=tg:GetCount()
if mc~=1 then return true end
return not tg or not tg:IsContains(e:GetHandler())
end
function c64000007.pcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLocationCount(tp,LOCATION_PZONE)==0 and Duel.GetFlagEffect(tp,64000007)==0 and e:GetHandler():GetSequence()>4
end
function c64000007.pcon1(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetLocationCount(tp,LOCATION_MZONE)
local b=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
if not b then return false end
if a+b~=5 then return false end
return Duel.GetLocationCount(tp,LOCATION_PZONE)==0 and Duel.GetFlagEffect(tp,64000007)==0
end
function c64000007.pcon2(e,tp,eg,ep,ev,re,r,rp)
local a1=Duel.GetLocationCount(tp,LOCATION_MZONE)
local b1=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
if not b1 then return false end
if a1+b1<=5 then return false end
return Duel.GetLocationCount(tp,LOCATION_PZONE)==0 and Duel.GetFlagEffect(tp,64000007)==0 and e:GetHandler():GetSequence()<=4
end
function c64000007.pfilter(c,e,tp)
local tc1=Duel.GetFieldCard(tp,LOCATION_PZONE,0)
local tc2=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
if not tc1 or not tc2 then return false end
local scl1=tc1:GetLeftScale()
local scl2=tc2:GetRightScale()
if scl1>scl2 then scl1,scl2=scl2,scl1 end
local scl1=scl1+1
local scl2=scl2-1
return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsType(TYPE_MONSTER)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,false,false,POS_FACEUP) and c:IsLevelAbove(scl1) and c:IsLevelBelow(scl2)
and (c:IsLocation(LOCATION_HAND) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
or c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0)
end
function c64000007.ptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000007.pfilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_EXTRA)
end
function c64000007.pop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local fff=0
local num=Duel.GetLocationCountFromEx(tp,tp,nil,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c64000007.pfilter,tp,LOCATION_EXTRA,0,fff,num,nil,e,tp)
if g:GetCount()==0 then local fff=1 end
local num1=Duel.GetLocationCount(tp,LOCATION_MZONE)
local num1=num1-num
local g1=Duel.SelectMatchingCard(tp,c64000007.pfilter,tp,LOCATION_HAND,0,fff,num1,nil,e,tp)
Duel.SpecialSummon(g+g1,SUMMON_TYPE_PENDULUM,tp,tp,false,false,POS_FACEUP)
if c:IsRelateToEffect(e) then
Duel.RegisterFlagEffect(tp,64000007,RESET_PHASE+PHASE_END,0,2)
end
end
function c64000007.pop1(e,tp,eg,ep,ev,re,r,rp)
local fc=e:GetHandler()
local eee=0
local num2=Duel.GetLocationCountFromEx(tp,tp,nil,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g2=Duel.SelectMatchingCard(tp,c64000007.pfilter,tp,LOCATION_EXTRA,0,eee,num2,nil,e,tp)
if g2:GetCount()==0 then local eee=1 end
local num3=Duel.GetLocationCount(tp,LOCATION_MZONE)
local num3=num3-num2+1
local g3=Duel.SelectMatchingCard(tp,c64000007.pfilter,tp,LOCATION_HAND,0,eee,num3,nil,e,tp)
Duel.SpecialSummon(g2+g3,SUMMON_TYPE_PENDULUM,tp,tp,false,false,POS_FACEUP)
if fc:IsRelateToEffect(e) then
Duel.RegisterFlagEffect(tp,64000007,RESET_PHASE+PHASE_END,0,2)
end
end
function c64000007.pop2(e,tp,eg,ep,ev,re,r,rp)
local fc1=e:GetHandler()
local ddd=0
local num4=Duel.GetLocationCountFromEx(tp,tp,nil,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g4=Duel.SelectMatchingCard(tp,c64000007.pfilter,tp,LOCATION_EXTRA,0,ddd,num4,nil,e,tp)
if g4:GetCount()==0 then local ddd=1 end
local num5=Duel.GetLocationCount(tp,LOCATION_MZONE)
local num5=num5-num4
local g5=Duel.SelectMatchingCard(tp,c64000007.pfilter,tp,LOCATION_HAND,0,ddd,num5,nil,e,tp)
Duel.SpecialSummon(g4+g5,SUMMON_TYPE_PENDULUM,tp,tp,false,false,POS_FACEUP)
if fc1:IsRelateToEffect(e) then
Duel.RegisterFlagEffect(tp,64000007,RESET_PHASE+PHASE_END,0,2)
end
end
function c64000007.chcon(e,tp,eg,ep,ev,re,r,rp)
return ep==1-tp
end
function c64000007.chfilter(c,e,tp)
return c:IsFaceup() and c:IsType(TYPE_PENDULUM)
end
function c64000007.chtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000007.chfilter,tp,LOCATION_EXTRA,0,1,nil,REASON_EFFECT) end
end
function c64000007.chop(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup()
Duel.ChangeTargetCard(ev,g)
Duel.ChangeChainOperation(ev,c64000007.repop)
end
function c64000007.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_DESTROY)
local des=Duel.SelectMatchingCard(1-tp,c64000007.chfilter,1-tp,LOCATION_EXTRA,0,1,1,nil)
if des then
Duel.Destroy(des,REASON_EFFECT) end
end
\ No newline at end of file
--黎乡微熏的少女
function c64000008.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,64000008+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c64000008.spcon)
e1:SetOperation(c64000008.spop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_RECOVER)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTarget(c64000008.rectg)
e2:SetOperation(c64000008.recop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
function c64000008.filter(c)
return c:IsFaceup() and c:IsType(TYPE_PENDULUM)
end
function c64000008.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c64000008.filter,tp,LOCATION_EXTRA,0,1,nil)
end
function c64000008.spop(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,c64000008.filter,tp,LOCATION_EXTRA,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c64000008.rectg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,500)
end
function c64000008.recop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
Duel.Recover(p,500,REASON_EFFECT)
end
\ No newline at end of file
--攝蜃喵
--Lua--星空璀璨之地
local m=64000009
local cm=_G["c"..m]
function cm.initial_effect(c)
--原本攻击力·守备力
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(cm.atkval)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
c:RegisterEffect(e2)
--战效抗性,多次攻击
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
e3:SetValue(cm.valcon)
e3:SetCountLimit(cm.atkval2)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_EXTRA_ATTACK)
e4:SetValue(cm.atkval3)
c:RegisterEffect(e4)
--战伤减半
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE)
e5:SetValue(aux.ChangeBattleDamage(1,HALF_DAMAGE))
c:RegisterEffect(e5)
--summon with no tribute
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_SPSUMMON_COST)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCost(cm.cost)
e0:SetOperation(cm.sumsuc)
c:RegisterEffect(e0)
local e7=e0:Clone()
e7:SetCode(EFFECT_SUMMON_COST)
c:RegisterEffect(e7)
if not cm.global_check then
cm.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SUMMON_SUCCESS)
ge1:SetOperation(cm.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=ge1:Clone()
ge2:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(ge2,0)
end
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
while tc do
Duel.RegisterFlagEffect(tc:GetSummonPlayer(),m,RESET_PHASE+PHASE_END,0,1)
tc=eg:GetNext()
end
end
function cm.atkval(e,c)
local c=e:GetHandler()
local cc1=Duel.GetTurnCount(c:GetControler())
local cc2=Duel.GetTurnCount(1-c:GetControler())
return (cc1+cc2)*1000
end
function cm.atkval2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct1=Duel.GetTurnCount(c:GetControler())
local ct2=Duel.GetTurnCount(1-c:GetControler())
local ctt=ct1+ct2
return ctt
end
function cm.atkval3(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ctt1=Duel.GetTurnCount(c:GetControler())
local ctt2=Duel.GetTurnCount(1-c:GetControler())
local ctta=ctt1+ctt2-1
return ctta
end
function cm.valcon(e,re,r,rp)
return bit.band(r,REASON_BATTLE+REASON_EFFECT)~=0
end
function cm.cost(e,c,tp)
local c=e:GetHandler()
local ctw1=Duel.GetTurnCount(c:GetControler())
local ctw2=Duel.GetTurnCount(1-c:GetControler())
local ctwt=ctw1+ctw2
return Duel.GetFlagEffect(tp,m)<ctwt
end
function cm.sumsuc(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SET_SUMMON_COUNT_LIMIT)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetValue(cm.atkval2)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetTarget(cm.limittg)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
local e3=e2:Clone()
e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
Duel.RegisterEffect(e3,tp)
local e4=e2:Clone()
e4:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
Duel.RegisterEffect(e4,tp)
local e5=e2:Clone()
e5:SetCode(EFFECT_CANNOT_MSET)
Duel.RegisterEffect(e5,tp)
local e6=Effect.CreateEffect(e:GetHandler())
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_LEFT_SPSUMMON_COUNT)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(1,0)
e6:SetValue(cm.countval)
e6:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e6,tp)
end
function cm.limittg(e,c,tp)
local c=e:GetHandler()
local ct01=Duel.GetTurnCount(c:GetControler())
local ct02=Duel.GetTurnCount(1-c:GetControler())
local ct0t=ct01+ct02
local t1,t2,t3=Duel.GetActivityCount(tp,ACTIVITY_SUMMON,ACTIVITY_FLIPSUMMON,ACTIVITY_SPSUMMON)
return t1+t2+t3>=ct0t
end
function cm.countval(e,re,tp)
local c=e:GetHandler()
local ct011=Duel.GetTurnCount(c:GetControler())
local ct012=Duel.GetTurnCount(1-c:GetControler())
local ct01t=ct011+ct012
local t1,t2,t3=Duel.GetActivityCount(tp,ACTIVITY_SUMMON,ACTIVITY_FLIPSUMMON,ACTIVITY_SPSUMMON)
if t1+t2+t3>=ct01t then return 0 else return ct01t-t1-t2-t3 end
end
--虚空幻象女巫
--Lua--星空璀璨之地
local m=64000010
local cm=_G["c"..m]
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,nil,2,2,cm.lcheck)
c:EnableReviveLimit()
--coin
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_COIN+CATEGORY_DRAW+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1,64000015)
e1:SetTarget(cm.cointg1)
e1:SetOperation(cm.coinop1)
c:RegisterEffect(e1)
--Set
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,64000016)
e2:SetCondition(cm.condition)
e2:SetTarget(cm.target)
e2:SetOperation(cm.operation)
c:RegisterEffect(e2)
end
function cm.lcheck(g)
return g:IsExists(Card.IsLinkType,1,nil,TYPE_PENDULUM)
end
cm.toss_coin=true
function cm.filter(c,e)
return c:IsType(TYPE_PENDULUM)
end
function cm.cointg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=2 and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function cm.spfilter(c,e,tp)
return c:IsType(TYPE_PENDULUM) and (not c:IsForbidden() or (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
end
function cm.coinop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g2=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil)
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local res=Duel.TossCoin(tp,1)
if res==1 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
local ct=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
if ct==0 then return end
local ac=1
if ct>1 then
if ct>5 then ct=5 end
local t={}
for i=1,ct do t[i]=i end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,0))
ac=Duel.AnnounceNumber(tp,table.unpack(t))
end
local g1=Duel.GetDecktopGroup(tp,ac)
Duel.ConfirmCards(tp,g1)
local op=0
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
op=Duel.SelectOption(tp,aux.Stringid(m,1),aux.Stringid(m,2))
else
op=Duel.SelectOption(tp,aux.Stringid(m,1))
end
if op==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT)
local bg=g1:FilterSelect(tp,cm.spfilter,1,1,nil,e,tp)
local tc1=bg:GetFirst()
Duel.MoveToField(tc1,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT)
local tc=g1:FilterSelect(tp,cm.spfilter,1,1,nil,e,tp)
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
elseif Duel.SelectYesNo(tp,aux.Stringid(m,4)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local sg=g2:Select(tp,1,1,nil)
if sg:GetCount()>0 then
Duel.BreakEffect()
Duel.HintSelection(sg)
Duel.Destroy(sg,REASON_EFFECT)
Duel.Draw(tp,2,REASON_EFFECT)
end
end
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsPreviousLocation,1,nil,LOCATION_ONFIELD)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,nil,LOCATION_ONFIELD)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if g:GetCount()>0 then
local hg=Duel.GetFieldGroup(1-tp,LOCATION_DECK,0)
if Duel.IsChainDisablable(0) and hg:GetCount()>=5 and Duel.SelectYesNo(1-tp,aux.Stringid(m,3)) then
Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(m,5))
local dg=Duel.GetDecktopGroup(1-tp,5)
dg:FilterCount(Card.IsAbleToRemove,nil,1-tp,POS_FACEDOWN)
Duel.Remove(dg,POS_FACEDOWN,REASON_EFFECT)
Duel.NegateEffect(0)
return
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:Select(tp,1,1,nil)
Duel.HintSelection(sg)
Duel.Remove(sg,POS_FACEDOWN,REASON_EFFECT)
end
end
--炽焰咆哮虎
--Lua--星空璀璨之地
local m=64000011
local cm=_G["c"..m]
function cm.initial_effect(c)
--special summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e0:SetRange(LOCATION_HAND)
e0:SetCondition(cm.spcon)
c:RegisterEffect(e0)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.atktg)
e1:SetOperation(cm.atkop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EVENT_FLIP)
c:RegisterEffect(e3)
--negate
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,1))
e4:SetCategory(CATEGORY_NEGATE)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_CHAINING)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCondition(cm.discon)
e4:SetTarget(cm.distg)
e4:SetOperation(cm.disop)
c:RegisterEffect(e4)
end
function cm.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()==0 then return false end
local tg=g:GetMaxGroup(Card.GetAttack)
local g1=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
local g2=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
return g1:GetSum(Card.GetAttack)<g2:GetSum(Card.GetAttack) or
(Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and tg:IsExists(Card.IsControler,1,nil,1-tp))
end
function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.SetChainLimit(cm.chainlm)
end
function cm.chainlm(re,rp,tp)
return tp==rp or not re:GetHandler():IsType(TYPE_MONSTER)
end
function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tg=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=tg:GetFirst()
while tc do
local atk=tc:GetAttack()
local def=tc:GetDefense()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(math.ceil(atk/2))
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
tc=tg:GetNext()
end
end
function cm.discon(e,tp,eg,ep,ev,re,r,rp)
return ep==1-tp and re:GetActivateLocation()==LOCATION_MZONE and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainDisablable(ev)
end
function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SendtoHand(c,nil,REASON_EFFECT)~=0 and c:IsLocation(LOCATION_HAND) then
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
local tc=eg:GetFirst()
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SET_ATTACK_FINAL)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
e3:SetValue(tc:GetAttack()/2)
tc:RegisterEffect(e3)
end
end
end
\ No newline at end of file
--小章鱼 Tarako
function c64000012.initial_effect(c)
--summon in hand
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,64000017)
e1:SetCondition(c64000012.smcon)
e1:SetOperation(c64000012.smop)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_RELEASE)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCountLimit(1,64000018)
e2:SetTarget(c64000012.drtg)
e2:SetOperation(c64000012.drop)
c:RegisterEffect(e2)
--effect gain
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_BE_MATERIAL)
e3:SetProperty(EFFECT_FLAG_EVENT_PLAYER)
e3:SetCondition(c64000012.efcon)
e3:SetOperation(c64000012.efop)
c:RegisterEffect(e3)
end
function c64000012.smcfilter(c)
return c:IsLevelAbove(5) and not c:IsPublic() and c:IsType(TYPE_MONSTER)
end
function c64000012.smcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c64000012.smcfilter,tp,LOCATION_HAND,0,1,nil)
end
function c64000012.smop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g=Duel.SelectMatchingCard(tp,c64000012.smcfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.ConfirmCards(1-tp,g)
local tc=e:GetHandler()
if tc then
if tc:IsSummonable(true,nil) and (not tc:IsMSetable(true,nil)
or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,true,nil)
else Duel.MSet(tp,tc,true,nil)
end
end
end
function c64000012.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c64000012.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c64000012.efcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_SUMMON) and r==REASON_SUMMON
end
function c64000012.efop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rc=c:GetReasonCard()
local e1=Effect.CreateEffect(rc)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64000012,0))
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e1:SetValue(aux.tgoval)
e1:SetCondition(c64000012.indcon)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
rc:RegisterEffect(e1)
end
function c64000012.indcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_MZONE)
end
--寂夜的独鱼
function c64000013.initial_effect(c)
--cannot be material
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetTargetRange(LOCATION_MZONE+LOCATION_DECK+LOCATION_HAND,LOCATION_MZONE+LOCATION_DECK+LOCATION_HAND)
e1:SetValue(c64000013.sumlimit)
c:RegisterEffect(e1)
local e3=e1:Clone()
e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e3:SetValue(c64000013.fuslimit)
c:RegisterEffect(e3)
local e4=e1:Clone()
e4:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
c:RegisterEffect(e4)
local e5=e1:Clone()
e5:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
c:RegisterEffect(e5)
--cannot release
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_CANNOT_RELEASE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
c:RegisterEffect(e2)
end
function c64000013.sumlimit(e,c)
if not c then return false end
return true
end
function c64000013.fuslimit(e,c,sumtype)
if not c then return false end
return sumtype==SUMMON_TYPE_FUSION
end
\ No newline at end of file
--梦色抽奖喵
function c64000014.initial_effect(c)
aux.EnablePendulumAttribute(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,64000019)
e1:SetTarget(c64000014.thtg)
e1:SetOperation(c64000014.thop)
c:RegisterEffect(e1)
end
function c64000014.thfilter(c)
return c:IsType(TYPE_NORMAL) and c:IsType(TYPE_PENDULUM) and c:IsAbleToHand()
end
function c64000014.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local g=Duel.GetMatchingGroup(c64000014.thfilter,tp,LOCATION_DECK,0,nil)
return g:GetClassCount(Card.GetCode)>=3
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK)
end
function c64000014.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c64000014.thfilter,tp,LOCATION_DECK,0,nil)
if g:GetClassCount(Card.GetCode)>=3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=g:SelectSubGroup(tp,aux.dncheck,false,3,3)
Duel.ConfirmCards(1-tp,sg)
local tg=sg:RandomSelect(1-tp,1)
tg:GetFirst():SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true)
Duel.SendtoHand(tg,nil,REASON_EFFECT)
Duel.SendtoDeck(sg-tg,nil,nil,REASON_EFFECT)
end
end
\ No newline at end of file
--梦色抽奖喵
function c64000015.initial_effect(c)
aux.EnablePendulumAttribute(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64000015,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,64000020)
e1:SetTarget(c64000015.thtg)
e1:SetOperation(c64000015.thop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(64000015,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_PZONE)
e2:SetCountLimit(1,64000021)
e2:SetTarget(c64000015.sumtg)
e2:SetOperation(c64000015.sumop)
c:RegisterEffect(e2)
end
function c64000015.thfilter(c)
return c:IsType(TYPE_NORMAL) and c:IsType(TYPE_PENDULUM) and c:IsAbleToHand()
end
function c64000015.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000015.thfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA+LOCATION_GRAVE)
end
function c64000015.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c64000015.thfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c64000015.sumfilter(c)
return c:IsType(TYPE_NORMAL) and c:IsType(TYPE_PENDULUM) and c:IsSummonable(true,nil)
end
function c64000015.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000015.sumfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function c64000015.sumop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c64000015.sumfilter,tp,LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
end
\ No newline at end of file
--
function c64000016.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_FZONE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetValue(c64000016.efilter)
c:RegisterEffect(e2)
--cannot activate
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_FZONE)
e3:SetTargetRange(1,0)
e3:SetValue(c64000016.actlimit)
c:RegisterEffect(e3)
--cannot set
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_SSET)
e4:SetRange(LOCATION_FZONE)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,0)
e4:SetTarget(c64000016.setlimit)
c:RegisterEffect(e4)
--ntr
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_CONTROL)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_FZONE)
e5:SetProperty(EFFECT_FLAG_BOTH_SIDE)
e5:SetCountLimit(1)
e5:SetTarget(c64000016.cttg)
e5:SetOperation(c64000016.ctop)
c:RegisterEffect(e5)
end
function c64000016.actlimit(e,re,tp)
return re:IsActiveType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function c64000016.setlimit(e,c,tp)
return c:IsType(TYPE_FIELD)
end
function c64000016.efilter(e,te)
if te:GetOwner()==e:GetOwner() then return false end
if not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local mc=tg:GetCount()
if mc~=1 then return true end
return not tg or not tg:IsContains(e:GetHandler())
end
function c64000016.filter(c)
return c:IsFaceup() and c:IsControlerCanBeChanged()
end
function c64000016.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsControlerCanBeChanged() end
if chk==0 then return Duel.IsExistingTarget(c64000016.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g=Duel.SelectTarget(tp,c64000016.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
if e:IsHasType(EFFECT_TYPE_IGNITION) then
Duel.SetChainLimit(aux.FALSE)
end
end
function c64000016.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.GetControl(tc,tp,PHASE_END,1)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UNRELEASABLE_SUM)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,1)
tc:RegisterEffect(e1)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_UNRELEASABLE_NONSUM)
e6:SetValue(1)
e6:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,1)
tc:RegisterEffect(e6)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e2:SetValue(1)
e2:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,1)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e3:SetValue(1)
e3:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,1)
tc:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e4:SetValue(1)
e4:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,1)
tc:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
e5:SetValue(1)
e5:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_PHASE+PHASE_END,1)
tc:RegisterEffect(e5)
end
end
\ No newline at end of file
--墟梦塌落的轮舞
function c64000017.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_END_PHASE+TIMING_SSET)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e1:SetCountLimit(1,64000017+EFFECT_COUNT_CODE_OATH)
e1:SetCost(c64000017.cost)
e1:SetTarget(c64000017.target)
e1:SetOperation(c64000017.activate)
c:RegisterEffect(e1)
end
function c64000017.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) or (c:IsType(TYPE_MONSTER) and c:IsReleasable())
end
function c64000017.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetDecktopGroup(tp,5)
if chk==0 then return Duel.CheckLPCost(tp,2000) and Duel.IsExistingMatchingCard(c64000017.filter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,2,e:GetHandler()) and g:FilterCount(Card.IsAbleToRemoveAsCost,nil,POS_FACEDOWN)==5 end
local fg=Duel.GetMatchingGroup(c64000017.filter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,e:GetHandler())
if fg:GetCount()<2 then return end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local og=fg:Select(tp,2,2,nil)
Duel.HintSelection(og)
Duel.Release(og,REASON_COST)
Duel.PayLPCost(tp,2000)
Duel.DisableShuffleCheck()
Duel.Remove(g,POS_FACEDOWN,REASON_COST)
end
function c64000017.filter1(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c64000017.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64000017.filter1,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,1-tp,LOCATION_ONFIELD)
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
Duel.SetChainLimit(aux.FALSE) end
end
function c64000017.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,c64000017.filter1,tp,0,LOCATION_ONFIELD,1,3,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
end
\ No newline at end of file
--蛇 神 判 !
function c64000018.initial_effect(c)
--negate
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_CHAINING)
e2:SetCondition(c64000018.discon)
e2:SetCost(c64000018.cost)
e2:SetTarget(c64000018.distg)
e2:SetOperation(c64000018.disop)
c:RegisterEffect(e2)
--disable spsummon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_ACTIVATE)
e3:SetCode(EVENT_SUMMON)
e3:SetCondition(c64000018.dscon)
e3:SetCost(c64000018.cost)
e3:SetTarget(c64000018.dstg)
e3:SetOperation(c64000018.dsop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_FLIP_SUMMON)
c:RegisterEffect(e4)
local e5=e3:Clone()
e5:SetCode(EVENT_SPSUMMON)
c:RegisterEffect(e5)
--negate attack
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_ACTIVATE)
e6:SetCode(EVENT_ATTACK_ANNOUNCE)
e6:SetCondition(c64000018.negcon)
e6:SetCost(c64000018.cost)
e6:SetOperation(c64000018.negop)
c:RegisterEffect(e6)
end
function c64000018.discon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
end
function c64000018.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c64000018.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
function c64000018.filter(c)
return c:IsRace(RACE_REPTILE)
end
function c64000018.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroupEx(tp,c64000018.filter,1,nil)
end
local c=Duel.SelectReleaseGroupEx(tp,c64000018.filter,1,1,nil)
Duel.Release(c,REASON_COST)
end
function c64000018.dscon(e,tp,eg,ep,ev,re,r,rp)
return ep==1-tp and Duel.GetCurrentChain()==0
end
function c64000018.dstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,eg:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,eg:GetCount(),0,0)
end
function c64000018.dsop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateSummon(eg)
Duel.Destroy(eg,REASON_EFFECT)
end
function c64000018.negcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():IsControler(1-tp)
end
function c64000018.filter1(c)
return c:IsAttackPos()
end
function c64000018.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateAttack() then
Duel.BreakEffect()
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE_STEP,1)
end
local g=Duel.GetMatchingGroup(c64000018.filter1,tp,0,LOCATION_MZONE,nil)
if g:GetCount()>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
--蛇神宠幸的圣女
function c64000019.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c64000019.spcon)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,64000022)
e2:SetTarget(c64000019.target)
e2:SetOperation(c64000019.activate)
c:RegisterEffect(e2)
end
function c64000019.spfilter(c)
return c:IsFaceup() and c:IsRace(RACE_REPTILE)
end
function c64000019.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c64000019.spfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c64000019.filter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_VALUE_MONSTER_REBORN,tp,false,false) and c:IsRace(RACE_REPTILE)
end
function c64000019.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c64000019.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c64000019.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,e:GetHandler(),e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c64000019.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,c64000019.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,e:GetHandler(),e,tp)
Duel.SpecialSummon(g,SUMMON_VALUE_SELF,tp,tp,false,false,POS_FACEUP)
end
--雷切剑士 路易斯
function c64000020.initial_effect(c)
--summon in hand
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,64000023)
e1:SetCondition(c64000020.smcon)
e1:SetOperation(c64000020.smop)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_RELEASE)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCountLimit(1,64000024)
e2:SetTarget(c64000020.drtg)
e2:SetOperation(c64000020.drop)
c:RegisterEffect(e2)
--effect gain
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_BE_MATERIAL)
e3:SetProperty(EFFECT_FLAG_EVENT_PLAYER)
e3:SetCondition(c64000020.efcon)
e3:SetOperation(c64000020.efop)
c:RegisterEffect(e3)
end
function c64000020.smcfilter(c)
return c:IsLevelAbove(5) and not c:IsPublic() and c:IsType(TYPE_MONSTER) and c:IsSummonableCard()
end
function c64000020.smcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c64000020.smcfilter,tp,LOCATION_HAND,0,1,nil)
end
function c64000020.smop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g=Duel.SelectMatchingCard(tp,c64000020.smcfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.ConfirmCards(1-tp,g)
local tc=e:GetHandler()
if tc then
if tc:IsSummonable(true,nil) and (not tc:IsMSetable(true,nil)
or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,true,nil)
else Duel.MSet(tp,tc,true,nil)
end
end
end
function c64000020.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c64000020.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c64000020.efcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_SUMMON) and r==REASON_SUMMON
end
function c64000020.efop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rc=c:GetReasonCard()
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64000020,0))
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
e1:SetValue(1)
e1:SetCountLimit(2)
e1:SetCondition(c64000020.indcon)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
rc:RegisterEffect(e1)
end
function c64000020.indcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_MZONE)
end
\ No newline at end of file
--白蛇巫
function c64000021.initial_effect(c)
--atk change
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(64000021,1))
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetCondition(c64000021.con)
e3:SetCost(c64000021.atkcost)
e3:SetTarget(c64000021.atktg)
e3:SetOperation(c64000021.atkop)
c:RegisterEffect(e3)
local e2=e3:Clone()
e2:SetCode(EVENT_SUMMON_SUCCESS)
c:RegisterEffect(e2)
local e1=e3:Clone()
e1:SetCode(EVENT_FLIP)
c:RegisterEffect(e1)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_GRAVE)
e4:SetCondition(c64000021.con)
e4:SetCountLimit(1,64000025+EFFECT_COUNT_CODE_DUEL)
e4:SetCost(c64000021.cost)
e4:SetTarget(c64000021.tg)
e4:SetOperation(c64000021.op)
c:RegisterEffect(e4)
end
function c64000021.con(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,64000021)==0
end
function c64000021.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeckAsCost(tp,3) end
Duel.DiscardDeck(tp,3,REASON_COST)
end
function c64000021.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c64000021.op(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,64000021,RESET_PHASE+PHASE_END,0,1)
local c=e:GetHandler()
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
function c64000021.cfilter(c)
return c:IsRace(RACE_REPTILE) and c:IsAbleToGraveAsCost()
end
function c64000021.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
return true
end
function c64000021.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then
if e:GetLabel()~=1 then return false end
e:SetLabel(0)
return Duel.IsExistingMatchingCard(c64000021.cfilter,tp,LOCATION_DECK,0,1,nil)
end
e:SetLabel(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c64000021.cfilter,tp,LOCATION_DECK,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
e:SetLabelObject(g:GetFirst())
end
function c64000021.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local sc=e:GetLabelObject()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local atk=sc:GetAttack()
local def=sc:GetDefense()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_DEFENSE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
e1:SetValue(math.ceil(def/2))
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
e2:SetValue(math.ceil(atk/2))
c:RegisterEffect(e2)
end
Duel.RegisterFlagEffect(tp,64000021,RESET_PHASE+PHASE_END,0,1)
end
\ No newline at end of file
--幽海突戟皇
function c64000022.initial_effect(c)
c:EnableReviveLimit()
--immune
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(c64000022.efilter)
c:RegisterEffect(e1)
--ATTRIBUTE_WATER
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(ATTRIBUTE_WATER+ATTRIBUTE_WIND)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_SPSUMMON_PROC)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetRange(LOCATION_EXTRA+LOCATION_HAND)
e3:SetCondition(c64000022.spcon)
e3:SetOperation(c64000022.spop)
c:RegisterEffect(e3)
--battle indes
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
e4:SetCountLimit(1)
e4:SetValue(c64000022.valcon)
c:RegisterEffect(e4)
--Return to Hand
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_TOHAND)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetRange(LOCATION_MZONE)
e5:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e5:SetCountLimit(1)
e5:SetTarget(c64000022.thtg)
e5:SetOperation(c64000022.thop)
c:RegisterEffect(e5)
end
function c64000022.filter(c)
return c:IsAbleToHand()
end
function c64000022.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(c64000022.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,c64000022.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c64000022.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_DEFENSE)
e2:SetValue(500)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nill,REASON_EFFECT)
end
end
function c64000022.valcon(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
function c64000022.efilter(e,te)
if te:GetOwner()==e:GetOwner() then return false end
if not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local mc=tg:GetCount()
if mc~=1 then return true end
return not tg or not tg:IsContains(e:GetHandler())
end
function c64000022.spfilter(c,att)
return c:IsAttribute(att) and c:IsAbleToRemoveAsCost()
end
function c64000022.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return c:IsLocation(LOCATION_HAND) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c64000022.spfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_WATER)
and Duel.IsExistingMatchingCard(c64000022.spfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_WIND)
end
function c64000022.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=Duel.SelectMatchingCard(tp,c64000022.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_WIND)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=Duel.SelectMatchingCard(tp,c64000022.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_WATER)
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
end
\ No newline at end of file
--召引的雷灵
function c64000023.initial_effect(c)
--summon in hand
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,64000026)
e1:SetCondition(c64000023.smcon)
e1:SetOperation(c64000023.smop)
c:RegisterEffect(e1)
--roof
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,64000027)
e2:SetTarget(c64000023.target)
e2:SetOperation(c64000023.operation)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_FLIP)
c:RegisterEffect(e3)
local e4=e2:Clone()
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e4)
end
function c64000023.smfilter(c)
return c:GetOriginalRace()==RACE_THUNDER
end
function c64000023.smcon(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or Duel.IsExistingMatchingCard(c64000023.smfilter,tp,LOCATION_MZONE,0,1,nil))
end
function c64000023.smtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,c,1,0,0)
end
function c64000023.smop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler()
if tc then
if tc:IsSummonable(true,nil) and (not tc:IsMSetable(true,nil)
or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,true,nil)
else Duel.MSet(tp,tc,true,nil)
end
end
end
function c64000023.filter(c)
return c:IsRace(RACE_THUNDER) and c:IsAbleToHand()
end
function c64000023.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>4 end
end
function c64000023.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<5 then return end
local g=Duel.GetDecktopGroup(tp,5)
Duel.ConfirmCards(tp,g)
if g:IsExists(c64000023.filter,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(64000023,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:FilterSelect(tp,c64000023.filter,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
\ No newline at end of file
--血咒的魔女
function c64000050.initial_effect(c)
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_STANDBY_PHASE)
e1:SetRange(LOCATION_HAND+LOCATION_MZONE)
e1:SetCountLimit(1,64000050)
e1:SetCost(c64000050.xxcost)
e1:SetTarget(c64000050.xxtg)
e1:SetOperation(c64000050.xxop)
c:RegisterEffect(e1)
end
function c64000050.xxcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1500) and e:GetHandler():IsReleasable() end
Duel.PayLPCost(tp,1500)
Duel.Release(e:GetHandler(),REASON_COST)
end
function c64000050.xxtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function c64000050.xxop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCondition(c64000050.dacon)
e1:SetOperation(c64000050.daop)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(e2,tp)
end
function c64000050.dacfil(c,tp)
return c:IsSummonPlayer(1-tp)
end
function c64000050.dacon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c64000050.dacfil,1,nil,tp)
end
function c64000050.daop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=eg:Filter(c64000050.dacfil,nil,tp)
local atk=0
local tc=g:GetFirst()
while tc do
local a=tc:GetAttack()
local b=tc:GetDefense()
if b>a then a=b end
if a<0 then a=0 end
atk=atk+a
tc=g:GetNext()
end
if atk>0 then
Duel.Hint(HINT_CARD,0,64000050)
Duel.Damage(1-tp,atk/2,REASON_EFFECT)
end
end
--尤格萨隆潘趣酒
local m=7439101
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(cm.condition)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCondition(cm.actcon)
c:RegisterEffect(e2)
--salvage
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,2))
e5:SetCategory(CATEGORY_TOHAND)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetRange(LOCATION_GRAVE)
e5:SetCost(cm.salcost)
e5:SetTarget(cm.saltg)
e5:SetOperation(cm.salop)
c:RegisterEffect(e5)
--random seed
if not Party_time_random_seed then
local result=0
local g=Duel.GetDecktopGroup(0,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
local g=Duel.GetDecktopGroup(1,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
--local g=Duel.GetFieldGroup(0,0xff,0xff):RandomSelect(2,8)
--local ct={}
--local c=g:GetFirst()
--for i=0,7 do
-- ct[c]=i
-- c=g:GetNext()
--end
--for i=0,10 do
-- result=result+(ct[g:RandomSelect(2,1):GetFirst()]<<(3*i))
--end
g:DeleteGroup()
--Party_time_random_seed=result&0xffffffff
Party_time_random_seed=result
function Party_time_roll(min,max)
if min==max then return min end
min=tonumber(min)
max=tonumber(max)
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
if min~=nil then
if max==nil then
local random_number=Party_time_random_seed/2147484647
return math.floor(random_number*min)+1
else
local random_number=Party_time_random_seed/2147484647
if random_number<min then
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
random_number=Party_time_random_seed/2147484647
end
--Debug.Message(max)
--Debug.Message(Party_time_random_seed)
--Debug.Message(math.floor((max-min)*random_number))
return math.floor((max-min)*random_number)+1+min
end
end
return Party_time_random_seed
end
end
--random select
if not Party_time_globle_check then
Party_time_globle_check=true
Party_time_table={}
function Party_time_RandomSelect(g,tp,count)
if #g<=0 then return end
if count>#g then count=#g end
local cg=g:Clone()
local sg=Group.CreateGroup()
while #sg<count do
local id=Party_time_roll(0,#cg)
local tc=cg:GetFirst()
if id>1 then
for i=1,id-1,1 do tc=cg:GetNext() end
end
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
end
return _SendtoDeck(tg,tp,seq,reason)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
end
return _SendtoHand(tg,tp,reason)
end
_Select=Group.Select
function Group.Select(g,tp,min,max,cg)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local sg=g:Clone()
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
sg:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then sg:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then sg:Sub(cg) end
return Party_time_RandomSelect(sg,0,Party_time_roll(min,max))
end
end
return _Select(g,tp,min,max,cg)
end
_SelectMatchingCard=Duel.SelectMatchingCard
function Duel.SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,s,o,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
end
_SelectReleaseGroup=Duel.SelectReleaseGroup
function Duel.SelectReleaseGroup(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroup(sp,f,min,max,cg,...)
end
_SelectReleaseGroupEx=Duel.SelectReleaseGroupEx
function Duel.SelectReleaseGroupEx(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroupEx(sp,f,min,max,cg,...)
end
_GetChainMaterial=Duel.GetChainMaterial
function Duel.GetChainMaterial(tp)
local ce=_GetChainMaterial(tp)
if Duel.GetCurrentChain()==0 then return ce end
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and ce==nil then
ce=Effect.CreateEffect(c)
ce:SetType(EFFECT_TYPE_FIELD)
ce:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ce:SetTargetRange(1,0)
ce:SetTarget(cm.chain_target)
ce:SetOperation(cm.chain_operation)
ce:SetValue(aux.TRUE)
end
return ce
end
_SelectUnselect=Group.SelectUnselect
function Group.SelectUnselect(cg,sg,tp,finish,cancel,min,max)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
--_CheckGroupRecursiveCapture=aux.CheckGroupRecursiveCapture
--function aux.CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params)
-- if Duel.GetCurrentChain()~=0 and Duel.GetFlagEffect(0,7439099)~=0 then
-- local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
-- local ag=Party_time_table[7439100+id]
-- if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
-- sg:AddCard(c)
-- local sg2=sg:Clone()
-- local pg=sg:Filter(cm.rfilter,nil,7439100+id)
-- sg2:Sub(pg)
-- if aux.GCheckAdditional and (c:GetFlagEffectLabel(7439100)~=id and not aux.GCheckAdditional(sg2,c,g,f,min,max,ext_params) ) then
-- sg:RemoveCard(c)
-- return false
-- end
-- local res=#sg>=min and #sg<=max and f(sg2,table.unpack(ext_params))
-- if res then
-- aux.SubGroupCaptured:Clear()
-- aux.SubGroupCaptured:Merge(sg)
-- else
-- res=#sg<max and g:IsExists(aux. CheckGroupRecursiveCapture,1,sg2,sg,g,f,min,max,ext_params)
-- end
-- sg:RemoveCard(c)
-- return res
-- end
-- end
-- return _CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params)
--end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
end
end
function cm.chain_target(e,te,tp)
return Group.CreateGroup()
end
function cm.chain_operation(e,te,tp,tc,mat,sumtype)
if not sumtype then sumtype=SUMMON_TYPE_FUSION end
Duel.SpecialSummon(tc,sumtype,tp,tp,false,false,POS_FACEUP)
end
function cm.rfilter(c,id)
return c:GetFlagEffectLabel(7439100)==id
end
function cm.actcon(e)
return Duel.IsExistingMatchingCard(cm.cfilter,e:GetHandlerPlayer(),LOCATION_HAND,0,1,nil) and Duel.IsExistingMatchingCard(cm.cfilter,e:GetHandlerPlayer(),LOCATION_DECK,0,1,nil)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
end
function cm.cfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_MONSTER) and not c:IsPublic()
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then
local cg1=Duel.GetMatchingGroup(cm.cfilter,tp,LOCATION_DECK,0,nil)
if cg1:GetCount()==0 then return false end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local cg2=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_HAND,0,1,cg1:GetCount(),nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local cg1=cg1:Select(tp,cg2:GetCount(),cg2:GetCount(),nil)
local cg=Group.__add(cg1,cg2)
Duel.ConfirmCards(1-tp,cg)
local tc=cg:GetFirst()
while tc do
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
tc:RegisterFlagEffect(7439100,RESET_CHAIN+RESET_EVENT+RESETS_STANDARD,0,1,7439100+id)
tc=cg:GetNext()
end
cg:KeepAlive()
e:SetLabelObject(cg)
end
end
function cm.filter(c,ct,loc,cg)
if aux.GetValueType(cg)=="Group" then
return (Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)) or cg:IsContains(c)
end
return Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if re and e~=re and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if g and g:GetCount()>=1 then
local ct=ev
local label=Duel.GetFlagEffectLabel(0,m)
if label then
if ev==bit.rshift(label,16) then ct=bit.band(label,0xffff) end
end
local loc_table=0
local tc=g:GetFirst()
while tc do
local loc_tc=tc:GetLocation()
loc_table=loc_table | loc_tc
tc=g:GetNext()
end
local cg=e:GetLabelObject()
if chkc then return cm.filter(chkc,ct) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,0xff,0xff,g:GetCount(),nil,ct,loc_table,cg) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
local tg=Duel.GetMatchingGroup(cm.filter,tp,0xff,0xff,nil,ct,loc_table,cg)
local tg2=tg:RandomSelect(tp,g:GetCount())
Duel.SetTargetCard(tg2)
local val=ct+bit.lshift(ev+1,16)
if label then
Duel.SetFlagEffectLabel(0,m,val)
else
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1,val)
end
end
end
if chk==0 then return true end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if aux.GetValueType(tg)=="Group" then
local tg2=tg:Filter(Card.IsRelateToEffect,nil,e)
if tg2 and tg2:GetCount()>0 then
Duel.ChangeTargetCard(ev,tg2)
end
elseif aux.GetValueType(tg)=="Card" then
if tg:IsRelateToEffect(e) then
Duel.ChangeTargetCard(ev,Group.FromCards(tg))
end
end
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
Duel.RegisterFlagEffect(0,7439100+id,RESET_CHAIN,0,1)
if e:GetLabelObject() and e:GetLabelObject():GetCount()>0 then
Party_time_table[7439100+id]=e:GetLabelObject()
end
end
function cm.salcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end
Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function cm.thfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
end
function cm.saltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.thfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function cm.salop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--尤格萨隆潘趣酒
local m=7439103
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(cm.condition)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCondition(cm.actcon)
c:RegisterEffect(e2)
--salvage
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,2))
e5:SetCategory(CATEGORY_TOHAND)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetRange(LOCATION_GRAVE)
e5:SetCost(cm.salcost)
e5:SetTarget(cm.saltg)
e5:SetOperation(cm.salop)
c:RegisterEffect(e5)
--random seed
if not Party_time_random_seed then
local result=0
local g=Duel.GetDecktopGroup(0,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
local g=Duel.GetDecktopGroup(1,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
--local g=Duel.GetFieldGroup(0,0xff,0xff):RandomSelect(2,8)
--local ct={}
--local c=g:GetFirst()
--for i=0,7 do
-- ct[c]=i
-- c=g:GetNext()
--end
--for i=0,10 do
-- result=result+(ct[g:RandomSelect(2,1):GetFirst()]<<(3*i))
--end
g:DeleteGroup()
--Party_time_random_seed=result&0xffffffff
Party_time_random_seed=result
function Party_time_roll(min,max)
if min==max then return min end
min=tonumber(min)
max=tonumber(max)
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
if min~=nil then
if max==nil then
local random_number=Party_time_random_seed/2147484647
return math.floor(random_number*min)+1
else
local random_number=Party_time_random_seed/2147484647
if random_number<min then
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
random_number=Party_time_random_seed/2147484647
end
--Debug.Message(max)
--Debug.Message(Party_time_random_seed)
--Debug.Message(math.floor((max-min)*random_number))
return math.floor((max-min)*random_number)+1+min
end
end
return Party_time_random_seed
end
end
--random select
if not Party_time_globle_check then
Party_time_globle_check=true
Party_time_table={}
function Party_time_RandomSelect(g,tp,count)
if #g<=0 then return end
if count>#g then count=#g end
local cg=g:Clone()
local sg=Group.CreateGroup()
while #sg<count do
local id=Party_time_roll(0,#cg)
local tc=cg:GetFirst()
if id>1 then
for i=1,id-1,1 do tc=cg:GetNext() end
end
sg:AddCard(tc)
g:RemoveCard(tc)
cg:DeleteGroup()
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
end
return _SendtoDeck(tg,tp,seq,reason)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
end
return _SendtoHand(tg,tp,reason)
end
_Select=Group.Select
function Group.Select(g,tp,min,max,cg)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local sg=g:Clone()
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
sg:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then sg:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then sg:Sub(cg) end
return Party_time_RandomSelect(sg,0,Party_time_roll(min,max))
end
end
return _Select(g,tp,min,max,cg)
end
_SelectMatchingCard=Duel.SelectMatchingCard
function Duel.SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,s,o,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
end
_SelectReleaseGroup=Duel.SelectReleaseGroup
function Duel.SelectReleaseGroup(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroup(sp,f,min,max,cg,...)
end
_SelectReleaseGroupEx=Duel.SelectReleaseGroupEx
function Duel.SelectReleaseGroupEx(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroupEx(sp,f,min,max,cg,...)
end
_GetChainMaterial=Duel.GetChainMaterial
function Duel.GetChainMaterial(tp)
local ce=_GetChainMaterial(tp)
if Duel.GetCurrentChain()==0 then return ce end
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and ce==nil then
ce=Effect.CreateEffect(c)
ce:SetType(EFFECT_TYPE_FIELD)
ce:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ce:SetTargetRange(1,0)
ce:SetTarget(cm.chain_target)
ce:SetOperation(cm.chain_operation)
ce:SetValue(aux.TRUE)
end
return ce
end
_SelectUnselect=Group.SelectUnselect
function Group.SelectUnselect(cg,sg,tp,finish,cancel,min,max)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
end
end
function cm.chain_target(e,te,tp)
return Group.CreateGroup()
end
function cm.chain_operation(e,te,tp,tc,mat,sumtype)
if not sumtype then sumtype=SUMMON_TYPE_FUSION end
Duel.SpecialSummon(tc,sumtype,tp,tp,false,false,POS_FACEUP)
end
function cm.rfilter(c,id)
return c:GetFlagEffectLabel(7439100)==id
end
function cm.actcon(e)
local g=Duel.GetMatchingGroup(cm.cfilter,e:GetHandlerPlayer(),LOCATION_DECK,0,1,nil)
return g:GetClassCount(Card.GetCode)>=3
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
end
function cm.cfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_MONSTER) and not c:IsPublic()
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then
local cg=Duel.GetMatchingGroup(cm.cfilter,tp,LOCATION_DECK,0,nil)
if cg:GetClassCount(Card.GetCode)<=2 then return false end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=cg:SelectSubGroup(tp,aux.dncheck,false,3,3)
Duel.ConfirmCards(1-tp,sg)
local tc=sg:GetFirst()
while tc do
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
tc:RegisterFlagEffect(7439100,RESET_CHAIN+RESET_EVENT+RESETS_STANDARD,0,1,7439100+id)
tc=sg:GetNext()
end
sg:KeepAlive()
e:SetLabelObject(sg)
end
end
function cm.filter(c,ct,loc,cg)
if aux.GetValueType(cg)=="Group" then
return (Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)) or cg:IsContains(c)
end
return Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if re and e~=re and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if g and g:GetCount()>=1 then
local ct=ev
local label=Duel.GetFlagEffectLabel(0,m)
if label then
if ev==bit.rshift(label,16) then ct=bit.band(label,0xffff) end
end
local loc_table=0
local tc=g:GetFirst()
while tc do
local loc_tc=tc:GetLocation()
loc_table=loc_table | loc_tc
tc=g:GetNext()
end
local cg=e:GetLabelObject()
if chkc then return cm.filter(chkc,ct) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,0xff,0xff,g:GetCount(),nil,ct,loc_table,cg) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
local tg=Duel.GetMatchingGroup(cm.filter,tp,0xff,0xff,nil,ct,loc_table,cg)
local tg2=tg:RandomSelect(tp,g:GetCount())
Duel.SetTargetCard(tg2)
local val=ct+bit.lshift(ev+1,16)
if label then
Duel.SetFlagEffectLabel(0,m,val)
else
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1,val)
end
end
end
if chk==0 then return true end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if aux.GetValueType(tg)=="Group" then
local tg2=tg:Filter(Card.IsRelateToEffect,nil,e)
if tg2 and tg2:GetCount()>0 then
Duel.ChangeTargetCard(ev,tg2)
end
elseif aux.GetValueType(tg)=="Card" then
if tg:IsRelateToEffect(e) then
Duel.ChangeTargetCard(ev,Group.FromCards(tg))
end
end
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
Duel.RegisterFlagEffect(0,7439100+id,RESET_CHAIN,0,1)
if e:GetLabelObject() and e:GetLabelObject():GetCount()>0 then
Party_time_table[7439100+id]=e:GetLabelObject()
end
end
function cm.salcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end
Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function cm.thfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
end
function cm.saltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.thfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function cm.salop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--尤格萨隆潘趣酒
local m=7439105
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(cm.condition)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCondition(cm.actcon)
c:RegisterEffect(e2)
--salvage
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,2))
e5:SetCategory(CATEGORY_TOHAND)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetRange(LOCATION_GRAVE)
e5:SetCost(cm.salcost)
e5:SetTarget(cm.saltg)
e5:SetOperation(cm.salop)
c:RegisterEffect(e5)
--random seed
if not Party_time_random_seed then
local result=0
local g=Duel.GetDecktopGroup(0,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
local g=Duel.GetDecktopGroup(1,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
--local g=Duel.GetFieldGroup(0,0xff,0xff):RandomSelect(2,8)
--local ct={}
--local c=g:GetFirst()
--for i=0,7 do
-- ct[c]=i
-- c=g:GetNext()
--end
--for i=0,10 do
-- result=result+(ct[g:RandomSelect(2,1):GetFirst()]<<(3*i))
--end
g:DeleteGroup()
--Party_time_random_seed=result&0xffffffff
Party_time_random_seed=result
function Party_time_roll(min,max)
if min==max then return min end
min=tonumber(min)
max=tonumber(max)
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
if min~=nil then
if max==nil then
local random_number=Party_time_random_seed/2147484647
return math.floor(random_number*min)+1
else
local random_number=Party_time_random_seed/2147484647
if random_number<min then
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
random_number=Party_time_random_seed/2147484647
end
--Debug.Message(max)
--Debug.Message(Party_time_random_seed)
--Debug.Message(math.floor((max-min)*random_number))
return math.floor((max-min)*random_number)+1+min
end
end
return Party_time_random_seed
end
end
--random select
if not Party_time_globle_check then
Party_time_globle_check=true
Party_time_table={}
function Party_time_RandomSelect(g,tp,count)
if #g<=0 then return end
if count>#g then count=#g end
local cg=g:Clone()
local sg=Group.CreateGroup()
while #sg<count do
local id=Party_time_roll(0,#cg)
local tc=cg:GetFirst()
if id>1 then
for i=1,id-1,1 do tc=cg:GetNext() end
end
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
end
return _SendtoDeck(tg,tp,seq,reason)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
end
return _SendtoHand(tg,tp,reason)
end
_Select=Group.Select
function Group.Select(g,tp,min,max,cg)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local sg=g:Clone()
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
sg:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then sg:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then sg:Sub(cg) end
return Party_time_RandomSelect(sg,0,Party_time_roll(min,max))
end
end
return _Select(g,tp,min,max,cg)
end
_SelectMatchingCard=Duel.SelectMatchingCard
function Duel.SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,s,o,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
end
_SelectReleaseGroup=Duel.SelectReleaseGroup
function Duel.SelectReleaseGroup(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroup(sp,f,min,max,cg,...)
end
_SelectReleaseGroupEx=Duel.SelectReleaseGroupEx
function Duel.SelectReleaseGroupEx(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroupEx(sp,f,min,max,cg,...)
end
_GetChainMaterial=Duel.GetChainMaterial
function Duel.GetChainMaterial(tp)
local ce=_GetChainMaterial(tp)
if Duel.GetCurrentChain()==0 then return ce end
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and ce==nil then
ce=Effect.CreateEffect(c)
ce:SetType(EFFECT_TYPE_FIELD)
ce:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ce:SetTargetRange(1,0)
ce:SetTarget(cm.chain_target)
ce:SetOperation(cm.chain_operation)
ce:SetValue(aux.TRUE)
end
return ce
end
_SelectUnselect=Group.SelectUnselect
function Group.SelectUnselect(cg,sg,tp,finish,cancel,min,max)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
end
end
function cm.chain_target(e,te,tp)
return Group.CreateGroup()
end
function cm.chain_operation(e,te,tp,tc,mat,sumtype)
if not sumtype then sumtype=SUMMON_TYPE_FUSION end
Duel.SpecialSummon(tc,sumtype,tp,tp,false,false,POS_FACEUP)
end
function cm.rfilter(c,id)
return c:GetFlagEffectLabel(7439100)==id
end
function cm.actcon(e)
return Duel.IsExistingMatchingCard(cm.cfilter,e:GetHandlerPlayer(),LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
end
function cm.cfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_MONSTER) and ((c:IsLocation(LOCATION_HAND+LOCATION_DECK) and not c:IsPublic()) or c:IsLocation(LOCATION_GRAVE))
end
function cm.gcheck(g)
return g:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1
and g:FilterCount(Card.IsLocation,nil,LOCATION_GRAVE)<=1
and g:FilterCount(Card.IsLocation,nil,LOCATION_HAND)<=1
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then
local cg=Duel.GetMatchingGroup(cm.cfilter,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_HAND,0,nil)
if cg:GetCount()<=0 then return false end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=cg:SelectSubGroup(tp,cm.gcheck,false,1,3)
Duel.HintSelection(sg:Filter(Card.IsLocation,nil,LOCATION_GRAVE))
Duel.ConfirmCards(1-tp,sg:Filter(Card.IsLocation,nil,LOCATION_HAND+LOCATION_DECK))
local tc=sg:GetFirst()
while tc do
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
tc:RegisterFlagEffect(7439100,RESET_CHAIN+RESET_EVENT+RESETS_STANDARD,0,1,7439100+id)
tc=sg:GetNext()
end
sg:KeepAlive()
e:SetLabelObject(sg)
end
end
function cm.filter(c,ct,loc,cg)
if aux.GetValueType(cg)=="Group" then
return (Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)) or cg:IsContains(c)
end
return Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if re and e~=re and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if g and g:GetCount()>=1 then
local ct=ev
local label=Duel.GetFlagEffectLabel(0,m)
if label then
if ev==bit.rshift(label,16) then ct=bit.band(label,0xffff) end
end
local loc_table=0
local tc=g:GetFirst()
while tc do
local loc_tc=tc:GetLocation()
loc_table=loc_table | loc_tc
tc=g:GetNext()
end
local cg=e:GetLabelObject()
if chkc then return cm.filter(chkc,ct) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,0xff,0xff,g:GetCount(),nil,ct,loc_table,cg) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
local tg=Duel.GetMatchingGroup(cm.filter,tp,0xff,0xff,nil,ct,loc_table,cg)
local tg2=tg:RandomSelect(tp,g:GetCount())
Duel.SetTargetCard(tg2)
local val=ct+bit.lshift(ev+1,16)
if label then
Duel.SetFlagEffectLabel(0,m,val)
else
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1,val)
end
end
end
if chk==0 then return true end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if aux.GetValueType(tg)=="Group" then
local tg2=tg:Filter(Card.IsRelateToEffect,nil,e)
if tg2 and tg2:GetCount()>0 then
Duel.ChangeTargetCard(ev,tg2)
end
elseif aux.GetValueType(tg)=="Card" then
if tg:IsRelateToEffect(e) then
Duel.ChangeTargetCard(ev,Group.FromCards(tg))
end
end
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
Duel.RegisterFlagEffect(0,7439100+id,RESET_CHAIN,0,1)
if e:GetLabelObject() and e:GetLabelObject():GetCount()>0 then
Party_time_table[7439100+id]=e:GetLabelObject()
end
end
function cm.salcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end
Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function cm.thfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
end
function cm.saltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.thfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function cm.salop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--尤格萨隆潘趣酒
local m=7439107
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(cm.condition)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCondition(cm.actcon)
c:RegisterEffect(e2)
--salvage
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,2))
e5:SetCategory(CATEGORY_TOHAND)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetRange(LOCATION_GRAVE)
e5:SetCost(cm.salcost)
e5:SetTarget(cm.saltg)
e5:SetOperation(cm.salop)
c:RegisterEffect(e5)
--random seed
if not Party_time_random_seed then
local result=0
local g=Duel.GetDecktopGroup(0,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
local g=Duel.GetDecktopGroup(1,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
--local g=Duel.GetFieldGroup(0,0xff,0xff):RandomSelect(2,8)
--local ct={}
--local c=g:GetFirst()
--for i=0,7 do
-- ct[c]=i
-- c=g:GetNext()
--end
--for i=0,10 do
-- result=result+(ct[g:RandomSelect(2,1):GetFirst()]<<(3*i))
--end
g:DeleteGroup()
--Party_time_random_seed=result&0xffffffff
Party_time_random_seed=result
function Party_time_roll(min,max)
if min==max then return min end
min=tonumber(min)
max=tonumber(max)
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
if min~=nil then
if max==nil then
local random_number=Party_time_random_seed/2147484647
return math.floor(random_number*min)+1
else
local random_number=Party_time_random_seed/2147484647
if random_number<min then
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
random_number=Party_time_random_seed/2147484647
end
--Debug.Message(max)
--Debug.Message(Party_time_random_seed)
--Debug.Message(math.floor((max-min)*random_number))
return math.floor((max-min)*random_number)+1+min
end
end
return Party_time_random_seed
end
end
--random select
if not Party_time_globle_check then
Party_time_globle_check=true
Party_time_table={}
function Party_time_RandomSelect(g,tp,count)
if #g<=0 then return end
if count>#g then count=#g end
local cg=g:Clone()
local sg=Group.CreateGroup()
while #sg<count do
local id=Party_time_roll(0,#cg)
local tc=cg:GetFirst()
if id>1 then
for i=1,id-1,1 do tc=cg:GetNext() end
end
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
end
return _SendtoDeck(tg,tp,seq,reason)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
end
return _SendtoHand(tg,tp,reason)
end
_Select=Group.Select
function Group.Select(g,tp,min,max,cg)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local sg=g:Clone()
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
sg:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then sg:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then sg:Sub(cg) end
return Party_time_RandomSelect(sg,0,Party_time_roll(min,max))
end
end
return _Select(g,tp,min,max,cg)
end
_SelectMatchingCard=Duel.SelectMatchingCard
function Duel.SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,s,o,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
end
_SelectReleaseGroup=Duel.SelectReleaseGroup
function Duel.SelectReleaseGroup(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroup(sp,f,min,max,cg,...)
end
_SelectReleaseGroupEx=Duel.SelectReleaseGroupEx
function Duel.SelectReleaseGroupEx(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroupEx(sp,f,min,max,cg,...)
end
_GetChainMaterial=Duel.GetChainMaterial
function Duel.GetChainMaterial(tp)
local ce=_GetChainMaterial(tp)
if Duel.GetCurrentChain()==0 then return ce end
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and ce==nil then
ce=Effect.CreateEffect(c)
ce:SetType(EFFECT_TYPE_FIELD)
ce:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ce:SetTargetRange(1,0)
ce:SetTarget(cm.chain_target)
ce:SetOperation(cm.chain_operation)
ce:SetValue(aux.TRUE)
end
return ce
end
_SelectUnselect=Group.SelectUnselect
function Group.SelectUnselect(cg,sg,tp,finish,cancel,min,max)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
end
end
function cm.chain_target(e,te,tp)
return Group.CreateGroup()
end
function cm.chain_operation(e,te,tp,tc,mat,sumtype)
if not sumtype then sumtype=SUMMON_TYPE_FUSION end
Duel.SpecialSummon(tc,sumtype,tp,tp,false,false,POS_FACEUP)
end
function cm.rfilter(c,id)
return c:GetFlagEffectLabel(7439100)==id
end
function cm.actcon(e)
return Duel.IsExistingMatchingCard(cm.cfilter,e:GetHandlerPlayer(),LOCATION_HAND+LOCATION_REMOVED+LOCATION_GRAVE,0,1,nil)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
end
function cm.cfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeckAsCost() and (c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and c:IsFaceup()))
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_REMOVED+LOCATION_GRAVE+LOCATION_HAND,0,1,99,nil)
Duel.HintSelection(sg:Filter(Card.IsLocation,nil,LOCATION_GRAVE+LOCATION_REMOVED))
Duel.ConfirmCards(1-tp,sg:Filter(Card.IsLocation,nil,LOCATION_HAND))
Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_COST)
local tc=sg:GetFirst()
while tc do
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
tc:RegisterFlagEffect(7439100,RESET_CHAIN+RESET_EVENT+RESETS_STANDARD,0,1,7439100+id)
tc=sg:GetNext()
end
sg:KeepAlive()
e:SetLabelObject(sg)
end
end
function cm.filter(c,ct,loc,cg)
if aux.GetValueType(cg)=="Group" then
return (Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)) or cg:IsContains(c)
end
return Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if re and e~=re and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if g and g:GetCount()>=1 then
local ct=ev
local label=Duel.GetFlagEffectLabel(0,m)
if label then
if ev==bit.rshift(label,16) then ct=bit.band(label,0xffff) end
end
local loc_table=0
local tc=g:GetFirst()
while tc do
local loc_tc=tc:GetLocation()
loc_table=loc_table | loc_tc
tc=g:GetNext()
end
local cg=e:GetLabelObject()
if chkc then return cm.filter(chkc,ct) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,0xff,0xff,g:GetCount(),nil,ct,loc_table,cg) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
local tg=Duel.GetMatchingGroup(cm.filter,tp,0xff,0xff,nil,ct,loc_table,cg)
local tg2=tg:RandomSelect(tp,g:GetCount())
Duel.SetTargetCard(tg2)
local val=ct+bit.lshift(ev+1,16)
if label then
Duel.SetFlagEffectLabel(0,m,val)
else
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1,val)
end
end
end
if chk==0 then return true end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if aux.GetValueType(tg)=="Group" then
local tg2=tg:Filter(Card.IsRelateToEffect,nil,e)
if tg2 and tg2:GetCount()>0 then
Duel.ChangeTargetCard(ev,tg2)
end
elseif aux.GetValueType(tg)=="Card" then
if tg:IsRelateToEffect(e) then
Duel.ChangeTargetCard(ev,Group.FromCards(tg))
end
end
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
Duel.RegisterFlagEffect(0,7439100+id,RESET_CHAIN,0,1)
if e:GetLabelObject() and e:GetLabelObject():GetCount()>0 then
Party_time_table[7439100+id]=e:GetLabelObject()
end
end
function cm.salcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end
Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function cm.thfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
end
function cm.saltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.thfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function cm.salop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--尤格萨隆潘趣酒
local m=7439109
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(cm.condition)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCondition(cm.actcon)
c:RegisterEffect(e2)
--salvage
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,2))
e5:SetCategory(CATEGORY_TOHAND)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetRange(LOCATION_GRAVE)
e5:SetCost(cm.salcost)
e5:SetTarget(cm.saltg)
e5:SetOperation(cm.salop)
c:RegisterEffect(e5)
--random seed
if not Party_time_random_seed then
local result=0
local g=Duel.GetDecktopGroup(0,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
local g=Duel.GetDecktopGroup(1,5)
local tc=g:GetFirst()
while tc do
result=result+tc:GetCode()
tc=g:GetNext()
end
--local g=Duel.GetFieldGroup(0,0xff,0xff):RandomSelect(2,8)
--local ct={}
--local c=g:GetFirst()
--for i=0,7 do
-- ct[c]=i
-- c=g:GetNext()
--end
--for i=0,10 do
-- result=result+(ct[g:RandomSelect(2,1):GetFirst()]<<(3*i))
--end
g:DeleteGroup()
--Party_time_random_seed=result&0xffffffff
Party_time_random_seed=result
function Party_time_roll(min,max)
if min==max then return min end
min=tonumber(min)
max=tonumber(max)
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
if min~=nil then
if max==nil then
local random_number=Party_time_random_seed/2147484647
return math.floor(random_number*min)+1
else
local random_number=Party_time_random_seed/2147484647
if random_number<min then
Party_time_random_seed=(Party_time_random_seed*16807)%2147484647
random_number=Party_time_random_seed/2147484647
end
--Debug.Message(max)
--Debug.Message(Party_time_random_seed)
--Debug.Message(math.floor((max-min)*random_number))
return math.floor((max-min)*random_number)+1+min
end
end
return Party_time_random_seed
end
end
--random select
if not Party_time_globle_check then
Party_time_globle_check=true
Party_time_table={}
function Party_time_RandomSelect(g,tp,count)
if #g<=0 then return end
if count>#g then count=#g end
local cg=g:Clone()
local sg=Group.CreateGroup()
while #sg<count do
local id=Party_time_roll(0,#cg)
local tc=cg:GetFirst()
if id>1 then
for i=1,id-1,1 do tc=cg:GetNext() end
end
sg:AddCard(tc)
cg:RemoveCard(tc)
end
--Duel.HintSelection(g)
Duel.HintSelection(sg)
return sg
end
_SendtoDeck=Duel.SendtoDeck
function Duel.SendtoDeck(tg,tp,seq,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_DECK) then
return _SendtoDeck(tg,1-tg:GetControler(),seq,reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_DECK)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoDeck(tg,tp,seq,reason)
end
return _SendtoDeck(sg,1-sg:GetFirst():GetControler(),seq,reason)
end
end
end
end
return _SendtoDeck(tg,tp,seq,reason)
end
_SendtoHand=Duel.SendtoHand
function Duel.SendtoHand(tg,tp,reason)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if not tp and aux.GetValueType(tg)=="Card" and tg:GetFlagEffectLabel(m)==7439100+id and tg:IsLocation(LOCATION_HAND) then
return _SendtoHand(tg,1-tg:GetControler(),reason)
end
if not tp and aux.GetValueType(tg)=="Group" then
local sg=tg:Filter(cm.rfilter,nil,7439100+id):Filter(Card.IsLocation,nil,LOCATION_HAND)
if sg and sg:GetCount()>0 then
tg:Sub(sg)
if tg and tg:GetCount()>0 then
_SendtoHand(tg,tp,reason)
end
return _SendtoHand(sg,1-sg:GetFirst():GetControler(),reason)
end
end
end
end
return _SendtoHand(tg,tp,reason)
end
_Select=Group.Select
function Group.Select(g,tp,min,max,cg)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local sg=g:Clone()
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
sg:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then sg:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then sg:Sub(cg) end
return Party_time_RandomSelect(sg,0,Party_time_roll(min,max))
end
end
return _Select(g,tp,min,max,cg)
end
_SelectMatchingCard=Duel.SelectMatchingCard
function Duel.SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,s,o,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectMatchingCard(sp,f,tp,s,o,min,max,cg,...)
end
_SelectReleaseGroup=Duel.SelectReleaseGroup
function Duel.SelectReleaseGroup(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroup(sp,f,min,max,cg,...)
end
_SelectReleaseGroupEx=Duel.SelectReleaseGroupEx
function Duel.SelectReleaseGroupEx(sp,f,min,max,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetReleaseGroup(sp)
local g=g:Filter(f,cg,...)
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
if aux.GetValueType(cg)=="Card" then g:RemoveCard(cg) end
if aux.GetValueType(cg)=="Group" then g:Sub(cg) end
return Party_time_RandomSelect(g,0,Party_time_roll(min,max))
end
end
return _SelectReleaseGroupEx(sp,f,min,max,cg,...)
end
_GetChainMaterial=Duel.GetChainMaterial
function Duel.GetChainMaterial(tp)
local ce=_GetChainMaterial(tp)
if Duel.GetCurrentChain()==0 then return ce end
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and ce==nil then
ce=Effect.CreateEffect(c)
ce:SetType(EFFECT_TYPE_FIELD)
ce:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ce:SetTargetRange(1,0)
ce:SetTarget(cm.chain_target)
ce:SetOperation(cm.chain_operation)
ce:SetValue(aux.TRUE)
end
return ce
end
_SelectUnselect=Group.SelectUnselect
function Group.SelectUnselect(cg,sg,tp,finish,cancel,min,max)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if finish and Party_time_roll(1,2)==1 then return end
if not cg or cg:GetCount()<=0 then return end
local cg2=cg:Clone()
if aux.GetValueType(ag)=="Group" and Duel.GetFlagEffect(0,7439099)==0 then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
cg2:Merge(ag)
end
end
local tc=Party_time_RandomSelect(cg2,0,1):GetFirst()
if cm.Party_time(tc) and not cg:IsContains(tc) then cg:AddCard(tc) end
--sg:AddCard(tc)
return tc
end
end
return _SelectUnselect(cg,sg,tp,finish,cancel,min,max)
end
_SelectSubGroup=Group.SelectSubGroup
function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
--
aux.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
local tc=fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
g:Merge(ag)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
local eg1=g:Clone()
local eg2=eg:Filter(cm.rfilter,nil,7439100+id)
local sg1=sg:Clone()
local sg2=sg:Filter(cm.rfilter,nil,7439100+id)
if not aux.GCheckAdditional then
eg:Sub(eg2)
eg1:Sub(eg2)
sg1:Sub(sg2)
for c in aux.Next(eg-sg1) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg1,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
cg:Merge(ag)
else
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if aux.CheckGroupRecursiveCapture(c,sg,eg1,f,min,max,ext_params) then
cg:Merge(aux.SubGroupCaptured)
else
eg1:RemoveCard(c)
end
end
end
end
cg:Sub(sg)
finish=#sg>=min and #sg<=max and (f(sg1,...) or f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
Duel.RegisterFlagEffect(0,7439099,RESET_CHAIN,0,1)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
Duel.ResetFlagEffect(0,7439099)
if not tc then finish=true break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
local cg=Group.__add(g,ag)
if (not sg or sg:GetCount()<min) and #cg>0 and not aux.GCheckAdditional then
sg=Party_time_RandomSelect(cg,0,Party_time_roll(min,max))
return sg
end
return nil
end
end
end
end
end
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
_IsCanBeRitualMaterial=Card.IsCanBeRitualMaterial
function Card.IsCanBeRitualMaterial(c,sc)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 and aux.GetValueType(sc)=="Card" and sc:GetFlagEffectLabel(7439100)==7439100+id then
sc:ResetFlagEffect(7439100)
end
end
return _IsCanBeRitualMaterial(c,sc)
end
_DiscardHand=Duel.DiscardHand
function Duel.DiscardHand(tp,f,min,max,reason,cg,...)
if Duel.GetCurrentChain()~=0 then
local id=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local ag=Party_time_table[7439100+id]
if id~=0 and Duel.GetFlagEffect(0,7439100+id)~=0 then
local g=Duel.GetMatchingGroup(f,tp,LOCATION_HAND,0,cg,...)
if not g or g:GetCount()<=0 then return false end
if aux.GetValueType(ag)=="Group" then
ag=ag:Filter(cm.rfilter,nil,7439100+id)
if ag:GetCount()~=0 then
g:Merge(ag)
end
end
local sg=Party_time_RandomSelect(g,0,Party_time_roll(min,max))
return Duel.SendtoGrave(sg,reason+REASON_DISCARD)
end
end
return _DiscardHand(tp,f,min,max,reason,cg,...)
end
end
end
function cm.chain_target(e,te,tp)
return Group.CreateGroup()
end
function cm.chain_operation(e,te,tp,tc,mat,sumtype)
if not sumtype then sumtype=SUMMON_TYPE_FUSION end
Duel.SpecialSummon(tc,sumtype,tp,tp,false,false,POS_FACEUP)
end
function cm.rfilter(c,id)
return c:GetFlagEffectLabel(7439100)==id
end
function cm.actcon(e)
return Duel.IsExistingMatchingCard(cm.cfilter,e:GetHandlerPlayer(),LOCATION_HAND,0,1,nil)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
end
function cm.cfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_MONSTER) and not c:IsPublic()
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local cg=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_HAND,0,1,99,nil)
Duel.ConfirmCards(1-tp,cg)
local tc=cg:GetFirst()
while tc do
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
tc:RegisterFlagEffect(7439100,RESET_CHAIN+RESET_EVENT+RESETS_STANDARD,0,1,7439100+id)
tc=cg:GetNext()
end
cg:KeepAlive()
e:SetLabelObject(cg)
end
end
function cm.filter(c,ct,loc,cg)
if aux.GetValueType(cg)=="Group" then
return (Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)) or cg:IsContains(c)
end
return Duel.CheckChainTarget(ct,c) and c:IsLocation(loc)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if re and e~=re and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if g and g:GetCount()>=1 then
local ct=ev
local label=Duel.GetFlagEffectLabel(0,m)
if label then
if ev==bit.rshift(label,16) then ct=bit.band(label,0xffff) end
end
local loc_table=0
local tc=g:GetFirst()
while tc do
local loc_tc=tc:GetLocation()
loc_table=loc_table | loc_tc
tc=g:GetNext()
end
local cg=e:GetLabelObject()
if chkc then return cm.filter(chkc,ct) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,0xff,0xff,g:GetCount(),nil,ct,loc_table,cg) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
local tg=Duel.GetMatchingGroup(cm.filter,tp,0xff,0xff,nil,ct,loc_table,cg)
local tg2=tg:RandomSelect(tp,g:GetCount())
Duel.SetTargetCard(tg2)
local val=ct+bit.lshift(ev+1,16)
if label then
Duel.SetFlagEffectLabel(0,m,val)
else
Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1,val)
end
end
end
if chk==0 then return true end
end
function cm.spfilter(c,e,tp,id)
return c:GetFlagEffectLabel(7439100)==id and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if aux.GetValueType(tg)=="Group" then
local tg2=tg:Filter(Card.IsRelateToEffect,nil,e)
if tg2 and tg2:GetCount()>0 then
Duel.ChangeTargetCard(ev,tg2)
end
elseif aux.GetValueType(tg)=="Card" then
if tg:IsRelateToEffect(e) then
Duel.ChangeTargetCard(ev,Group.FromCards(tg))
end
end
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
Duel.RegisterFlagEffect(0,7439100+id,RESET_CHAIN,0,1)
if e:GetLabelObject() and e:GetLabelObject():GetCount()>0 then
Party_time_table[7439100+id]=e:GetLabelObject()
end
--
local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_HAND,0,nil,e,tp,7439100+id)
if g:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(m,4)) then
Duel.BreakEffect()
local sg=g:Select(tp,1,1,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.salcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end
Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function cm.thfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
end
function cm.saltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.thfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function cm.salop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--派对狂欢穆克拉
local m=7439201
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetOperation(cm.atkop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.thfilter(c)
return cm.Party_time(c) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
end
function cm.cfilter(c)
return c:GetAttack()~=c:GetBaseAttack() and c:IsFaceup()
end
function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local count=5
local c=e:GetHandler()
while count>0 and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) do
if count<5 then Duel.BreakEffect() end
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local tc=g:RandomSelect(0,1):GetFirst()
Duel.HintSelection(Group.FromCards(tc))
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
tc:RegisterEffect(e2)
Duel.AdjustInstantly()
count=count-1
end
local cg=Duel.GetMatchingGroup(cm.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(cm.thfilter,c:GetOwner(),LOCATION_DECK,0,nil)
if count<5 and cg and cg:GetCount()>0 and
g:CheckSubGroup(aux.dncheck,cg:GetCount(),cg:GetCount()) and Duel.SelectYesNo(c:GetOwner(),aux.Stringid(m,3)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_ATOHAND)
--local sg=Duel.SelectMatchingCard(c:GetOwner(),cm.thfilter,c:GetOwner(),LOCATION_DECK,0,cg:GetCount(),cg:GetCount(),nil)
local sg=g:SelectSubGroup(c:GetOwner(),aux.dncheck,false,cg:GetCount(),cg:GetCount())
if sg:GetCount()>0 then
Duel.SendtoHand(sg,c:GetOwner(),REASON_EFFECT)
Duel.ConfirmCards(1-c:GetOwner(),sg)
end
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(re:GetHandler():GetControler()==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandler():GetControler()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439203
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_TOGRAVE+CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.tgtg)
e1:SetOperation(cm.tgop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.thfilter(c,lv)
return cm.Party_time(c) and c:IsAbleToHand() and c:IsType(TYPE_MONSTER) and c:IsLevel(lv)
end
function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_HAND)
end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsType,1-tp,LOCATION_HAND,0,nil,TYPE_MONSTER)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
local sg=g:Select(1-tp,1,1,nil)
Duel.HintSelection(sg)
Duel.SendtoGrave(sg,REASON_RULE)
local og=Duel.GetOperatedGroup()
if not og or og:GetCount()<=0 then return false end
local tc=og:GetFirst()
local c=e:GetHandler()
local atk=tc:GetAttack()
local def=tc:GetDefense()
if atk>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end
if def>0 then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_DEFENSE)
e2:SetValue(def)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e2)
end
if tc and Duel.IsExistingMatchingCard(cm.thfilter,c:GetOwner(),LOCATION_DECK,0,1,nil,tc:GetLevel())
and Duel.SelectYesNo(c:GetOwner(),aux.Stringid(m,3)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_ATOHAND)
local sg=Duel.SelectMatchingCard(c:GetOwner(),cm.thfilter,c:GetOwner(),LOCATION_DECK,0,1,1,nil,tc:GetLevel())
if sg:GetCount()>0 then
Duel.SendtoHand(sg,c:GetOwner(),REASON_EFFECT)
Duel.ConfirmCards(1-c:GetOwner(),sg)
end
end
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439205
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.sptg2)
e1:SetOperation(cm.spop2)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.spfilter1(c,e,tp)
return cm.Party_time(c) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.spfilter2(c,e,tp)
return c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(cm.spfilter3,c:GetOwner(),LOCATION_MZONE,LOCATION_MZONE,2,nil,c:GetCode())
end
function cm.spfilter3(c,code)
return c:IsFaceup() and c:IsCode(code)
end
function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,1-tp,LOCATION_HAND)
end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(c:GetOwner(),LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(c:GetOwner(),cm.spfilter1,c:GetOwner(),LOCATION_HAND,0,1,1,nil,e,c:GetOwner())
if g:GetCount()>0 and Duel.SpecialSummon(g,0,c:GetOwner(),c:GetOwner(),false,false,POS_FACEUP)>0 and Duel.GetLocationCount(c:GetOwner(),LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter2,c:GetOwner(),LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,c:GetOwner()) and Duel.SelectYesNo(c:GetOwner(),aux.Stringid(m,3)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(c:GetOwner(),cm.spfilter2,c:GetOwner(),LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,c:GetOwner())
if sg:GetCount()>0 then
Duel.SpecialSummon(sg,0,c:GetOwner(),c:GetOwner(),false,false,POS_FACEUP)
end
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439207
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.sptg2)
e1:SetOperation(cm.spop2)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.spfilter1(c,e,tp)
return cm.Party_time(c) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (c:IsLocation(LOCATION_HAND) or (c:IsLevelBelow(3) and c:IsLocation(LOCATION_DECK) and not Duel.IsExistingMatchingCard(cm.spfilter2,c:GetOwner(),LOCATION_MZONE,0,1,nil)))
end
function cm.spfilter2(c)
return c:IsFaceup() and c:IsLevelAbove(5)
end
function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if not Duel.IsExistingMatchingCard(cm.spfilter2,e:GetHandler():GetOwner(),LOCATION_MZONE,0,1,nil) then
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,e:GetHandler():GetOwner(),LOCATION_HAND+LOCATION_DECK)
else
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,e:GetHandler():GetOwner(),LOCATION_HAND)
end
end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(c:GetOwner(),LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(c:GetOwner(),cm.spfilter1,c:GetOwner(),LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,c:GetOwner())
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,c:GetOwner(),c:GetOwner(),false,false,POS_FACEUP)
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢巴罗夫
local m=7439209
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.sptg2)
e1:SetOperation(cm.spop2)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.spfilter(c,e,tp)
return cm.Party_time(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK)
end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(cm.spfilter,c:GetOwner(),LOCATION_DECK,0,nil,e,tp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=1 or g:GetClassCount(Card.GetCode)<5 then return end
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_CONFIRM)
local sg=g:SelectSubGroup(c:GetOwner(),aux.dncheck,false,5,5)
if #sg>0 then
Duel.ConfirmCards(1-c:GetOwner(),sg)
local tg=sg:RandomSelect(1-tp,2)
Duel.ConfirmCards(tp,tg)
Duel.ConfirmCards(1-tp,tg)
if g:GetCount()>0 then
local fid=c:GetFieldID()
local tc=tg:GetFirst()
while tc do
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_TRIGGER)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1,fid)
tc=tg:GetNext()
end
Duel.SpecialSummonComplete()
tg:KeepAlive()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(tg)
e1:SetCondition(cm.descon)
e1:SetOperation(cm.desop)
Duel.RegisterEffect(e1,tp)
end
Duel.ShuffleDeck(c:GetOwner())
end
end
function cm.desfilter(c,fid)
return c:GetFlagEffectLabel(m)==fid
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if not g:IsExists(cm.desfilter,1,nil,e:GetLabel()) then
g:DeleteGroup()
e:Reset()
return false
else return true end
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local tg=g:Filter(cm.desfilter,nil,e:GetLabel())
g:DeleteGroup()
Duel.Destroy(tg,REASON_EFFECT)
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439211
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.sptg2)
e1:SetOperation(cm.spop2)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.spfilter(c,e,tp)
return cm.Party_time(c) and c:IsType(TYPE_TRAP) and Duel.IsPlayerCanSpecialSummonMonster(tp,c:GetCode(),nil,TYPE_MONSTER+TYPE_NORMAL,2500,2500,5,RACE_AQUA,ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e,0,tp,true,true)
end
function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,e:GetHandler():GetOwner(),LOCATION_DECK)
end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(c:GetOwner(),LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(c:GetOwner(),cm.spfilter,c:GetOwner(),LOCATION_DECK,0,1,1,nil,e,c:GetOwner())
if g:GetCount()>0 then
local tg=g:GetFirst()
local e1=Effect.CreateEffect(tg)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(TYPE_NORMAL+TYPE_MONSTER)
e1:SetReset(RESET_EVENT+0x47c0000)
tg:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_ADD_RACE)
e2:SetValue(RACE_AQUA)
tg:RegisterEffect(e2,true)
local e3=e1:Clone()
e3:SetCode(EFFECT_ADD_ATTRIBUTE)
e3:SetValue(ATTRIBUTE_WATER)
tg:RegisterEffect(e3,true)
local e4=e1:Clone()
e4:SetCode(EFFECT_SET_BASE_ATTACK)
e4:SetValue(2500)
tg:RegisterEffect(e4,true)
local e5=e1:Clone()
e5:SetCode(EFFECT_SET_BASE_DEFENSE)
e5:SetValue(2500)
tg:RegisterEffect(e5,true)
local e6=e1:Clone()
e6:SetCode(EFFECT_CHANGE_LEVEL)
e6:SetValue(5)
tg:RegisterEffect(e6,true)
Duel.SpecialSummon(g,0,c:GetOwner(),c:GetOwner(),true,false,POS_FACEUP)
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439213
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(cm.sptg2)
e1:SetOperation(cm.spop2)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--atk limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,LOCATION_MZONE)
e3:SetValue(cm.atlimit)
c:RegisterEffect(e3)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.spfilter(c,e,tp)
return c:IsCode(m) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,e:GetHandler():GetOwner(),LOCATION_DECK)
end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
local fid=c:GetFieldID()
tc:RegisterFlagEffect(m,RESET_EVENT+RESET_TURN_SET+RESET_OVERLAY+RESET_MSCHANGE,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(m,5))
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetLabel(fid)
e3:SetLabelObject(tc)
e3:SetOperation(cm.spop3)
Duel.RegisterEffect(e3,c:GetOwner())
end
end
function cm.spop3(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if not eg:IsContains(tc) then return end
if tc:GetFlagEffectLabel(m)~=e:GetLabel() then
e:Reset()
return
end
Duel.Hint(HINT_CARD,0,m)
local tp=e:GetHandlerPlayer()
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
tc:ResetFlagEffect(m)
e:Reset()
end
function cm.atlimit(e,c)
return c~=e:GetHandler()
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439215
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.tgtg)
e1:SetOperation(cm.tgop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,e:GetHandler():GetOwner(),LOCATION_HAND+LOCATION_MZONE)
end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsType,c:GetOwner(),LOCATION_HAND+LOCATION_ONFIELD,0,nil,TYPE_MONSTER)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_TOGRAVE)
local sg=g:Select(c:GetOwner(),1,1,nil)
Duel.HintSelection(sg)
Duel.SendtoGrave(sg,REASON_RULE)
local og=Duel.GetOperatedGroup()
if not og or og:GetCount()<=0 then return false end
local tc=og:GetFirst()
local atk=tc:GetAttack()
local def=tc:GetDefense()
if atk>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetValue(atk/2)
e1:SetTarget(cm.atktg)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
if def>0 then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_DEFENSE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetValue(def/2)
e2:SetTarget(cm.atktg)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
end
end
function cm.atktg(e,c)
return cm.Party_time(c) and c:IsFaceup()
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439217
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_TOGRAVE+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.tgtg)
e1:SetOperation(cm.tgop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_TOHAND)
e3:SetDescription(aux.Stringid(m,2))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetTarget(cm.thtg)
e3:SetOperation(cm.thop)
c:RegisterEffect(e3)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.thfilter(c,lv)
return cm.Party_time(c) and c:IsAbleToHand() and c:IsType(TYPE_MONSTER) and c:IsLevel(lv)
end
function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_HAND)
end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(c:GetOwner(),aux.TRUE,c:GetOwner(),LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)>0 then
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_FACEUP)
local sg=Duel.SelectMatchingCard(c:GetOwner(),Card.IsFaceup,c:GetOwner(),LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.HintSelection(sg)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(5000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
sg:GetFirst():RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
sg:GetFirst():RegisterEffect(e2)
end
end
function cm.thfilter(c,tid)
return c:GetTurnID()==tid and not c:IsReason(REASON_RETURN) and c:IsAbleToHand()
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,0)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local tid=Duel.GetTurnCount()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,0,LOCATION_GRAVE,1,1,nil,tid)
if #g>0 then
Duel.SendtoHand(g:GetFirst(),nil,REASON_EFFECT)
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439219
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetOperation(cm.movop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.tgfilter(c)
return c:GetSequence()<5
end
function cm.movfilter1(c,seq,e)
return c:GetSequence()<seq and not c:IsImmuneToEffect(e)
end
function cm.movfilter2(c,seq,e)
return not c:IsImmuneToEffect(e)
end
function cm.movfilter3(c,seq,e)
return c:GetSequence()>seq and not c:IsImmuneToEffect(e) and c:GetSequence()<5
end
function cm.centerfilter1(c,e)
local seq=c:GetSequence()+1
local p=c:GetControler()
if seq>4 then
seq=seq-5
p=1-c:GetControler()
end
local tc=Duel.GetFieldCard(p,LOCATION_MZONE,seq)
return (not tc or tc:IsImmuneToEffect(e)) and not c:IsImmuneToEffect(e)
end
function cm.centerfilter2(c,e)
local seq=c:GetSequence()-1
local p=c:GetControler()
if seq<0 then
seq=seq+5
p=1-c:GetControler()
end
local tc=Duel.GetFieldCard(p,LOCATION_MZONE,seq)
return (not tc or tc:IsImmuneToEffect(e)) and not c:IsImmuneToEffect(e)
end
function cm.seqminc(g)
local minc=g:GetFirst()
local tc=g:GetFirst()
while tc do
if tc:GetSequence()<minc:GetSequence() then
minc=tc
end
tc=g:GetNext()
end
return minc
end
function cm.seqmaxc(g)
local maxc=g:GetFirst()
local tc=g:GetFirst()
while tc do
if tc:GetSequence()>maxc:GetSequence() then
maxc=tc
end
tc=g:GetNext()
end
return maxc
end
function cm.movop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)+Duel.GetLocationCount(1-tp,LOCATION_MZONE)==0 then
local g=Duel.GetMatchingGroup(cm.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
return false
end
if Duel.GetMatchingGroupCount(cm.centerfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e)<=0 and Duel.GetMatchingGroupCount(cm.centerfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e)<=0 then return false end
local op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,3),aux.Stringid(m,4))
if op==0 then
local cc=Duel.GetMatchingGroup(cm.centerfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e):GetFirst()
if not cc then return false end
local ctp=cc:GetControler()
local seq=cc:GetSequence()
local g1=Duel.GetMatchingGroup(cm.movfilter1,ctp,LOCATION_MZONE,0,nil,seq,e)
local g2=Duel.GetMatchingGroup(cm.movfilter2,ctp,0,LOCATION_MZONE,nil,seq,e)
local g3=Duel.GetMatchingGroup(cm.movfilter3,ctp,LOCATION_MZONE,0,nil,seq,e)
local finish=false
while not finish do
local mc=cc
if g3 and g3:GetCount()>0 then
mc=cm.seqminc(g3)
g3:RemoveCard(mc)
else
if g2 and g2:GetCount()>0 then
mc=cm.seqminc(g2)
g2:RemoveCard(mc)
else
if g1 and g1:GetCount()>0 then
mc=cm.seqminc(g1)
g1:RemoveCard(mc)
end
end
end
if mc==cc then finish=true end
local p=mc:GetControler()
local seq=mc:GetSequence()-1
if seq<0 then
seq=seq+5
p=1-mc:GetControler()
end
local zone=1<<seq
local tc=Duel.GetFieldCard(p,LOCATION_MZONE,seq)
if (p~=mc:GetControler() and not mc:IsControlerCanBeChanged(true))
or (Duel.GetMZoneCount(p,nil,mc:GetControler(),LOCATION_REASON_CONTROL,zone)<=0) then
Duel.SendtoGrave(mc,REASON_EFFECT)
else
if p==mc:GetControler() then
Duel.MoveSequence(mc,seq)
else
Duel.GetControl(mc,1-mc:GetControler(),0,0,zone)
end
end
end
else
local cc=Duel.GetMatchingGroup(cm.centerfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e):GetFirst()
if not cc then return false end
local ctp=cc:GetControler()
local seq=cc:GetSequence()
local g1=Duel.GetMatchingGroup(cm.movfilter3,ctp,LOCATION_MZONE,0,nil,seq,e)
local g2=Duel.GetMatchingGroup(cm.movfilter2,ctp,0,LOCATION_MZONE,nil,seq,e)
local g3=Duel.GetMatchingGroup(cm.movfilter1,ctp,LOCATION_MZONE,0,nil,seq,e)
local finish=false
while not finish do
local mc=cc
if g3 and g3:GetCount()>0 then
mc=cm.seqmaxc(g3)
g3:RemoveCard(mc)
else
if g2 and g2:GetCount()>0 then
mc=cm.seqmaxc(g2)
g2:RemoveCard(mc)
else
if g1 and g1:GetCount()>0 then
mc=cm.seqmaxc(g1)
g1:RemoveCard(mc)
end
end
end
if mc==cc then finish=true end
local p=mc:GetControler()
local seq=mc:GetSequence()+1
if seq>4 then
seq=seq-5
p=1-mc:GetControler()
end
local zone=1<<seq
local tc=Duel.GetFieldCard(p,LOCATION_MZONE,seq)
if (p~=mc:GetControler() and not mc:IsControlerCanBeChanged(true))
or (Duel.GetMZoneCount(p,nil,mc:GetControler(),LOCATION_REASON_CONTROL,zone)<=0) then
Duel.SendtoGrave(mc,REASON_EFFECT)
else
if p==mc:GetControler() then
Duel.MoveSequence(mc,seq)
else
Duel.GetControl(mc,1-mc:GetControler(),0,0,zone)
end
end
end
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439221
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--select
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_CONTROL+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.sltg)
e1:SetOperation(cm.slop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.sltg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_CONTROL,nil,1,tp,LOCATION_MZONE)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_HAND+LOCATION_DECK)
end
function cm.slop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD+LOCATION_HAND)>=8 then
local b1=Duel.GetFieldGroupCount(c:GetOwner(),0,LOCATION_DECK)>=5
local b2=Duel.GetFieldGroupCount(c:GetOwner(),0,LOCATION_HAND)>=2
local g3=Duel.GetMatchingGroup(Card.IsControlerCanBeChanged,c:GetOwner(),0,LOCATION_MZONE,nil)
local b3=g3:GetCount()>0
if not b1 and not b2 and not b3 then return end
local op=0
if b1 and not b2 and not b3 then op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,3))
elseif not b1 and b2 and not b3 then op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,4))+1
elseif not b1 and not b2 and b3 then op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,5))+2
elseif b1 and b2 and not b3 then op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,3),aux.Stringid(m,4))
elseif b1 and not b2 and b3 then op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,3),aux.Stringid(m,5)) if op==1 then op=2 end
elseif not b1 and b2 and b3 then op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,4),aux.Stringid(m,5))+1
else op=Duel.SelectOption(c:GetOwner(),aux.Stringid(m,3),aux.Stringid(m,4),aux.Stringid(m,5)) end
if op==0 then
local g=Duel.GetDecktopGroup(1-tp,5)
if #g>0 then
Duel.BreakEffect()
Duel.DisableShuffleCheck()
Duel.SendtoHand(g,c:GetOwner(),REASON_EFFECT)
end
elseif op==1 then
local g=Duel.GetFieldGroup(c:GetOwner(),0,LOCATION_HAND):RandomSelect(c:GetOwner(),2)
Duel.SendtoHand(g,c:GetOwner(),REASON_EFFECT)
else
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_CONTROL)
local g=g3:Select(c:GetOwner(),1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.GetControl(tc,c:GetOwner())
end
end
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439223
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--copy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(cm.cptg)
e1:SetOperation(cm.cpop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.cpfilter(c,e,tp,tid)
return c:GetTurnID()~=tid and not c:IsReason(REASON_RETURN) and ((c:IsType(TYPE_SPELL+TYPE_TRAP) and c:CheckActivateEffect(true,true,false)~=nil) or (c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
end
function cm.gcheck(g,ft)
return g:FilterCount(Card.IsType,nil,TYPE_MONSTER)<=ft
end
function cm.cptg(e,tp,eg,ep,ev,re,r,rp,chk)
local tid=Duel.GetTurnCount()
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and cm.cpfilter(chkc,e,tp,tid) end
if chk==0 then return true end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.GetMatchingGroup(cm.cpfilter,tp,0,LOCATION_GRAVE,nil,e,tp,tid)
if not g or #g==0 then return end
local b1=math.min(g:FilterCount(Card.IsType,nil,TYPE_MONSTER),ft)
local b2=g:FilterCount(Card.IsType,nil,TYPE_SPELL+TYPE_TRAP)
local ct=math.min(b1+b2,5)
local sg=g:SelectSubGroup(tp,cm.gcheck,false,ct,ct,ft)
Duel.SetTargetCard(sg)
local sumg=sg:Filter(Card.IsType,nil,TYPE_MONSTER)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sumg,#sumg,tp,LOCATION_GRAVE)
end
function cm.cpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tid=Duel.GetTurnCount()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if not g or #g==0 then return end
local g=g:Filter(Card.IsRelateToEffect,nil,e)
local sg=g:Filter(Card.IsType,nil,TYPE_MONSTER)
local cg=g:Filter(Card.IsType,nil,TYPE_SPELL+TYPE_TRAP)
if g:GetCount()>0 then
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if sg and sg:GetCount()>0 and ft>0 then
if sg:GetCount()>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
if sg:GetCount()>ft then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
sg=sg:Select(tp,ft,ft,nil)
end
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
if cg and cg:GetCount()>0 then
local tc=cg:GetFirst()
while tc do
Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
local te=tc:GetActivateEffect()
if not te then
else
local target=te:GetTarget()
local operation=te:GetOperation()
if tc:CheckActivateEffect(true,true,false)~=nil
and (not target or target(te,tp,eg,ep,ev,re,r,rp,0)) then
Duel.ClearTargetCard()
e:SetProperty(te:GetProperty())
tc:CreateEffectRelation(te)
if target then target(te,tp,eg,ep,ev,re,r,rp,1) end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:GetFirst()
while tg do
tg:CreateEffectRelation(te)
tg=g:GetNext()
end
if operation then operation(te,tp,eg,ep,ev,re,r,rp) end
tc:ReleaseEffectRelation(te)
tg=g:GetFirst()
while tg do
tg:ReleaseEffectRelation(te)
tg=g:GetNext()
end
end
end
tc=cg:GetNext()
end
end
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢穆克拉
local m=7439225
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--token
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetTarget(cm.tgtg)
e1:SetOperation(cm.tgop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon)
e5:SetTarget(cm.sptg)
e5:SetOperation(cm.spop)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EVENT_REMOVE)
c:RegisterEffect(e6)
end
function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,e:GetHandler():GetOwner(),LOCATION_HAND+LOCATION_MZONE)
end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsType,c:GetOwner(),LOCATION_HAND+LOCATION_ONFIELD,0,nil,TYPE_MONSTER)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,c:GetOwner(),HINTMSG_TOGRAVE)
local sg=g:Select(c:GetOwner(),1,3,nil)
Duel.HintSelection(sg)
Duel.SendtoGrave(sg,REASON_RULE)
local og=Duel.GetOperatedGroup()
if not og or og:GetCount()<=0 then return false end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_DRAW_COUNT)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN)
e1:SetValue(#og)
Duel.RegisterEffect(e1,c:GetOwner())
end
end
function cm.atktg(e,c)
return cm.Party_time(c) and c:IsFaceup()
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local b1=false
local b2=false
local b3=false
if re and re:GetHandler() then
b1=(pl==1-c:GetOwner())
end
if c:GetReasonCard() then
b2=(c:GetReasonCard():GetControler()==1-c:GetOwner())
end
if c:GetReasonEffect() and c:GetReasonEffect():GetHandler() then
b3=(c:GetReasonEffect():GetHandlerPlayer()==1-c:GetOwner())
end
return (c:GetReasonPlayer()==1-c:GetOwner() or b1 or b2 or b3) and (not (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE))
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
--派对狂欢海潮酒保
local m=7439301
local cm=_G["c"..m]
cm.named_with_party_time=1
function cm.Party_time(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_party_time
end
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,cm.filter,1)
c:EnableReviveLimit()
--cannot link material
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e0:SetValue(cm.lmlimit)
c:RegisterEffect(e0)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(cm.thcon)
e1:SetCost(cm.thcost)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(cm.spcon)
e2:SetTarget(cm.sptg)
e2:SetOperation(cm.spop)
c:RegisterEffect(e2)
end
function cm.lmlimit(e)
local c=e:GetHandler()
return c:IsStatus(STATUS_SPSUMMON_TURN) and c:IsSummonType(SUMMON_TYPE_LINK)
end
function cm.filter(c)
return cm.Party_time(c) and c:IsFaceup() and c:IsLinkType(TYPE_MONSTER) and not c:IsLinkType(TYPE_LINK)
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSequence()>4
end
function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,3,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,3,3,REASON_COST+REASON_DISCARD)
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_ONFIELD)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,tp,REASON_EFFECT)
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsSummonType(SUMMON_TYPE_LINK) and c:GetSequence()>4
end
function cm.spfilter(c,e,tp)
return cm.Party_time(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,1-tp,LOCATION_HAND)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
--local tg=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_HAND,0,nil,e,tp)
--if ft>0 and tg:GetCount()>0 then
-- if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
-- local g=tg:Select(tp,ft,ft,nil)
-- Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
--end
local ft2=Duel.GetLocationCount(1-tp,LOCATION_MZONE)
local tg2=Duel.GetMatchingGroup(cm.spfilter,1-tp,LOCATION_HAND,0,nil,e,1-tp)
if ft2>0 and tg2:GetCount()>0 then
if Duel.IsPlayerAffectedByEffect(1-tp,59822133) then ft2=1 end
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON)
local g2=tg2:Select(1-tp,ft2,ft2,nil)
Duel.SpecialSummon(g2,0,1-tp,1-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