Commit 39146df3 authored by Nemo Ma's avatar Nemo Ma

240908 wd

parent 01f1215c
......@@ -41,6 +41,14 @@
130002004 0
130002005 0
#WILD, I say WILD, WAHAHA
130006130 0
130006131 0
60010181 0
60010201 0
60010211 0
60010212 0
60010213 0
60010218 0
4058 0
575513 0
700021 0
......@@ -2160,6 +2168,7 @@
60362066 0
74920585 0
77103950 1
#240908
#240825
12847022 0
22348421 0
......
No preview for this file type
--雷光神姬 莱珊巴哈
function c130006130.initial_effect(c)
--Activate(summon)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCondition(c130006130.thcon)
e1:SetTarget(c130006130.thtg)
e1:SetOperation(c130006130.thop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--self destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_ADJUST)
e3:SetRange(LOCATION_MZONE)
e3:SetOperation(c130006130.sdop)
c:RegisterEffect(e3)
--go back
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_DESTROY)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_MOVE)
e5:SetCondition(c130006130.drcon)
e5:SetTarget(c130006130.drtg)
e5:SetOperation(c130006130.drop)
c:RegisterEffect(e5)
--retrieval
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_REMOVE)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCountLimit(1,130106130)
e4:SetTarget(c130006130.regtg)
e4:SetOperation(c130006130.regop)
c:RegisterEffect(e4)
if not c130006130.global_check then
c130006130.global_check=true
c130006130[0]={}
c130006130[1]={}
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(c130006130.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=ge1:Clone()
ge2:SetCode(EVENT_CHAIN_NEGATED)
ge2:SetOperation(c130006130.regop2)
Duel.RegisterEffect(ge2,0)
local ge4=Effect.CreateEffect(c)
ge4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge4:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge4:SetOperation(c130006130.clearop)
Duel.RegisterEffect(ge4,0)
end
end
function c130006130.spfilter(c,sp)
return c:GetSummonPlayer()==sp
end
function c130006130.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c130006130.spfilter,1,nil,1-tp)
end
function c130006130.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=3 end
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK)
end
function c130006130.thfilter(c)
return c:IsRace(RACE_PSYCHO) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c130006130.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then
local ct=Duel.GetMatchingGroupCount(Card.IsSummonType,tp,0,LOCATION_MZONE,nil,SUMMON_TYPE_SPECIAL)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
Duel.ConfirmDecktop(p,3)
local g=Duel.GetDecktopGroup(p,3)
if g:GetCount()>0 and g:IsExists(c130006130.thfilter,1,nil) and Duel.SelectYesNo(p,aux.Stringid(130006130,1)) then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND)
local sg=g:FilterSelect(p,c130006130.thfilter,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-p,sg)
Duel.ShuffleHand(p)
end
end
Duel.ShuffleDeck(p)
end
function c130006130.cfilter2(c)
return c:IsRace(RACE_PSYCHO) and c:IsFaceup()
end
function c130006130.sdop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase()
local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end
local sdg=Duel.GetMatchingGroup(c130006130.cfilter2,tp,LOCATION_MZONE,0,c)
if #sdg<=0 and Duel.Remove(c,POS_FACEUP,REASON_EFFECT+REASON_TEMPORARY)>0 and c:IsLocation(LOCATION_REMOVED) and not c:IsReason(REASON_REDIRECT) then
local fid=c:GetFieldID()
c:RegisterFlagEffect(130006130,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(130006130,0))
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetLabel(fid)
e1:SetLabelObject(c)
e1:SetOperation(c130006130.retop)
Duel.RegisterEffect(e1,tp)
end
end
function c130006130.retop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase()
local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end
local sdg=Duel.GetMatchingGroup(c130006130.cfilter2,tp,LOCATION_MZONE,0,nil)
if #sdg<=0 then return end
local c=e:GetLabelObject()
local flag=c:GetFlagEffectLabel(130006130)
if not flag or e:GetLabel()~=c:GetFieldID() then
e:Reset()
else
c:ResetFlagEffect(130006130)
Duel.ReturnToField(c)
e:Reset()
end
end
function c130006130.drcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsLocation(LOCATION_MZONE) and c:IsPreviousLocation(LOCATION_REMOVED) and not c:IsReason(REASON_SPSUMMON)
end
function c130006130.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c130006130.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.Destroy(g,REASON_EFFECT)
end
end
function c130006130.regtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c130006130.checkop(e,tp,eg,ep,ev,re,r,rp)
if re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsRace(RACE_PSYCHO) then
local rc=re:GetHandler():GetCode()
if c130006130[rp][rc] then c130006130[rp][rc]=c130006130[rp][rc]+1 else c130006130[rp][rc]=1 end
end
end
function c130006130.regop2(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler():GetCode()
if c130006130[rp][rc] then c130006130[rp][rc]=c130006130[rp][rc]-1 else c130006130[rp][rc]=nil end
end
function c130006130.clearop(e,tp,eg,ep,ev,re,r,rp)
c130006130[0]={}
c130006130[1]={}
end
function c130006130.spfilter1(c,rp)
local rc=c:GetCode()
return c:IsAbleToHand() and not c:IsCode(130006130) and c130006130[rp][rc]
end
function c130006130.regop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c130006130.spfilter1,tp,LOCATION_DECK,0,1,nil,tp) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=Duel.SelectMatchingCard(tp,c130006130.spfilter1,tp,LOCATION_DECK,0,1,1,nil,tp)
if tg:GetCount()<=0 then return end
Duel.SendtoHand(tg,nil,REASON_EFFECT)
end
end
--神曲的魔导书
function c130006131.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DISABLE+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_CHAINING)
e1:SetCost(c130006131.negcost)
e1:SetCondition(c130006131.negcon)
e1:SetTarget(c130006131.negtg)
e1:SetOperation(c130006131.negop)
c:RegisterEffect(e1)
if not c130006131.global_check then
c130006131.global_check=true
c130006131[0]={}
c130006131[1]={}
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(c130006131.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=ge1:Clone()
ge2:SetCode(EVENT_CHAIN_NEGATED)
ge2:SetOperation(c130006131.regop2)
Duel.RegisterEffect(ge2,0)
local ge4=Effect.CreateEffect(c)
ge4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge4:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge4:SetOperation(c130006131.clearop)
Duel.RegisterEffect(ge4,0)
end
--act qp/trap in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_QP_ACT_IN_NTPHAND)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_HAND,0)
e2:SetCondition(c130006131.handcon)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_TRAP_ACT_IN_HAND)
c:RegisterEffect(e3)
local e4=e2:Clone()
e4:SetCode(130006131)
c:RegisterEffect(e4)
--activate cost
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_ACTIVATE_COST)
e5:SetRange(LOCATION_MZONE)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1,0)
e5:SetCost(c130006131.costchk)
e5:SetTarget(c130006131.costtg)
e5:SetOperation(c130006131.costop)
c:RegisterEffect(e5)
--retrieval
local e6=Effect.CreateEffect(c)
e6:SetCategory(CATEGORY_REMOVE)
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_REMOVE)
e6:SetProperty(EFFECT_FLAG_DELAY)
e6:SetCountLimit(1,130106131)
e6:SetTarget(c130006131.regtg)
e6:SetOperation(c130006131.regop)
c:RegisterEffect(e6)
end
function c130006131.checkop(e,tp,eg,ep,ev,re,r,rp)
if re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsRace(RACE_PSYCHO) then
local rc=re:GetHandler():GetCode()
if c130006131[rp][rc] then c130006131[rp][rc]=c130006131[rp][rc]+1 else c130006131[rp][rc]=1 end
end
end
function c130006131.regop2(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler():GetCode()
if c130006131[rp][rc] then c130006131[rp][rc]=c130006131[rp][rc]-1 else c130006131[rp][rc]=nil end
end
function c130006131.clearop(e,tp,eg,ep,ev,re,r,rp)
c130006131[0]={}
c130006131[1]={}
end
function c130006131.spfilter1(c,rp)
local rc=c:GetCode()
return c:IsAbleToRemoveAsCost() and not c:IsCode(130006131) and c130006131[rp][rc]
end
function c130006131.spfilter2(c,rp)
local rc=c:GetCode()
return c:IsAbleToRemove() and c130006131[rp][rc]
end
function c130006131.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c130006131.spfilter1,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c130006131.spfilter1,tp,LOCATION_DECK,0,1,1,nil,tp)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c130006131.negcon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and Duel.IsChainDisablable(ev)
end
function c130006131.negtg(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)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
end
function c130006131.negop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateActivation(ev)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP)
end
function c130006131.handcon(e)
return e:GetHandler():IsAbleToRemove()
end
function c130006131.costtg(e,te,tp)
local tc=te:GetHandler()
return tc:IsLocation(LOCATION_HAND) and tc:GetEffectCount(130006131)>0
and ((tc:GetEffectCount(EFFECT_QP_ACT_IN_NTPHAND)<=tc:GetEffectCount(130006131) and tc:IsType(TYPE_QUICKPLAY))
or (tc:GetEffectCount(EFFECT_TRAP_ACT_IN_HAND)<=tc:GetEffectCount(130006131) and tc:IsType(TYPE_TRAP)))
end
function c130006131.costchk(e)
return e:GetHandler():IsAbleToRemove()
end
function c130006131.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Remove(c,POS_FACEUP,REASON_EFFECT)
end
function c130006131.regtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK)
end
function c130006131.regop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c130006131.spfilter2,tp,LOCATION_DECK,0,1,nil,tp) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local tg=Duel.SelectMatchingCard(tp,c130006131.spfilter2,tp,LOCATION_DECK,0,1,1,nil,tp)
if tg:GetCount()<=0 then return end
Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)
end
end
\ No newline at end of file
......@@ -52,9 +52,6 @@ function c28399984.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(sg,REASON_EFFECT)
end
end
function c28399984.cfilter(c,e,tp)
return c:IsSetCard(0x284) and c:IsType(TYPE_MONSTER) and (c:IsAbleToHand() or (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
end
function c28399984.spcon(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
return eg:IsContains(e:GetHandler()) and re:GetHandler():IsType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0x284)
......@@ -62,14 +59,17 @@ end
function c28399984.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA)
end
function c28399984.cfilter(c,e,tp)
return c:IsSetCard(0x284) and c:IsType(TYPE_MONSTER) and ((c:IsLocation(LOCATION_DECK) and c:IsAbleToHand()) or (c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (c:IsLocation(LOCATION_DECK) and Duel.GetMZoneCount(tp)>0 or c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0)))
end
function c28399984.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sc=Duel.SelectMatchingCard(tp,c28399984.cfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst()
local sc=Duel.SelectMatchingCard(tp,c28399984.cfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
if sc then
local b1=sc:IsAbleToHand()
local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and sc:IsCanBeSpecialSummoned(e,0,tp,false,false)
local b1=sc:IsLocation(LOCATION_DECK) and sc:IsAbleToHand()
local b2=sc:IsCanBeSpecialSummoned(e,0,tp,false,false) and (sc:IsLocation(LOCATION_DECK) and Duel.GetMZoneCount(tp)>0 or sc:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,sc)>0)
local op=0
if b1 and b2 then op=Duel.SelectOption(tp,1190,1152)
elseif b1 then op=0
......
--永夜抄EX·于黑暗中蠢动的光虫
local cm,m,o=GetID()
function cm.initial_effect(c)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,cm.matfilter,1,1)
--destroy
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,0))
e5:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1,m)
e5:SetTarget(cm.destg)
e5:SetOperation(cm.desop)
c:RegisterEffect(e5)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,1))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_GRAVE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCost(aux.bfgcost)
e4:SetCondition(aux.exccon)
e4:SetCountLimit(1,m+10000000)
e4:SetTarget(cm.sptg2)
e4:SetOperation(cm.spop2)
c:RegisterEffect(e4)
end
function cm.matfilter(c)
return c:IsLinkSetCard(0x3620) and c:IsLevel(4)
end
function cm.thfilter(c)
return c:IsSetCard(0x3620) and c:IsAbleToHand() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(nil,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler())
and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND+LOCATION_ONFIELD,0,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,aux.ExceptThisCard(e))
if g:GetCount()>0 and Duel.Destroy(g,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
end
function cm.spfilter(c,e,tp)
return c:IsSetCard(0x3620) and c:IsLevelBelow(8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and cm.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(cm.spfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cm.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
--永夜抄·蓬莱山辉夜
local cm,m,o=GetID()
function cm.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,2))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_GRAVE+LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,m)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(cm.destg)
e1:SetOperation(cm.desop)
c:RegisterEffect(e1)
--Activate
--removed
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROYED)
e1:SetOperation(cm.rmop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(cm.condition)
e2:SetTarget(cm.target2)
e2:SetOperation(cm.operation)
c:RegisterEffect(e2)
end
function cm.desfilter(c)
return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsSetCard(0x3620)
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and cm.desfilter(chkc,tp) end
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.IsExistingTarget(cm.desfilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,cm.desfilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil,tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsFacedown() then return end
e:GetHandler():RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(m)~=0
end
function cm.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(m+10000000)==0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():RegisterFlagEffect(m+10000000,RESET_EVENT+0x4760000+RESET_PHASE+PHASE_END,0,1)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT)
return
end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_ATTACK)
end
end
--永夜抄EX·不朽的弹幕
local cm,m,o=GetID()
function cm.initial_effect(c)
-- c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,cm.ffilter,3,true)
--special summon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetValue(aux.fuslimit)
c:RegisterEffect(e1)
--attack cost
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ATTACK_COST)
e1:SetCost(cm.atcost)
e1:SetOperation(cm.atop)
c:RegisterEffect(e1)
--summon,flip
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetOperation(cm.handes)
c:RegisterEffect(e1)
--destroy and summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(9950044,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,m)
e3:SetCondition(cm.spcon)
e3:SetCost(cm.spcost)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(cm.spcon2)
c:RegisterEffect(e4)
end
cm[0]=0
function cm.ffilter(c,fc,sub,mg,sg)
return c:IsFusionSetCard(0x3620) and (not sg or not sg:IsExists(Card.IsFusionCode,1,c,c:GetFusionCode()))
end
function cm.handes(e,tp,eg,ep,ev,re,r,rp)
local loc,id=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION,CHAININFO_CHAIN_ID)
if ep==tp or loc~=LOCATION_MZONE or id==cm[0] or not re:IsActiveType(TYPE_MONSTER) then return end
cm[0]=id
if Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 and Duel.SelectYesNo(1-tp,aux.Stringid(m,0)) then
Duel.DiscardHand(1-tp,aux.TRUE,1,1,REASON_EFFECT+REASON_DISCARD,nil)
Duel.BreakEffect()
else Duel.NegateEffect(ev) end
end
function cm.atcost(e,c,tp)
return Duel.CheckReleaseGroup(1-tp,nil,1,e:GetHandler())
end
function cm.atop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectReleaseGroup(1-tp,nil,1,1,e:GetHandler())
Duel.Release(g,REASON_COST)
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT)
and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function cm.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsReason(REASON_BATTLE+REASON_EFFECT)
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,800) end
Duel.PayLPCost(tp,800)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
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 cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_ATTACK)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(800)
c:RegisterEffect(e1)
end
end
--不死组·蓬莱山辉夜
local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_DRAW_PHASE+TIMING_CHAIN_END+TIMING_END_PHASE)
e1:SetRange(LOCATION_HAND+LOCATION_MZONE)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,m)
e2:SetTarget(cm.target2)
e2:SetOperation(cm.operation2)
c:RegisterEffect(e2)
local e4=e2:Clone()
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e4)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,m)
e3:SetCondition(cm.spcon)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
local e5=e3:Clone()
e5:SetCode(EVENT_SUMMON_SUCCESS)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(cm.spcon2)
c:RegisterEffect(e5)
end
function cm.filter1(c,e)
return c:IsLocation(LOCATION_HAND+LOCATION_MZONE) and not c:IsImmuneToEffect(e)
end
function cm.filter2(c,e,tp,m,f,gc,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c)) and c:IsSetCard(0x3620)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,gc,chkf)
and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsLocation,nil,LOCATION_HAND+LOCATION_MZONE)
local res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,c,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,c,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local chkf=tp
if not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end
local mg1=Duel.GetFusionMaterial(tp):Filter(cm.filter1,nil,e)
local sg1=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,c,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,c,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,c,chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,c,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
-----
function cm.filter(c)
return c:IsSetCard(0x3620) and c:IsType(TYPE_SPELL+TYPE_TRAP) and not c:IsCode(m) and c:IsAbleToHand()
end
function cm.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.operation2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
-----------
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT)
and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function cm.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsReason(REASON_BATTLE+REASON_EFFECT)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
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 cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_ATTACK)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(0)
c:RegisterEffect(e1)
end
end
\ No newline at end of file
--不死组·藤原妹红
local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.hsptg)
e1:SetOperation(cm.hspop)
c:RegisterEffect(e1)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,m)
e3:SetCondition(cm.spcon)
e3:SetCost(cm.spcost)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(cm.spcon2)
c:RegisterEffect(e4)
--ritual summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,2))
e2:SetCategory(CATEGORY_RELEASE+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_HAND+LOCATION_MZONE)
e2:SetTarget(cm.rstg)
e2:SetOperation(cm.rsop)
c:RegisterEffect(e2)
end
function cm.cfilter(c)
return true
end
function cm.hsptg(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)
and Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.hspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
if Duel.Destroy(Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil),REASON_EFFECT) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
----
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT)
and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function cm.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsReason(REASON_BATTLE+REASON_EFFECT)
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,800) end
Duel.PayLPCost(tp,800)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
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 cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_ATTACK)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(800)
c:RegisterEffect(e1)
end
end
function cm.rfilter(c,e,tp)
return c:IsSetCard(0x3620)
end
function cm.rcheck(gc)
return function(tp,g,c)
return g:IsContains(gc)
end
end
function cm.rstg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local mg=Duel.GetRitualMaterial(tp)
aux.RCheckAdditional=cm.rcheck(c)
local res=mg:IsContains(c) and Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,cm.rfilter,e,tp,mg,nil,Card.GetLevel,"Greater")
aux.RCheckAdditional=nil
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local mg=Duel.GetRitualMaterial(tp)
if c:GetControler()~=tp or not c:IsRelateToEffect(e) or not mg:IsContains(c) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
aux.RCheckAdditional=cm.rcheck(c)
local tg=Duel.SelectMatchingCard(tp,aux.RitualUltimateFilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,cm.rfilter,e,tp,mg,nil,Card.GetLevel,"Greater")
local tc=tg:GetFirst()
if tc then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,tc,tp)
else
mg:RemoveCard(tc)
end
if not mg:IsContains(c) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
Duel.SetSelectedCard(c)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then
aux.RCheckAdditional=nil
return
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
end
aux.RCheckAdditional=nil
end
\ No newline at end of file
--永夜抄·普通的黑魔术少女
local cm,m,o=GetID()
function cm.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c)
--negate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,m)
e1:SetCost(cm.expcost)
e1:SetOperation(cm.expop)
c:RegisterEffect(e1)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,2))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_EXTRA+LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,m)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(cm.destg)
e1:SetOperation(cm.desop)
c:RegisterEffect(e1)
--destroy and summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,m+10000000)
e3:SetCondition(cm.spcon)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(cm.spcon2)
c:RegisterEffect(e4)
end
function cm.expfil(c)
return c:IsType(TYPE_RITUAL) and c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost()
end
function cm.expcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(cm.expfil,tp,LOCATION_HAND+LOCATION_GRAVE,0,nil)
if chk==0 then return #g>0 end
local rc=g:Select(tp,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function cm.expop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCountLimit(1,m+20000000)
e2:SetValue(cm.pendvalue)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
function cm.pendvalue(e,c)
return c:IsSetCard(0x3620)
end
function cm.desfilter(c)
return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsSetCard(0x3620)
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and cm.desfilter(chkc,tp) end
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.IsExistingTarget(cm.desfilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,cm.desfilter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil,tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT)
and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function cm.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsReason(REASON_BATTLE+REASON_EFFECT)
end
function cm.filter2(c)
return c:IsSetCard(0x3620) and c:IsRace(RACE_SPELLCASTER) and not c:IsCode(m) and c:IsAbleToHand()
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter2,tp,LOCATION_DECK,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
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