Commit 1b0265de authored by REIKAI's avatar REIKAI 💬

fix bug

parent 4147f59a
--物语纪录·神原骏河 --物语纪录·神原骏河
function c1009022.initial_effect(c) function c1009022.initial_effect(c)
--pendulum summon --pendulum summon
aux.EnablePendulumAttribute(c) aux.EnablePendulumAttribute(c)
--to hand --to hand
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(1009022,0)) e2:SetDescription(aux.Stringid(1009022,0))
e2:SetCategory(CATEGORY_TOHAND) e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION) e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_PZONE) e2:SetRange(LOCATION_PZONE)
e2:SetCountLimit(1,1009022) e2:SetCountLimit(1,1009022)
e2:SetCost(c1009022.thcost) e2:SetCost(c1009022.thcost)
e2:SetTarget(c1009022.thtg) e2:SetTarget(c1009022.thtg)
e2:SetOperation(c1009022.thop) e2:SetOperation(c1009022.thop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--todeck --todeck
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(1009022,3)) e3:SetDescription(aux.Stringid(1009022,3))
e3:SetCategory(CATEGORY_TODECK) e3:SetCategory(CATEGORY_TODECK)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCondition(c1009022.tdcon) e3:SetCondition(c1009022.tdcon)
e3:SetTarget(c1009022.tdtg) e3:SetTarget(c1009022.tdtg)
e3:SetOperation(c1009022.tdop) e3:SetOperation(c1009022.tdop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE) e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_MATERIAL_CHECK) e4:SetCode(EFFECT_MATERIAL_CHECK)
e4:SetValue(c1009022.valcheck) e4:SetValue(c1009022.valcheck)
e4:SetLabelObject(e3) e4:SetLabelObject(e3)
c:RegisterEffect(e4) c:RegisterEffect(e4)
--summon with s/t --summon with s/t
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_ADD_EXTRA_TRIBUTE) e1:SetCode(EFFECT_ADD_EXTRA_TRIBUTE)
e1:SetTargetRange(LOCATION_SZONE,0) e1:SetTargetRange(LOCATION_SZONE,0)
e1:SetValue(POS_FACEUP_ATTACK) e1:SetValue(POS_FACEUP_ATTACK)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(1160) e1:SetDescription(1160)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_SZONE) e1:SetRange(LOCATION_SZONE)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--tribute summon --tribute summon
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(1009022,2)) e3:SetDescription(aux.Stringid(1009022,2))
e3:SetCategory(CATEGORY_SUMMON) e3:SetCategory(CATEGORY_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN) e3:SetCode(EVENT_FREE_CHAIN)
e3:SetHintTiming(0,TIMING_MAIN_END) e3:SetHintTiming(0,TIMING_MAIN_END)
e3:SetRange(LOCATION_PZONE) e3:SetRange(LOCATION_PZONE)
e3:SetCountLimit(1) e3:SetCountLimit(1)
e3:SetCondition(c1009022.sumcon) e3:SetCondition(c1009022.sumcon)
e3:SetCost(c1009022.cost) e3:SetCost(c1009022.cost)
e3:SetTarget(c1009022.sumtg) e3:SetTarget(c1009022.sumtg)
e3:SetOperation(c1009022.sumop) e3:SetOperation(c1009022.sumop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
--destroy --destroy
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(1009022,0)) e4:SetDescription(aux.Stringid(1009022,0))
e4:SetCategory(CATEGORY_DESTROY) e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetCountLimit(1,10090220) e4:SetCountLimit(1,10090220)
e4:SetCondition(c1009022.descon) e4:SetCondition(c1009022.descon)
e4:SetTarget(c1009022.destg) e4:SetTarget(c1009022.destg)
e4:SetOperation(c1009022.desop) e4:SetOperation(c1009022.desop)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
function c1009022.thcost(e,tp,eg,ep,ev,re,r,rp,chk) function c1009022.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end
Duel.SendtoDeck(e:GetHandler(),nil,2,REASON_COST) Duel.SendtoDeck(e:GetHandler(),nil,2,REASON_COST)
end end
function c1009022.thfilter1(c,tp) function c1009022.thfilter1(c,tp)
return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsSetCard(0x520c) and c:IsAbleToHand() return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsSetCard(0x520c) and c:IsAbleToHand()
end end
function c1009022.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function c1009022.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c1009022.thfilter1,tp,LOCATION_EXTRA,0,1,nil,tp) end if chk==0 then return Duel.IsExistingMatchingCard(c1009022.thfilter1,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_EXTRA+LOCATION_GRAVE)
end end
function c1009022.thop(e,tp,eg,ep,ev,re,r,rp) function c1009022.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c1009022.thfilter1,tp,LOCATION_EXTRA,0,nil) local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c1009022.thfilter1),tp,LOCATION_EXTRA+LOCATION_GRAVE,0,nil)
if g:GetCount()<2 then return end if g:GetCount()<2 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,2,2,nil) local sg=g:Select(tp,2,2,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg) Duel.ConfirmCards(1-tp,sg)
end end
function c1009022.tdcon(e,tp,eg,ep,ev,re,r,rp) function c1009022.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE) return e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE)
end end
function c1009022.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c1009022.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
if chk==0 then return true end if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g1=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) local g1=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g2=Duel.SelectTarget(tp,nil,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil) local g2=Duel.SelectTarget(tp,nil,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
if e:GetLabel()==1 if e:GetLabel()==1
and Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,g1:GetFirst()) and Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,g1:GetFirst())
and Duel.SelectYesNo(tp,aux.Stringid(1009022,4)) then and Duel.SelectYesNo(tp,aux.Stringid(1009022,4)) then
e:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND) e:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g3=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst()) local g3=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst())
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g3,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g3,1,0,0)
end end
g1:Merge(g2) g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,2,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,2,0,0)
end end
function c1009022.tdop(e,tp,eg,ep,ev,re,r,rp) function c1009022.tdop(e,tp,eg,ep,ev,re,r,rp)
local ex,g1=Duel.GetOperationInfo(0,CATEGORY_TODECK) local ex,g1=Duel.GetOperationInfo(0,CATEGORY_TODECK)
local ex2,g2=Duel.GetOperationInfo(0,CATEGORY_TOHAND) local ex2,g2=Duel.GetOperationInfo(0,CATEGORY_TOHAND)
local sg1=g1:Filter(Card.IsRelateToEffect,nil,e) local sg1=g1:Filter(Card.IsRelateToEffect,nil,e)
if sg1:GetCount()>0 and Duel.SendtoDeck(sg1,nil,0,REASON_EFFECT)>1 then if sg1:GetCount()>0 and Duel.SendtoDeck(sg1,nil,0,REASON_EFFECT)>1 then
local tc1=sg1:GetFirst() local tc1=sg1:GetFirst()
local tc2=sg1:GetNext() local tc2=sg1:GetNext()
if tc1:GetControler()==tc2:GetControler() and tc1:IsLocation(LOCATION_DECK) and tc2:IsLocation(LOCATION_DECK) then if tc1:GetControler()==tc2:GetControler() and tc1:IsLocation(LOCATION_DECK) and tc2:IsLocation(LOCATION_DECK) then
Duel.SortDecktop(tp,tc1:GetControler(),2) Duel.SortDecktop(tp,tc1:GetControler(),2)
end end
end end
if e:GetLabel()==1 and g2 then if e:GetLabel()==1 and g2 then
local tc=g2:GetFirst() local tc=g2:GetFirst()
if tc:IsRelateToEffect(e) then if tc:IsRelateToEffect(e) then
Duel.SendtoHand(g2,nil,REASON_EFFECT) Duel.SendtoHand(g2,nil,REASON_EFFECT)
end end
end end
end end
function c1009022.valcheck(e,c) function c1009022.valcheck(e,c)
local g=c:GetMaterial() local g=c:GetMaterial()
if g:IsExists(Card.IsSetCard,1,nil,0x520c) then if g:IsExists(Card.IsSetCard,1,nil,0x520c) then
e:GetLabelObject():SetLabel(1) e:GetLabelObject():SetLabel(1)
else else
e:GetLabelObject():SetLabel(0) e:GetLabelObject():SetLabel(0)
end end
end end
function c1009022.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c1009022.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,1009022)==0 end if chk==0 then return Duel.GetFlagEffect(tp,1009022)==0 end
Duel.RegisterFlagEffect(tp,1009022,RESET_CHAIN,0,1) Duel.RegisterFlagEffect(tp,1009022,RESET_CHAIN,0,1)
end end
function c1009022.sumcon(e,tp,eg,ep,ev,re,r,rp) function c1009022.sumcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2) return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)
end end
function c1009022.sumfilter(c) function c1009022.sumfilter(c)
return c:IsSetCard(0x520c) and c:IsSummonable(true,nil,1) return c:IsSetCard(0x520c) and c:IsSummonable(true,nil,1)
end end
function c1009022.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) function c1009022.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c1009022.sumfilter,tp,LOCATION_HAND,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(c1009022.sumfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end end
function c1009022.sumop(e,tp,eg,ep,ev,re,r,rp) function c1009022.sumop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c1009022.sumfilter,tp,LOCATION_HAND,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,c1009022.sumfilter,tp,LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst() local tc=g:GetFirst()
if tc then if tc then
Duel.Summon(tp,tc,true,nil,1) Duel.Summon(tp,tc,true,nil,1)
end end
end end
function c1009022.descon(e,tp,eg,ep,ev,re,r,rp) function c1009022.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE)
end end
function c1009022.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c1009022.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) end if chkc then return chkc:IsLocation(LOCATION_ONFIELD) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end end
function c1009022.desop(e,tp,eg,ep,ev,re,r,rp) function c1009022.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT) Duel.Destroy(tc,REASON_EFFECT)
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment