Commit 3ac0bc4c authored by POLYMER's avatar POLYMER

fix

parent e6014122
No preview for this file type
No preview for this file type
--光铸之圣域-天界城
local cm,m=GetID()
function cm.initial_effect(c)
--activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetRange(LOCATION_FZONE)
e1:SetCountLimit(1,m)
e1:SetCondition(cm.adcon)
e1:SetCost(cm.adcost)
e1:SetTarget(cm.adtg)
e1:SetOperation(cm.adop)
c:RegisterEffect(e1)
local e4=e1:Clone()
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e4)
--opspsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e2:SetCondition(cm.adcon2)
e2:SetTarget(cm.adtg2)
e2:SetOperation(cm.adop2)
c:RegisterEffect(e2)
local e5=e2:Clone()
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e5)
--release replace
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,2))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetRange(LOCATION_FZONE)
e3:SetCode(EFFECT_SEND_REPLACE)
e3:SetTarget(cm.reptg)
e3:SetValue(function(e,c) return c:GetFlagEffect(m)>0 end)
c:RegisterEffect(e3)
end
function cm.filter(c,tp)
return c:IsControler(tp)
end
function cm.adcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.filter,1,nil,1-tp)
end
function cm.adcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(Card.IsPublic,tp,LOCATION_HAND,0,nil)
if chk==0 then return #g>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sc=g:Select(tp,1,1,nil):GetFirst()
sc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
sc:ResetFlagEffect(9822220)
local eset={sc:IsHasEffect(EFFECT_PUBLIC)}
if #eset>0 then
for _,ae in pairs(eset) do
if ae:IsHasType(EFFECT_TYPE_SINGLE) then
ae:Reset()
else
local tg=ae:GetTarget() or aux.TRUE
ae:SetTarget(function(e,c,...) return tg(e,c,...) and c:GetFlagEffect(m)==0 end)
end
end
end
end
function cm.adtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.Hint(HINT_OPSELECTED,tp,e:GetDescription())
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function cm.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(7)
end
function cm.adop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end
end
function cm.adcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.filter,1,nil,tp)
end
function cm.adtg2(e,tp,eg,ep,ev,re,r,rp,chk)
local att=ATTRIBUTE_ALL
if Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)==0 then
att=0
for i=1,7 do
if Duel.IsExistingMatchingCard(cm.spfilter2,tp,0,LOCATION_GRAVE,1,nil,e,1-tp,1<<i) then att=att|(1<<i) end
end
end
if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and att>0 and Duel.IsPlayerCanSpecialSummon(1-tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE)
local aat=Duel.AnnounceAttribute(tp,1,att)
e:SetLabel(aat)
Duel.Hint(HINT_OPSELECTED,tp,e:GetDescription())
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,1-tp,LOCATION_HAND+LOCATION_GRAVE)
end
function cm.spfilter2(c,e,tp,att)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e1:SetValue(att)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD)
c:RegisterEffect(e1,true)
--Duel.AdjustAll()
local res=c:IsCanBeSpecialSummoned(e,0,tp,false,false)
e1:Reset()
return res
end
function cm.adop2(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or Duel.GetLocationCount(1-tp,LOCATION_MZONE)<=0 then return end
local att=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON)
local g=Duel.GetMatchingGroup(cm.spfilter2,tp,0,LOCATION_HAND,nil,e,1-tp,att)
if #g==0 then g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.spfilter2),tp,0,LOCATION_GRAVE,nil,e,1-tp,att) end
local sg=g:Select(1-tp,1,1,nil)
if #sg>0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e1:SetValue(att)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD)
sg:GetFirst():RegisterEffect(e1)
--Duel.AdjustAll()
Duel.SpecialSummon(sg,0,1-tp,1-tp,false,false,POS_FACEUP)
end
end
function cm.filter2(c,re,tp,r)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsReason(REASON_RELEASE) and bit.band(r,REASON_COST)~=0 and re and aux.GetValueType(re)=="Effect" and re:IsActivated() and re:GetHandler()==c and re:GetHandlerPlayer()==tp
end
function Group.ForEach(group,func,...)
if aux.GetValueType(group)=="Group" and group:GetCount()>0 then
local d_group=group:Clone()
for tc in aux.Next(d_group) do
func(tc,...)
end
end
end
function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return eg:IsExists(cm.filter2,1,nil,re,tp,r) end
if e:GetHandler():IsReleasable() and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
local g=eg:Filter(cm.filter2,nil,re,tp,r)
g:ForEach(Card.RegisterFlagEffect,m,RESET_CHAIN,0,1)
Duel.Release(e:GetHandler(),REASON_COST)
return true
else return false end
end
\ No newline at end of file
--光铸之结界-天之壁
local cm,m=GetID()
function cm.initial_effect(c)
--activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e1:SetCondition(cm.adcon)
e1:SetTarget(cm.adtg)
e1:SetOperation(cm.adop)
c:RegisterEffect(e1)
local e4=e1:Clone()
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e4)
--opspsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1,m)
e2:SetCondition(cm.adcon2)
e2:SetTarget(cm.adtg2)
e2:SetOperation(cm.adop2)
c:RegisterEffect(e2)
local e5=e2:Clone()
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(m)
e6:SetRange(LOCATION_DECK)
c:RegisterEffect(e6)
if not cm.global_check then
cm.global_check=true
local ge0=Effect.CreateEffect(c)
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_CHAINING)
ge0:SetOperation(function() Duel.ResetFlagEffect(0,m) end)
Duel.RegisterEffect(ge0,0)
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD)
ge1:SetCode(EFFECT_ACTIVATE_COST)
ge1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ge1:SetTargetRange(1,1)
ge1:SetOperation(function() Duel.RegisterFlagEffect(0,m,RESET_CHAIN,0,1) end)
Duel.RegisterEffect(ge1,0)
local _RegisterEffect=Card.RegisterEffect
function Card.RegisterEffect(c,e,bool)
local tp=c:GetControler()
local extg=Duel.GetMatchingGroup(cm.extfilter,tp,LOCATION_DECK,0,nil)
local hg=Duel.GetMatchingGroup(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,nil)
if Duel.GetFlagEffect(0,m)>0 and Duel.GetFlagEffect(1,m)>0 and Duel.IsPlayerAffectedByEffect(1,EFFECT_FLAG_EFFECT+m):GetLabelObject() and Duel.IsPlayerAffectedByEffect(1,EFFECT_FLAG_EFFECT+m):GetLabel()==Duel.GetCurrentChain() then
return 0
elseif c:IsLocation(LOCATION_HAND) and e:GetCode()==EFFECT_PUBLIC and e:IsHasType(EFFECT_TYPE_SINGLE) and #extg>0 and c:IsAbleToGraveAsCost() and Duel.GetFlagEffect(0,m)>0 and Duel.SelectEffectYesNo(tp,c,aux.Stringid(m,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=extg:GetFirst()
if #extg>1 then tc=extg:Select(tp,1,1,nil):GetFirst() end
local tc2=c --hg:GetFirst()
--if #hg>1 then tc2=hg:Select(tp,1,1,nil):GetFirst() end
if tc and tc2 then
Duel.RegisterFlagEffect(1,m,RESET_CHAIN,0,1)
Duel.IsPlayerAffectedByEffect(1,EFFECT_FLAG_EFFECT+m):SetLabel(Duel.GetCurrentChain())
Duel.Hint(HINT_CARD,0,m)
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
Duel.ConfirmCards(1-tp,c)
Duel.SendtoGrave(Group.FromCards(tc,tc2),REASON_EFFECT)
return 0
end
end
return _RegisterEffect(c,e,bool)
end
end
end
function cm.extfilter(c)
return c:IsHasEffect(m) and c:IsAbleToGraveAsCost()
end
function cm.filter(c,tp)
return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
end
function cm.adcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.filter,1,nil,1-tp)
end
function cm.adtg(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 Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) and c:GetFlagEffect(m)==0 end
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
Duel.Hint(HINT_OPSELECTED,tp,e:GetDescription())
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function cm.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsLevel(7)
end
function cm.adop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_HAND,0,nil,e,tp)
if #g==0 then g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp) end
local sg=g:Select(tp,1,1,nil)
if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end
end
function cm.adcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.filter,1,nil,tp)
end
function cm.sfilter(c)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(1) and c:IsType(TYPE_TUNER)
end
function cm.cfilter(c,syn,tp)
local g=aux.GetSynMaterials(tp,syn)
g:AddCard(c)
return syn:IsSynchroSummonable(c,g)
end
function cm.scfilter(c,mg,tp)
return mg:IsExists(cm.cfilter,1,nil,c,tp)
end
function cm.adtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_DECK,0,nil)
return eg:IsExists(cm.filter,1,nil,tp) --Duel.IsExistingMatchingCard(cm.scfilter,tp,LOCATION_EXTRA,0,1,nil,mg,tp)
end
Duel.Hint(HINT_OPSELECTED,tp,e:GetDescription())
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
--Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.adop2(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(cm.filter,nil,tp)
if #g>0 then
local tc=g:GetFirst()
if #g>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
tc=g:Select(tp,1,1,nil):GetFirst()
end
Duel.HintSelection(Group.FromCards(tc))
--destroy
local e5=Effect.CreateEffect(e:GetHandler())
e5:SetDescription(aux.Stringid(m,4))
e5:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e5:SetCode(EVENT_LEAVE_FIELD)
e5:SetOwnerPlayer(tp)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e5:SetOperation(cm.desop)
tc:RegisterEffect(e5,true)
end
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetOwnerPlayer()
local mg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_DECK,0,nil)
if #mg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=mg:Select(tp,1,1,nil)
Duel.SendtoHand(tg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tg)
end
e:Reset()
end
function cm.adop22(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_DECK,0,nil)
local g=Duel.GetMatchingGroup(cm.scfilter,tp,LOCATION_EXTRA,0,nil,mg,tp)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local tg=mg:FilterSelect(tp,cm.cfilter,1,1,nil,sg:GetFirst(),tp)
Duel.SynchroSummon(tp,sg:GetFirst(),tg:GetFirst())
end
end
\ No newline at end of file
--终烬圣殿
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetOperation(s.actop)
c:RegisterEffect(e0)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_FZONE)
e1:SetCountLimit(1)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
--summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1)
e2:SetTarget(s.sumtg)
e2:SetOperation(s.sumop)
c:RegisterEffect(e2)
--place counter
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_COUNTER)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
--e3:SetCondition(s.ctcon)
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.actop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.thfilter(c,tp)
return c:IsSetCard(0x5f51) and c:IsAbleToHand()
and not Duel.IsExistingMatchingCard(function(sc) return sc:IsFaceup() and sc:IsCode(c:GetCode()) end,tp,LOCATION_ONFIELD,0,1,nil)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function s.sumfilter(c)
return c:IsSetCard(0x5f51) and c:IsSummonable(true,nil)
end
function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.sumfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function s.sumop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,s.sumfilter,tp,LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil)
end
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
--终烬圣域
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetOperation(s.actop)
c:RegisterEffect(e0)
--no damage
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_SZONE)
e1:SetTargetRange(1,0)
e1:SetValue(s.damval)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_NO_EFFECT_DAMAGE)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
--place counter
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_COUNTER)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(s.ctcon)
e4:SetTarget(s.cttg)
e4:SetOperation(s.ctop)
c:RegisterEffect(e4)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.actop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.damfilter(c)
return c:IsSetCard(0x5f51) and not c:IsCode(id)
end
function s.damval(e,re,val,r,rp,rc)
if Duel.IsExistingMatchingCard(s.damfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) then
return 0
else
return val
end
end
function s.thfilter(c)
return c:IsCode(17338780) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_SZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬圣典
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetOperation(s.actop)
e0:SetTarget(s.target)
c:RegisterEffect(e0)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PREDRAW)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.thcon2)
e2:SetCost(s.thcost2)
e2:SetTarget(s.thtg2)
e2:SetOperation(s.thop2)
c:RegisterEffect(e2)
--place counter
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_COUNTER)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.ctcon)
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.actop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
-- 这张卡发动的场合,自己的基本分不是1的场合,自己的基本分变成1
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
-- 检索效果
local check=Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_MZONE,0,1,nil,0x5f51)
local b1=Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.thfilter1),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil)
local b2=check and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.thfilter2),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil)
if not (b1 or b2) then return end
local op=0
if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,3))
elseif b1 then
op=0
else
op=1
end
if op==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter1),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter2),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
-- 这张卡的效果发动后,直到回合结束时自己不是「终烬」怪兽不能召唤·特殊召唤
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.thfilter1(c)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function s.thfilter2(c)
return c:IsSetCard(0x5f51) and (c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP)) and c:IsAbleToHand()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local check=Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_MZONE,0,1,nil,0x5f51)
return Duel.IsExistingMatchingCard(s.thfilter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil)
or (check and Duel.IsExistingMatchingCard(s.thfilter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil))
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function s.thcon2(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0
end
function s.thcost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.IsPlayerCanNormalDraw(tp) end
aux.GiveUpNormalDraw(e,tp)
end
function s.thtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function s.thop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,c)
end
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_SZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬使命
local s,id=GetID()
function s.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(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_LEAVE_GRAVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DESTROYED)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.setcon)
e2:SetTarget(s.settg)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
--place counter
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_COUNTER)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.ctcon)
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.thfilter(c)
return c:IsSetCard(0x5f51) and c:IsAbleToHand()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
s.lpop(e,tp,eg,ep,ev,re,r,rp)
end
function s.cfilter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsPreviousLocation,1,nil,LOCATION_ONFIELD)
and eg:IsExists(Card.IsPreviousControler,1,nil,tp)
and e:GetHandler():IsLocation(LOCATION_GRAVE)
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsSSetable() end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsSSetable() then
Duel.SSet(tp,c)
end
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_SZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬焚灭
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(s.actop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
--Set
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_LEAVE_GRAVE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_GRAVE)
e3:SetCondition(s.setcon)
e3:SetTarget(s.settg)
e3:SetOperation(s.setop)
c:RegisterEffect(e3)
--place counter
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,2))
e4:SetCategory(CATEGORY_COUNTER)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(s.ctcon)
e4:SetTarget(s.cttg)
e4:SetOperation(s.ctop)
c:RegisterEffect(e4)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.actop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,0,1,nil)
and Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,2,0,0)
end
function s.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 g1=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1)
g1:Merge(g2)
if g1:GetCount()>0 then
Duel.HintSelection(g1)
Duel.Destroy(g1,REASON_EFFECT)
end
end
function s.cfilter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsPreviousControler(1-tp) and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsPreviousLocation,1,nil,LOCATION_ONFIELD)
and eg:IsExists(Card.IsPreviousControler,1,nil,1-tp)
and e:GetHandler():IsLocation(LOCATION_GRAVE)
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsSSetable() end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsSSetable() then
Duel.SSet(tp,c)
end
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_SZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬骑士
local s,id=GetID()
function s.initial_effect(c)
--Cannot Special Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--Summon LP Change
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(s.lpop)
c:RegisterEffect(e1)
--Summon without tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,2))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetCondition(s.ntcon)
c:RegisterEffect(e2)
--Search and destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
--Record counter on leave
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_LEAVE_FIELD_P)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetOperation(s.regop)
c:RegisterEffect(e4)
--Place counters when destroyed
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,1))
e5:SetCategory(CATEGORY_COUNTER)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(s.ctcon)
e5:SetTarget(s.cttg)
e5:SetOperation(s.ctop)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(Card.IsSetCard,c:GetControler(),LOCATION_ONFIELD,0,1,nil,0x5f51)
end
function s.thfilter(c,tp)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
and not Duel.IsExistingMatchingCard(function(sc) return sc:IsFaceup() and sc:IsCode(c:GetCode()) end,tp,LOCATION_ONFIELD,0,1,nil)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,0,LOCATION_ONFIELD)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp)
if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then
Duel.ConfirmCards(1-tp,g)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if #dg>0 then
Duel.HintSelection(dg)
Duel.Destroy(dg,REASON_EFFECT)
end
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x1f51)
e:SetLabel(ct)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabelObject():GetLabel()
e:SetLabel(ct)
return (c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)) and c:IsPreviousLocation(LOCATION_MZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
local ct=e:GetLabel()
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,ct+1,0,0x1f51)
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
local ct=e:GetLabel()
local addct=ct+1
if addct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,addct)
end
end
end
end
\ No newline at end of file
--终烬贤士
local s,id=GetID()
function s.initial_effect(c)
--Cannot Special Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--Summon LP Change
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(s.lpop)
c:RegisterEffect(e1)
--Summon without tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,2))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetCondition(s.ntcon)
c:RegisterEffect(e2)
--Search and destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
--Record counter on leave
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_LEAVE_FIELD_P)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetOperation(s.regop)
c:RegisterEffect(e4)
--Place counters when destroyed
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,1))
e5:SetCategory(CATEGORY_COUNTER)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(s.ctcon)
e5:SetTarget(s.cttg)
e5:SetOperation(s.ctop)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(Card.IsSetCard,c:GetControler(),LOCATION_ONFIELD,0,1,nil,0x5f51)
end
function s.thfilter(c,tp)
return c:IsSetCard(0x5f51) and (c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP)) and c:IsAbleToHand()
and not Duel.IsExistingMatchingCard(function(sc) return sc:IsFaceup() and sc:IsCode(c:GetCode()) end,tp,LOCATION_ONFIELD,0,1,nil)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,0,LOCATION_ONFIELD)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp)
if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then
Duel.ConfirmCards(1-tp,g)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if #dg>0 then
Duel.HintSelection(dg)
Duel.Destroy(dg,REASON_EFFECT)
end
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x1f51)
e:SetLabel(ct)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabelObject():GetLabel()
e:SetLabel(ct)
return (c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)) and c:IsPreviousLocation(LOCATION_MZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
local ct=e:GetLabel()
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,ct+1,0,0x1f51)
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
local ct=e:GetLabel()
local addct=ct+1
if addct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,addct)
end
end
end
end
\ No newline at end of file
--终烬使徒
local s,id=GetID()
function s.initial_effect(c)
--Cannot Special Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--Summon LP Change
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(s.lpop)
c:RegisterEffect(e1)
--Summon from hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.sumcon)
e2:SetTarget(s.sumtg)
e2:SetOperation(s.sumop)
c:RegisterEffect(e2)
--Cannot be target
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(s.atkcon)
e3:SetValue(aux.imval1)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e4:SetValue(aux.tgoval)
c:RegisterEffect(e4)
--Place counters
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,1))
e5:SetCategory(CATEGORY_COUNTER)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1)
e5:SetTarget(s.cttg)
e5:SetOperation(s.ctop)
c:RegisterEffect(e5)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.cfilter(c)
return c:IsSetCard(0x5f51) and c:IsFaceup()
end
function s.sumcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil)
end
function s.sumtg(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 s.sumop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.Summon(tp,c,true,nil)
end
end
function s.atkfilter(c)
return c:IsSetCard(0x5f51) and not c:IsCode(id)
end
function s.atkcon(e)
return Duel.IsExistingMatchingCard(s.atkfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsCanAddCounter(0x1f51,1) end
local ct=math.min(Duel.GetTurnCount(),10) -- 限制最大数量为10,避免过大
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,ct,0,0x1f51)
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local ct=math.min(Duel.GetTurnCount(),10) -- 限制最大数量为10
c:AddCounter(0x1f51,ct)
end
end
\ No newline at end of file
--终烬神
local s,id=GetID()
function s.initial_effect(c)
--Cannot Special Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--Normal summon with 1 "终烬" tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(s.otcon)
e1:SetOperation(s.otop)
e1:SetValue(SUMMON_TYPE_ADVANCE)
c:RegisterEffect(e1)
--Additional summon (does not use normal summon)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.sumcon)
e2:SetTarget(s.sumtg)
e2:SetOperation(s.sumop)
c:RegisterEffect(e2)
--Summon LP Change and restrictions
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetOperation(s.lpop)
c:RegisterEffect(e3)
--Cannot be targeted or destroyed
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetValue(1)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_MZONE)
e5:SetValue(1)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e6:SetRange(LOCATION_MZONE)
e6:SetValue(1)
c:RegisterEffect(e6)
--Main effect
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(id,2))
e7:SetCategory(CATEGORY_DECKDES+CATEGORY_SPECIAL_SUMMON+CATEGORY_DISABLE)
e7:SetType(EFFECT_TYPE_QUICK_O)
e7:SetCode(EVENT_FREE_CHAIN)
e7:SetRange(LOCATION_MZONE)
e7:SetCountLimit(1)
e7:SetTarget(s.efftg)
e7:SetOperation(s.effop)
c:RegisterEffect(e7)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.otcon(e,c,minc)
if c==nil then return true end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(s.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
return c:IsLevelAbove(7) and minc<=1 and mg:GetCount()>=1
end
function s.otop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(s.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=mg:Select(tp,1,1,nil)
c:SetMaterial(sg)
Duel.Release(sg,REASON_SUMMON+REASON_MATERIAL)
end
function s.otfilter(c,tp)
return c:IsSetCard(0x5f51) and c:IsReleasable() and (c:IsControler(tp) or c:IsFaceup())
end
function s.sumcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.otfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.sumtg(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 s.sumop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.Summon(tp,c,true,nil)
end
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetCounter(tp,1,0,0x1f51)
local flag=false
local numbers={}
for i=1,ct do
if Duel.IsCanRemoveCounter(tp,1,0,0x1f51,i,REASON_COST) and Duel.GetFieldGroupCount(1-tp,LOCATION_DECK,0)>=i then
table.insert(numbers,i)
flag=true
end
end
if chk==0 then
return flag
end
if #numbers>0 then
if #numbers>1 then
ct=Duel.AnnounceNumber(tp,table.unpack(numbers))
else
ct=numbers[1]
end
Duel.RemoveCounter(tp,1,0,0x1f51,ct,REASON_COST)
e:SetLabel(ct)
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,1-tp,ct)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0x5f51) and not c:IsCode(17338860) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function s.effop(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabel()
if ct<=0 then return end
--Destroy cards from top of opponent's deck
local g=Duel.GetDecktopGroup(1-tp,ct)
if #g>0 then
Duel.DisableShuffleCheck()
Duel.Destroy(g,REASON_EFFECT)
--Register the destroyed cards for negation
local tc=g:GetFirst()
while tc do
local code=tc:GetOriginalCodeRule()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetTarget(s.distg)
e1:SetLabel(code)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetCondition(s.discon)
e2:SetOperation(s.disop)
e2:SetLabel(code)
e2:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e2,tp)
tc=g:GetNext()
end
--Special summon
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp)
and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if #sg>0 then
Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP)
end
end
end
end
function s.distg(e,c)
return c:IsOriginalCodeRule(e:GetLabel())
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsOriginalCodeRule(e:GetLabel())
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
\ No newline at end of file
--终烬祭司
local s,id=GetID()
function s.initial_effect(c)
--Cannot Special Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--Summon LP Change
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(s.lpop)
c:RegisterEffect(e1)
--Summon without tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,2))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetCondition(s.ntcon)
c:RegisterEffect(e2)
--Search and destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
--Record counter on leave
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_LEAVE_FIELD_P)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetOperation(s.regop)
c:RegisterEffect(e4)
--Place counters when destroyed
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,1))
e5:SetCategory(CATEGORY_COUNTER)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(s.ctcon)
e5:SetTarget(s.cttg)
e5:SetOperation(s.ctop)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.ntfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51)
end
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
and not Duel.IsExistingMatchingCard(aux.NOT(s.ntfilter),c:GetControler(),LOCATION_MZONE,0,1,nil)
end
function s.thfilter(c,tp)
return c:IsSetCard(0x5f51) and c:IsAbleToHand()
and not Duel.IsExistingMatchingCard(function(sc) return sc:IsFaceup() and sc:IsCode(c:GetCode()) end,tp,LOCATION_ONFIELD,0,1,nil)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_ONFIELD)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp)
if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then
Duel.ConfirmCards(1-tp,g)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,0,1,1,nil)
if #dg>0 then
Duel.HintSelection(dg)
Duel.Destroy(dg,REASON_EFFECT)
end
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x1f51)
e:SetLabel(ct)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabelObject():GetLabel()
e:SetLabel(ct)
return (c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)) and c:IsPreviousLocation(LOCATION_MZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
local ct=e:GetLabel()
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,ct+1,0,0x1f51)
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
local ct=e:GetLabel()
local addct=ct+1
if addct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,addct)
end
end
end
end
\ No newline at end of file
--终烬帝王
local s,id=GetID()
function s.initial_effect(c)
--Cannot Special Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--Summon LP Change
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(s.lpop)
c:RegisterEffect(e1)
--Summon without tribute
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,2))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SUMMON_PROC)
e2:SetCondition(s.ntcon)
c:RegisterEffect(e2)
--Special summon from grave and destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
--Record counter on leave
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_LEAVE_FIELD_P)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetOperation(s.regop)
c:RegisterEffect(e4)
--Place counters when destroyed
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,1))
e5:SetCategory(CATEGORY_COUNTER)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(s.ctcon)
e5:SetTarget(s.cttg)
e5:SetOperation(s.ctop)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.ntfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51)
end
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
and not Duel.IsExistingMatchingCard(aux.NOT(s.ntfilter),c:GetControler(),LOCATION_MZONE,0,1,nil)
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0x5f51) and not c:IsCode(17338880) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_ONFIELD)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g>0 and Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,0,1,1,nil)
if #dg>0 then
Duel.HintSelection(dg)
Duel.Destroy(dg,REASON_EFFECT)
end
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x1f51)
e:SetLabel(ct)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabelObject():GetLabel()
e:SetLabel(ct)
return (c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)) and c:IsPreviousLocation(LOCATION_MZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
local ct=e:GetLabel()
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,ct+1,0,0x1f51)
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
local ct=e:GetLabel()
local addct=ct+1
if addct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,addct)
end
end
end
end
\ No newline at end of file
--终烬统御
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_LEAVE_GRAVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DESTROY)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.setcon)
e2:SetTarget(s.settg)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_COUNTER)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.ctcon)
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsChainNegatable(ev)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
s.lpop(e,tp,eg,ep,ev,re,r,rp)
end
function s.godfilter(c)
return c:IsFaceup() and c:IsCode(17338860)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
and Duel.IsExistingMatchingCard(s.godfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
local code=tc:GetOriginalCodeRule()
if Duel.Destroy(tc,REASON_EFFECT)~=0 then
-- 注册无效化效果
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetTarget(s.distg)
e1:SetLabel(code)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetCondition(s.discon)
e2:SetOperation(s.disop)
e2:SetLabel(code)
e2:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e2,tp)
end
end
end
function s.distg(e,c)
return c:IsOriginalCodeRule(e:GetLabel())
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsOriginalCodeRule(e:GetLabel())
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK)
and eg:IsExists(Card.IsControler,1,nil,1-tp)
and e:GetHandler():IsLocation(LOCATION_GRAVE)
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsSSetable() end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsSSetable() then
Duel.SSet(tp,c)
end
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEDOWN)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬神
local s,id=GetID()
function s.initial_effect(c)
--Cannot Special Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--Normal summon with 1 "终烬" tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(s.otcon)
e1:SetOperation(s.otop)
e1:SetValue(SUMMON_TYPE_ADVANCE)
c:RegisterEffect(e1)
--Additional summon (does not use normal summon)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.sumcon)
e2:SetTarget(s.sumtg)
e2:SetOperation(s.sumop)
c:RegisterEffect(e2)
--Summon LP Change and restrictions
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetOperation(s.lpop)
c:RegisterEffect(e3)
--Cannot be targeted or destroyed
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetValue(1)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_MZONE)
e5:SetValue(1)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e6:SetRange(LOCATION_MZONE)
e6:SetValue(1)
c:RegisterEffect(e6)
--Main effect
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(id,2))
e7:SetCategory(CATEGORY_DECKDES+CATEGORY_SPECIAL_SUMMON+CATEGORY_DISABLE)
e7:SetType(EFFECT_TYPE_QUICK_O)
e7:SetCode(EVENT_FREE_CHAIN)
e7:SetRange(LOCATION_MZONE)
e7:SetCountLimit(1)
e7:SetTarget(s.efftg)
e7:SetOperation(s.effop)
c:RegisterEffect(e7)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.otcon(e,c,minc)
if c==nil then return true end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(s.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
return c:IsLevelAbove(7) and minc<=1 and mg:GetCount()>=1
end
function s.otop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(s.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=mg:Select(tp,1,1,nil)
c:SetMaterial(sg)
Duel.Release(sg,REASON_SUMMON+REASON_MATERIAL)
end
function s.otfilter(c,tp)
return c:IsSetCard(0x5f51) and c:IsReleasable() and (c:IsControler(tp) or c:IsFaceup())
end
function s.sumcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.otfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.sumtg(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 s.sumop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.Summon(tp,c,true,nil)
end
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetCounter(tp,1,0,0x1f51)
local flag=false
local numbers={}
for i=1,ct do
if Duel.IsCanRemoveCounter(tp,1,0,0x1f51,i,REASON_COST) and Duel.GetFieldGroupCount(1-tp,LOCATION_DECK,0)>=i then
table.insert(numbers,i)
flag=true
end
end
if chk==0 then
return flag
end
if #numbers>0 then
if #numbers>1 then
ct=Duel.AnnounceNumber(tp,table.unpack(numbers))
else
ct=numbers[1]
end
Duel.RemoveCounter(tp,1,0,0x1f51,ct,REASON_COST)
e:SetLabel(ct)
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,1-tp,ct)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0x5f51) and not c:IsCode(17338860) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function s.effop(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabel()
if ct<=0 then return end
--Destroy cards from top of opponent's deck
local g=Duel.GetDecktopGroup(1-tp,ct)
if #g>0 then
Duel.DisableShuffleCheck()
Duel.Destroy(g,REASON_EFFECT)
--Register the destroyed cards for negation
local tc=g:GetFirst()
while tc do
local code=tc:GetOriginalCodeRule()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetTarget(s.distg)
e1:SetLabel(code)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetCondition(s.discon)
e2:SetOperation(s.disop)
e2:SetLabel(code)
e2:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e2,tp)
tc=g:GetNext()
end
--Special summon
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp)
and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if #sg>0 then
Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP)
end
end
end
end
function s.distg(e,c)
return c:IsOriginalCodeRule(e:GetLabel())
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsOriginalCodeRule(e:GetLabel())
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
\ No newline at end of file
--终烬超验 岸彼斐子
local s,id=GetID()
function s.initial_effect(c)
--xyz summon
c:EnableReviveLimit()
aux.AddXyzProcedureLevelFree(c,s.mfilter,s.xyzcheck,3,3,s.ovfilter,aux.Stringid(id,0))
c:SetSPSummonOnce(id)
--LP change and restrictions on special summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_SPSUMMON_SUCCESS)
e0:SetOperation(s.lpop)
c:RegisterEffect(e0)
--immune
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetCondition(s.imcon)
e1:SetValue(s.imval)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetCondition(s.imcon)
e2:SetTarget(s.imtg)
e2:SetValue(1)
c:RegisterEffect(e2)
--atk/def up
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetValue(s.atkval)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e4)
--destroy and negate (ignition when no counters)
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,1))
e5:SetCategory(CATEGORY_DESTROY+CATEGORY_DISABLE)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1)
e5:SetCondition(s.descon1)
e5:SetCost(s.descost)
e5:SetTarget(s.destg)
e5:SetOperation(s.desop)
c:RegisterEffect(e5)
--destroy and negate (quick effect when has counters)
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(id,1))
e6:SetCategory(CATEGORY_DESTROY+CATEGORY_DISABLE)
e6:SetType(EFFECT_TYPE_QUICK_O)
e6:SetCode(EVENT_FREE_CHAIN)
e6:SetRange(LOCATION_MZONE)
e6:SetCountLimit(1)
e6:SetCondition(s.descon2)
e6:SetCost(s.descost)
e6:SetTarget(s.destg)
e6:SetOperation(s.desop)
c:RegisterEffect(e6)
--return to extra and special summon
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(id,2))
e7:SetCategory(CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON+CATEGORY_COUNTER)
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_PHASE+PHASE_END)
e7:SetRange(LOCATION_MZONE)
e7:SetCountLimit(1)
e7:SetCondition(s.retcon)
e7:SetTarget(s.rettg)
e7:SetOperation(s.retop)
c:RegisterEffect(e7)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.mfilter(c)
return c:IsSetCard(0x5f51) and c:IsLevelAbove(1)
end
function s.xyzcheck(g,xyzc)
return g:GetClassCount(Card.GetLevel)==1
end
function s.ovfilter(c)
return c:IsFaceup() and c:IsCode(17338860) and c:GetCounter(0x1f51)>=3
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.imcon(e)
return e:GetHandler():GetSequence()>4
end
function s.imval(e,c)
return c:IsSetCard(0x5f51)
end
function s.imtg(e,c)
return c:IsSetCard(0x5f51)
end
function s.atkval(e,c)
local g=c:GetOverlayGroup()
return g:GetSum(Card.GetLevel)*500
end
function s.descon1(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetCounter(0x1f51)==0
end
function s.descon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetCounter(0x1f51)>0
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if #g>0 then
local tc=g:GetFirst()
Duel.HintSelection(g)
if Duel.Destroy(tc,REASON_EFFECT)>0 then
local code=tc:GetOriginalCodeRule()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetTarget(s.distg)
e1:SetLabel(code)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetCondition(s.discon)
e2:SetOperation(s.disop)
e2:SetLabel(code)
e2:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e2,tp)
end
end
end
function s.distg(e,c)
return c:IsOriginalCodeRule(e:GetLabel())
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsOriginalCodeRule(e:GetLabel())
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
function s.retcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==1-tp
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
function s.retop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_EFFECT)~=0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
local ctg=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
local tc=ctg:GetFirst()
while tc do
tc:AddCounter(0x1f51,1)
tc=ctg:GetNext()
end
end
end
end
\ No newline at end of file
--终烬本源 赫拉克利特
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--link summon
aux.AddLinkProcedure(c,c17338940.matfilter,1,1)
--cannot be 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(1)
c:RegisterEffect(e0)
--LP change and restrictions on special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetOperation(s.lpop)
c:RegisterEffect(e1)
--set spell/trap
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_LEAVE_GRAVE+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(s.setcon)
e2:SetTarget(s.settg)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
--no damage
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CHANGE_DAMAGE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(1,0)
e3:SetValue(s.damval)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_NO_EFFECT_DAMAGE)
c:RegisterEffect(e4)
--Record counter on leave
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_LEAVE_FIELD_P)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e5:SetOperation(s.regop)
c:RegisterEffect(e5)
--Place counters when destroyed
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(id,1))
e6:SetCategory(CATEGORY_COUNTER)
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e6:SetCode(EVENT_DESTROYED)
e6:SetProperty(EFFECT_FLAG_DELAY)
e6:SetCondition(s.ctcon)
e6:SetTarget(s.cttg)
e6:SetOperation(s.ctop)
e6:SetLabelObject(e5)
c:RegisterEffect(e6)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function c17338940.matfilter(c)
return c:IsSummonType(SUMMON_TYPE_NORMAL) and c:IsSetCard(0x5f51)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function s.setfilter(c)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable()
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_ONFIELD)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.setfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if #g>0 and Duel.SSet(tp,g:GetFirst())>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,0,1,1,nil)
if #dg>0 then
Duel.HintSelection(dg)
Duel.Destroy(dg,REASON_EFFECT)
end
end
end
function s.damfilter(c)
return c:IsSetCard(0x5f51) and not c:IsCode(id)
end
function s.damval(e,re,val,r,rp,rc)
if Duel.IsExistingMatchingCard(s.damfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) then
return 0
else
return val
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x1f51)
e:SetLabel(ct)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabelObject():GetLabel()
e:SetLabel(ct)
return (c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)) and c:IsPreviousLocation(LOCATION_MZONE)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
local ct=e:GetLabel()
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,ct+1,0,0x1f51)
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
local ct=e:GetLabel()
local addct=ct+1
if addct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,addct)
end
end
end
end
\ No newline at end of file
--终烬圣界
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetOperation(s.actop)
c:RegisterEffect(e0)
--Main effect - choose 1 of 4 effects
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1)
e1:SetTarget(s.efftg)
e1:SetOperation(s.effop)
c:RegisterEffect(e1)
--Protection effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_ONFIELD,0)
e2:SetTarget(s.protg)
e2:SetValue(function(e,re)
return re:GetHandlerPlayer()~=e:GetHandlerPlayer()
end)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_ONFIELD,0)
e3:SetTarget(s.protg)
e3:SetValue(function(e,re,rp)
return rp~=e:GetHandlerPlayer()
end)
c:RegisterEffect(e3)
--Place counter when destroyed
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_COUNTER)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetTarget(s.cttg)
e4:SetOperation(s.ctop)
c:RegisterEffect(e4)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.actop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function s.effop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local op=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3),aux.Stringid(id,4),aux.Stringid(id,5))
if op==0 then
local g=Duel.GetMatchingGroup(s.spfilter1,tp,LOCATION_EXTRA,0,nil,e,tp)
if #g>0 and Duel.GetLocationCountFromEx(tp,tp,nil,0x60)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=g:Select(tp,1,1,nil):GetFirst()
if sc then
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP,0x60)
end
end
elseif op==1 then
local g=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local xyzc=g:Select(tp,1,1,nil):GetFirst()
if xyzc and not xyzc:IsImmuneToEffect(e) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local mg=Duel.SelectMatchingCard(tp,function(c)
return aux.NecroValleyFilter(function(c)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_MONSTER) and c:IsCanOverlay() and not c:IsCode(xyzc:GetCode())
end)(c)
end,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_MZONE+LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
local tc=mg:GetFirst()
if tc and tc:IsCanOverlay() then
Duel.Overlay(xyzc,tc)
end
end
end
elseif op==2 then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter2),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,nil,e,tp)
if #g>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
local tc=sg:GetFirst()
if tc then
Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
end
end
elseif op==3 then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.stfilter),tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,nil)
if #g>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=g:Select(tp,1,1,nil)
local tc=sg:GetFirst()
if tc then
Duel.SSet(tp,tc)
if tc:IsType(TYPE_QUICKPLAY) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
if tc:IsType(TYPE_TRAP) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
end
end
local cg=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #cg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,6)) then
local tc=cg:GetFirst()
while tc do
tc:AddCounter(0x1f51,1)
tc=cg:GetNext()
end
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.spfilter1(c,e,tp)
return c:IsCode(17338930) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.xyzfilter(c)
return c:IsFaceup() and c:IsCode(17338930) and c:IsType(TYPE_XYZ)
end
function s.spfilter2(c,e,tp)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function s.stfilter(c)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable()
end
function s.protg(e,c)
return c:IsSetCard(0x5f51) and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬启程
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Return to hand during opponent's End Phase
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
--Place counter when set card is destroyed
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_COUNTER)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.setcon)
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.cfilter(c)
return c:IsSetCard(0x5f51) and not c:IsPublic()
end
function s.typecheck(g)
local t={}
for tc in aux.Next(g) do
if tc:IsType(TYPE_MONSTER) then
if t[TYPE_MONSTER] then return false end
t[TYPE_MONSTER]=true
elseif tc:IsType(TYPE_SPELL) then
if t[TYPE_SPELL] then return false end
t[TYPE_SPELL]=true
elseif tc:IsType(TYPE_TRAP) then
if t[TYPE_TRAP] then return false end
t[TYPE_TRAP]=true
end
end
return true
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND,0,nil)
if chk==0 then return #g>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=g:SelectSubGroup(tp,s.typecheck,false,1,3)
Duel.ConfirmCards(1-tp,sg)
Duel.RaiseEvent(sg,EVENT_CUSTOM+9091064,e,REASON_COST,tp,tp,0)
Duel.ShuffleHand(tp)
e:SetLabel(#sg)
--LP change and restrictions
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:IsCostChecked() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thfilter(c,codes)
if not (c:IsSetCard(0x5f51) and c:IsAbleToHand()) then return false end
for _,code in ipairs(codes) do
if c:IsCode(code) then return false end
end
return true
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabel()
local codes={}
local sg=Group.CreateGroup()
--Get the confirmed cards and their codes
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND,0,nil)
for tc in aux.Next(g) do
if not tc:IsPublic() then
table.insert(codes,tc:GetCode())
sg:AddCard(tc)
end
end
if ct>0 then
--1 or more: Add 1 "终烬" card from Deck to hand
local thg=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,codes)
if #thg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local th=thg:Select(tp,1,1,nil)
if #th>0 then
Duel.SendtoHand(th,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,th)
end
end
end
if ct>1 then
Duel.BreakEffect()
--2 or more: Check opponent's hand and field
local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
local fg=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD)
if #hg>0 then
Duel.ConfirmCards(tp,hg)
end
if #fg>0 then
local fc=fg:GetFirst()
while fc do
if fc:IsFacedown() then
Duel.ConfirmCards(tp,fc)
end
fc=fg:GetNext()
end
end
Duel.ShuffleHand(1-tp)
end
if ct>2 then
Duel.BreakEffect()
--3: Cannot chain to "终烬" card effects
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(0,1)
e1:SetValue(s.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
function s.aclimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsSetCard(0x5f51)
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==1-tp
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousPosition(POS_FACEDOWN)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬对冲
local s,id=GetID()
function s.initial_effect(c)
--Activate from hand
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e0:SetCondition(s.handcon)
c:RegisterEffect(e0)
--Counter effect
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Return to hand during opponent's Standby Phase
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
--Place counter when set card is destroyed
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_COUNTER)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.setcon)
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.handcon(e)
return Duel.IsExistingMatchingCard(Card.IsSetCard,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil,0x5f51)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and re:IsActiveType(TYPE_MONSTER)
and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_ONFIELD,0,1,nil,0x5f51)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--LP change and restrictions
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
--Negate the effect
if Duel.NegateEffect(ev) then
local rc=re:GetHandler()
if rc then
local code=rc:GetOriginalCodeRule()
--Protection until next turn's End Phase
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x5f51))
e3:SetValue(s.efilter)
e3:SetLabel(code)
e3:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e3,tp)
end
end
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.efilter(e,re)
return re:GetHandler():GetOriginalCodeRule()==e:GetLabel()
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==1-tp
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousPosition(POS_FACEDOWN)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬诅咒
local s,id=GetID()
function s.initial_effect(c)
--Activate from hand
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e0:SetCondition(s.handcon)
c:RegisterEffect(e0)
--Main effect
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Return to hand during own End Phase
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
--Place counter when set card is destroyed
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_COUNTER)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.setcon)
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.handcon(e)
return Duel.IsExistingMatchingCard(Card.IsSetCard,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil,0x5f51)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--LP change and restrictions
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
--Select target
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
local tc=g:GetFirst()
if tc and not tc:IsImmuneToEffect(e) then
Duel.HintSelection(g)
--Negate effects
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_DISABLE_EFFECT)
e4:SetValue(RESET_TURN_SET)
e4:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e4)
--Cannot attack
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_CANNOT_ATTACK)
e5:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e5)
--Cannot be targeted by effects
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e6:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e6:SetValue(1)
e6:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e6)
--Cannot change position
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
e7:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e7)
--Destroy at End Phase
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e8:SetCode(EVENT_PHASE+PHASE_END)
e8:SetCountLimit(1)
e8:SetRange(LOCATION_MZONE)
e8:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e8:SetOperation(s.desop)
e8:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e8)
--Cannot be used as material
local e9=Effect.CreateEffect(c)
e9:SetType(EFFECT_TYPE_SINGLE)
e9:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e9:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e9:SetValue(1)
e9:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e9)
local e10=e9:Clone()
e10:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
tc:RegisterEffect(e10)
local e11=e9:Clone()
e11:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
tc:RegisterEffect(e11)
local e12=e9:Clone()
e12:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e12)
end
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousPosition(POS_FACEDOWN)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
\ No newline at end of file
--终烬降临
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetTarget(s.target)
e0:SetOperation(s.activate)
c:RegisterEffect(e0)
--Cannot be negated
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_INACTIVATE)
e1:SetValue(s.efilter)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_DISEFFECT)
e2:SetValue(s.efilter)
c:RegisterEffect(e2)
--No tribute for "终烬" monsters while in GY
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_SUMMON_PROC)
e3:SetRange(LOCATION_GRAVE)
e3:SetTargetRange(LOCATION_HAND,0)
e3:SetCondition(s.ntcon)
e3:SetTarget(s.nttg)
c:RegisterEffect(e3)
--Place counter when cards are destroyed
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_COUNTER)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetRange(LOCATION_GRAVE)
e4:SetCondition(s.ctcon)
e4:SetTarget(s.cttg)
e4:SetOperation(s.ctop)
c:RegisterEffect(e4)
Duel.AddCustomActivityCounter(id,ACTIVITY_SUMMON,s.counterfilter)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
--Initial hand processing
local ge0=Effect.CreateEffect(c)
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_UNCOPYABLE)
ge0:SetCode(EVENT_DRAW)
ge0:SetRange(0xff)
ge0:SetOperation(s.quest)
c:RegisterEffect(ge0)
end
--Initial hand processing
if not Initial_Hand_Shuffle_Count then
Initial_Hand_Shuffle_Count=0
end
function s.efilter(e,ct)
local te=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT)
return te:GetHandler()==e:GetHandler()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
Duel.SetChainLimit(aux.FALSE)
end
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--LP变为1
if Duel.GetLP(tp)~=1 then
Duel.SetLP(tp,1)
end
--召唤限制
local e1=Effect.CreateEffect(c)
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(s.splimit)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
--生成衍生物
if not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,17339040,0x5f51,TYPES_TOKEN_MONSTER,0,0,1,RACE_PYRO,ATTRIBUTE_FIRE,POS_FACEUP) then
local token=Duel.CreateToken(tp,17339040)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
--Cannot be tributed
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UNRELEASABLE_SUM)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_NONSUM)
token:RegisterEffect(e2,true)
--Cannot be removed
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_REMOVE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e3,true)
--Destroy when LP is not 1
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_ADJUST)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(s.descon)
e4:SetOperation(s.desop)
e4:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e4,true)
Duel.SpecialSummonComplete()
end
--胜利条件跟踪
local fid=c:GetFieldID()
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_PHASE+PHASE_END)
e5:SetCountLimit(1)
e5:SetLabel(fid,0)
e5:SetCondition(s.wincon)
e5:SetOperation(s.winop)
e5:SetReset(RESET_PHASE+PHASE_END,3)
Duel.RegisterEffect(e5,tp)
end
function s.counterfilter(c)
return c:IsSetCard(0x5f51)
end
function s.splimit(e,c)
return not c:IsSetCard(0x5f51)
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)~=1
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function s.nttg(e,c)
return c:IsSetCard(0x5f51) and c:IsLevelAbove(5)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsPreviousLocation,1,nil,LOCATION_ONFIELD)
end
function s.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5f51) and c:IsCanAddCounter(0x1f51,1)
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_MZONE,0,nil)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectMatchingCard(tp,s.ctfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:AddCounter(0x1f51,1)
end
end
end
function s.wincon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function s.winop(e,tp,eg,ep,ev,re,r,rp)
local fid,ct=e:GetLabel()
ct=ct+1
e:SetLabel(fid,ct)
if ct==2 then
if Duel.IsExistingMatchingCard(s.tokenfilter,tp,LOCATION_MZONE,0,1,nil) then
local WIN_REASON_EMBER_DESCENT=0xf6
Duel.Win(tp,WIN_REASON_EMBER_DESCENT)
end
e:Reset()
end
end
function s.tokenfilter(c)
return c:IsCode(17339040)
end
-----------------------------------Initial Hand Processing--------------------------------------
function s.quest(e,tp,eg,ep,ev,re,r,rp)
--The global variable "Initial_Hand_Shuffle_Count" is used to record the number of cards that appear in the initial hand. If it exceeds 5, a shuffle will be triggered in "ge0". Therefore, please keep "Initial_Hand_Shuffle_Count" unchanged when copying and modifying the code
if Initial_Hand_Shuffle_Count and Initial_Hand_Shuffle_Count>5 then
e:Reset()
Duel.ShuffleDeck(tp)
end
local c=e:GetHandler()
if not s[c] and Duel.GetFieldGroupCount(0,LOCATION_HAND,0)>0 and Duel.GetFieldGroupCount(0,0,LOCATION_HAND)>0 then
s[c]=true
e:Reset()
if c:IsLocation(LOCATION_HAND) then return false end
local tdg=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
local min_fid=32768
for tc in aux.Next(tdg) do
local tc_fid=tc:GetFieldID()
if tc_fid<min_fid then min_fid=tc_fid end
end
if min_fid~=32768 then
local tdg=Duel.GetMatchingGroup(s.questfilter,tp,LOCATION_HAND,0,nil,min_fid)
Duel.SendtoDeck(tdg,nil,2,REASON_RULE)
Duel.MoveSequence(c,SEQ_DECKTOP)
Duel.Draw(tp,1,REASON_RULE)
end
elseif Duel.GetFieldGroupCount(0,LOCATION_HAND,0)>0 and Duel.GetFieldGroupCount(0,0,LOCATION_HAND)>0 then
e:Reset()
end
end
function s.questfilter(c,min_fid)
return c:GetFieldID()==min_fid
end
--to top when appear in initial hand
local _RegisterEffect=Card.RegisterEffect
function Card.RegisterEffect(rc,eff,bool)
local int=_RegisterEffect(rc,eff,bool)
local c=rc
if not s[c] and c:IsCode(17339010) and Duel.GetFieldGroupCount(0,LOCATION_EXTRA,0)>0 and Duel.GetFieldGroupCount(0,0,LOCATION_EXTRA)>0 then
Initial_Hand_Shuffle_Count=Initial_Hand_Shuffle_Count+1
Duel.MoveSequence(c,SEQ_DECKTOP)
Duel.Draw(c:GetControler(),1,REASON_RULE)
s[c]=true
end
return int
end
\ No newline at end of file
......@@ -2,6 +2,7 @@
local s,id,o=GetID()
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
......
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