Commit 4741da50 authored by Tachibana's avatar Tachibana

1145141919810

parent 059d777c
...@@ -32,7 +32,7 @@ function c12005014.target(e,c) ...@@ -32,7 +32,7 @@ function c12005014.target(e,c)
or not (g and g:IsContains(c)) or not (g and g:IsContains(c))
end end
function c12005014.efilter(e,te) function c12005014.efilter(e,te)
return te:GetOwnerPlayer()~=e:GetHandlerPlayer() return te:GetHandler():IsType(TYPE_MONSTER)
end end
function c12005014.mfilter(c,g) function c12005014.mfilter(c,g)
return c:IsType(TYPE_COUNTER) return c:IsType(TYPE_COUNTER)
......
...@@ -35,9 +35,9 @@ function cm.initial_effect(c) ...@@ -35,9 +35,9 @@ function cm.initial_effect(c)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1)) e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m) e3:SetCode(EVENT_CUSTOM+m)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) --e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetTarget(cm.thtg) e3:SetTarget(cm.thtg)
e3:SetOperation(cm.thop) e3:SetOperation(cm.thop)
...@@ -115,7 +115,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -115,7 +115,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("2") --Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3") --Debug.Message("3")
Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0) Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end end
e:Reset() e:Reset()
end end
......
...@@ -36,9 +36,9 @@ function cm.initial_effect(c) ...@@ -36,9 +36,9 @@ function cm.initial_effect(c)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1)) e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m) e3:SetCode(EVENT_CUSTOM+m)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) --e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetTarget(cm.thtg) e3:SetTarget(cm.thtg)
e3:SetOperation(cm.thop) e3:SetOperation(cm.thop)
...@@ -77,10 +77,14 @@ end ...@@ -77,10 +77,14 @@ end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.tgfilter(c,e,tp)
return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,c) and c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.drfilter(chkc) end if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.drfilter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
and Duel.IsExistingTarget(cm.drfilter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end and Duel.IsExistingTarget(cm.drfilter,tp,LOCATION_GRAVE,0,1,nil) and ((Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)) or (Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp))) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,cm.drfilter,tp,LOCATION_GRAVE,0,1,1,nil) local g=Duel.SelectTarget(tp,cm.drfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
...@@ -90,14 +94,25 @@ end ...@@ -90,14 +94,25 @@ end
function cm.operation(e,tp,eg,ep,ev,re,r,rp) function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 then if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=-1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp) local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then if g:GetCount()>0 and ft>0 then
Duel.BreakEffect() Duel.BreakEffect()
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.Draw(tp,1,REASON_EFFECT) Duel.Draw(tp,1,REASON_EFFECT)
else
Duel.BreakEffect()
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
local tc1=tg:GetFirst()
if tc1 and Duel.Release(tc1,REASON_COST)~=0 and tc1:IsLocation(LOCATION_GRAVE) then
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN, EFFECT_FLAG_OATH,1)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.Draw(tp,1,REASON_EFFECT)
end
end end
Duel.ResetFlagEffect(tp,m)
end end
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp) function cm.op(e,tp,eg,ep,ev,re,r,rp)
...@@ -125,7 +140,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -125,7 +140,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("2") --Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3") --Debug.Message("3")
Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0) Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end end
e:Reset() e:Reset()
end end
......
...@@ -34,9 +34,9 @@ function cm.initial_effect(c) ...@@ -34,9 +34,9 @@ function cm.initial_effect(c)
--spsummon --spsummon
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1)) e3:SetDescription(aux.Stringid(m,1))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m) e3:SetCode(EVENT_CUSTOM+m)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) --e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetTarget(cm.tdtg) e3:SetTarget(cm.tdtg)
e3:SetOperation(cm.tdop) e3:SetOperation(cm.tdop)
...@@ -74,20 +74,39 @@ end ...@@ -74,20 +74,39 @@ end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsLevelBelow(6) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return cm.JewelPaladin(c) and c:IsLevelBelow(6) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.tgfilter(c,e,tp)
return c:IsFaceup()
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,c) and c:IsAbleToGrave() and Duel.GetMZoneCount(tp,c)>0
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end if chk==0 then return (Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp)) or (Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp)) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end end
function cm.operation(e,tp,eg,ep,ev,re,r,rp) function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local cb=1 local cb=1
if e:GetHandler():GetFlagEffect(m)>0 and not Duel.IsPlayerAffectedByEffect(tp,59822133) then cb=2 end if e:GetHandler():GetFlagEffect(m)>0 and not Duel.IsPlayerAffectedByEffect(tp,59822133) then cb=2 end
local ct=math.min(1,cb) local ct=math.min(1,cb)
local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil,e,tp) local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil,e,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) if g:GetCount()>0 and ft>=ct then
local sg=g:SelectSubGroup(tp,aux.dncheck,false,1,ct) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
if sg then local sg=g:SelectSubGroup(tp,aux.dncheck,false,1,ct)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) if sg then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,ct,ct,nil,e,tp)
if Duel.Release(tg,REASON_COST) ~=0 then
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroup(tp,aux.dncheck,false,1,ct)
if sg then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
end end
Duel.ResetFlagEffect(tp,m)
end end
function cm.op(e,tp,eg,ep,ev,re,r,rp) function cm.op(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("0") --Debug.Message("0")
...@@ -114,7 +133,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -114,7 +133,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("2") --Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3") --Debug.Message("3")
Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0) Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end end
e:Reset() e:Reset()
end end
......
...@@ -40,9 +40,9 @@ function cm.initial_effect(c) ...@@ -40,9 +40,9 @@ function cm.initial_effect(c)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1)) e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m) e3:SetCode(EVENT_CUSTOM+m)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) --e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetTarget(cm.tdtg) e3:SetTarget(cm.tdtg)
e3:SetOperation(cm.tdop) e3:SetOperation(cm.tdop)
...@@ -99,7 +99,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -99,7 +99,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("2") --Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3") --Debug.Message("3")
Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0) Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end end
e:Reset() e:Reset()
end end
...@@ -111,21 +111,34 @@ end ...@@ -111,21 +111,34 @@ end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.tgfilter(c,e,tp)
return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,c) and c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end
function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) function cm.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end if chk==0 then return (Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)) or (Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)) end
local bpchk=0 local bpchk=0
if Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<PHASE_BATTLE then bpchk=1 end if Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<PHASE_BATTLE then bpchk=1 end
e:SetLabel(bpchk) e:SetLabel(bpchk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end end
function cm.spop2(e,tp,eg,ep,ev,re,r,rp) function cm.spop2(e,tp,eg,ep,ev,re,r,rp)
local ftf=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ft=99 local ft=99
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,ft,nil,e,tp) local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,ft,nil,e,tp)
if g:GetCount()>0 then local tt=g:GetCount()
if g:GetCount()>0 and ftf>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,tt,tt,nil,e,tp)
if Duel.Release(tg,REASON_COST) ~=0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end end
Duel.ResetFlagEffect(tp,m)
if e:GetLabel()==1 then if e:GetLabel()==1 then
Duel.ChainAttack() Duel.ChainAttack()
end end
......
...@@ -35,9 +35,9 @@ function cm.initial_effect(c) ...@@ -35,9 +35,9 @@ function cm.initial_effect(c)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1)) e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m) e3:SetCode(EVENT_CUSTOM+m)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) --e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetTarget(cm.sptg) e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop) e3:SetOperation(cm.spop)
...@@ -93,7 +93,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -93,7 +93,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("2") --Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3") --Debug.Message("3")
Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0) Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end end
e:Reset() e:Reset()
end end
...@@ -117,6 +117,9 @@ end ...@@ -117,6 +117,9 @@ end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>4 end if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>4 end
end end
function cm.tgfilter(c,e,tp)
return c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP)
end end
...@@ -130,7 +133,19 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -130,7 +133,19 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:FilterSelect(tp,cm.spfilter,1,1,nil,e,tp) local sg=g:FilterSelect(tp,cm.spfilter,1,1,nil,e,tp)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=-1 then return end
if sg:GetCount()>0 and ft>0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
local tc=tg:GetFirst()
if tc and Duel.Release(tc,REASON_COST) ~=0 and tc:IsLocation(LOCATION_GRAVE) then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end
Duel.ResetFlagEffect(tp,m)
ct=g:GetCount()-sg:GetCount() ct=g:GetCount()-sg:GetCount()
end end
if ct>0 then if ct>0 then
......
...@@ -35,9 +35,9 @@ function cm.initial_effect(c) ...@@ -35,9 +35,9 @@ function cm.initial_effect(c)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1)) e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_DESTROY) e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m) e3:SetCode(EVENT_CUSTOM+m)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) --e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetTarget(cm.destg) e3:SetTarget(cm.destg)
e3:SetOperation(cm.desop) e3:SetOperation(cm.desop)
...@@ -93,7 +93,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -93,7 +93,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("2") --Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3") --Debug.Message("3")
Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0) Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end end
e:Reset() e:Reset()
end end
......
...@@ -39,9 +39,9 @@ function cm.initial_effect(c) ...@@ -39,9 +39,9 @@ function cm.initial_effect(c)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1)) e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_HANDES) e3:SetCategory(CATEGORY_HANDES)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m) e3:SetCode(EVENT_CUSTOM+m)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) --e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetTarget(cm.hstg) e3:SetTarget(cm.hstg)
e3:SetOperation(cm.hsop) e3:SetOperation(cm.hsop)
...@@ -97,7 +97,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp) ...@@ -97,7 +97,7 @@ function cm.op2(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("2") --Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3") --Debug.Message("3")
Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0) Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end end
e:Reset() e:Reset()
end end
...@@ -107,6 +107,9 @@ end ...@@ -107,6 +107,9 @@ end
function cm.costfilter(c) function cm.costfilter(c)
return c:IsType(TYPE_MONSTER) return c:IsType(TYPE_MONSTER)
end end
function cm.tgfilter(c,e,tp)
return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c) and c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end
function cm.tgcost1(e,tp,eg,ep,ev,re,r,rp,chk) function cm.tgcost1(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetMatchingGroupCount(cm.costfilter,tp,LOCATION_MZONE,0,nil) local ct=Duel.GetMatchingGroupCount(cm.costfilter,tp,LOCATION_MZONE,0,nil)
if ct==0 then return end if ct==0 then return end
...@@ -119,7 +122,7 @@ end ...@@ -119,7 +122,7 @@ end
function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=e:GetLabel() local g=e:GetLabel()
--local g=e:GetHandler():GetOverlayGroup():Filter(Card.IsType,nil,TYPE_SYNCHRO) --local g=e:GetHandler():GetOverlayGroup():Filter(Card.IsType,nil,TYPE_SYNCHRO)
if chk==0 then return #g>0 and Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end if chk==0 then return g:GetCount()>0 and Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0)
end end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
...@@ -129,19 +132,31 @@ function cm.tgop(e,tp,eg,ep,ev,re,r,rp) ...@@ -129,19 +132,31 @@ function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
local dg=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) local dg=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
local g=e:GetLabel() local g=e:GetLabel()
--local g=e:GetHandler():GetOverlayGroup():Filter(Card.IsType,nil,TYPE_SYNCHRO) --local g=e:GetHandler():GetOverlayGroup():Filter(Card.IsType,nil,TYPE_SYNCHRO)
if #g>0 and #dg>0 then if g:GetCount()>0 and dg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sdg=dg:Select(tp,1,g:GetCount(),nil) local sdg=dg:Select(tp,1,g:GetCount(),nil)
Duel.HintSelection(sdg) Duel.HintSelection(sdg)
local sg=Duel.SendtoGrave(sdg,REASON_EFFECT) local sg=Duel.SendtoGrave(sdg,REASON_EFFECT)
if #sg>0 then if sg:GetCount()>0 then
local cg=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_DECK,0,nil,e,tp) local cg=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
if cg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then if cg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
local ct=sg:GetCount() local ct=sg:GetCount()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=1 end
Duel.BreakEffect() Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local gg=cg:Select(tp,1,ct,nil) local gg=cg:Select(tp,1,ct,nil)
Duel.SpecialSummon(gg,0,tp,tp,false,false,POS_FACEUP) local ctg=gg:GetCount()
if gg:GetCount()>0 and ft>0 then
Duel.SpecialSummon(gg,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,ctg,ctg,nil,e,tp)
if Duel.Release(tg,REASON_COST) ~=0 then
Duel.SpecialSummon(gg,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end
Duel.ResetFlagEffect(tp,m)
end end
end end
end end
......
...@@ -51,14 +51,28 @@ end ...@@ -51,14 +51,28 @@ end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.tgfilter(c,e,tp)
return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,c) and c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end if chk==0 then return (Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)) or (Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end end
function cm.spop(e,tp,eg,ep,ev,re,r,rp) function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=-1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then if g:GetCount()>0 and ft>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
local tc=tg:GetFirst()
if tc and Duel.Release(tc,REASON_COST) ~=0 and tc:IsLocation(LOCATION_GRAVE) then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end end
Duel.ResetFlagEffect(tp,m)
end end
\ No newline at end of file
...@@ -40,6 +40,9 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -40,6 +40,9 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end end
end end
function cm.tgfilter(c,e,tp)
return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c) and c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
...@@ -52,7 +55,20 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -52,7 +55,20 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.BreakEffect() Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil) local sg=g:Select(tp,1,1,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=-1 then return end
local sg=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if sg:GetCount()>0 and ft>0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
local tc=tg:GetFirst()
if tc and Duel.Release(tc,REASON_COST) ~=0 and tc:IsLocation(LOCATION_GRAVE) then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end
Duel.ResetFlagEffect(tp,m)
end end
end end
end end
......
...@@ -152,19 +152,28 @@ function cm.spfilter(c,e,tp) ...@@ -152,19 +152,28 @@ function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.tgop(e,tp,eg,ep,ev,re,r,rp) function cm.tgop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetMatchingGroup(nil,1-tp,LOCATION_ONFIELD+LOCATION_HAND,0,nil) local g=Duel.GetMatchingGroup(nil,1-tp,LOCATION_ONFIELD+LOCATION_HAND,0,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
local sg=g:Select(1-tp,1,1,nil) local sg=g:Select(1-tp,1,1,nil)
Duel.HintSelection(sg) Duel.HintSelection(sg)
local dg=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_DECK,0,nil,e,tp) local dg=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
if Duel.SendtoGrave(sg,REASON_RULE)~=0 then if Duel.SendtoGrave(sg,REASON_RULE) and dg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
if dg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then Duel.BreakEffect()
Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sdg=dg:Select(tp,1,1,nil)
local sdg=dg:Select(tp,1,1,nil) if sdg:GetCount()>0 and ft>0 then
Duel.SpecialSummon(sdg,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(sdg,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
local tc=tg:GetFirst()
if tc and Duel.Release(tc,REASON_COST) ~=0 and tc:IsLocation(LOCATION_GRAVE) then
Duel.SpecialSummon(sdg,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end end
Duel.ResetFlagEffect(tp,m)
end end
end end
end end
...@@ -174,24 +183,36 @@ end ...@@ -174,24 +183,36 @@ end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp) function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker()==e:GetHandler() and Duel.IsExistingMatchingCard(cm.spcfilter,tp,LOCATION_MZONE,0,1,nil) and e:GetHandler():GetFlagEffect(m)>0 return Duel.GetAttacker()==e:GetHandler() and Duel.IsExistingMatchingCard(cm.spcfilter,tp,LOCATION_MZONE,0,1,nil) and e:GetHandler():GetFlagEffect(m)>0
end end
function cm.spfilter(c,e,tp) function cm.sp2filter(c,e,tp)
return not c:IsLevel(8) and c:IsSetCard(0x171) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP)
end
function cm.tgfilter(c,e,tp)
return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp,c) and c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end if chk==0 then return (Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.sp2filter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp)) or (Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(cm.sp2filter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp)) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end end
function cm.spop(e,tp,eg,ep,ev,re,r,rp) function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local cg=Duel.GetMatchingGroup(cm.spcfilter,tp,LOCATION_MZONE,0,nil) local cg=Duel.GetMatchingGroup(cm.spcfilter,tp,LOCATION_MZONE,0,nil)
--local ct=math.min(#cg,(Duel.GetLocationCount(tp,LOCATION_MZONE))) --local ct=math.min(#cg,(Duel.GetLocationCount(tp,LOCATION_MZONE)))
if cg>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then cg=1 end if cg>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then cg=1 end
local g=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil,e,tp) local g=Duel.GetMatchingGroup(cm.sp2filter,tp,LOCATION_HAND+LOCATION_DECK,0,nil,e,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroup(tp,aux.dncheck,false,1,cg) local sg=g:SelectSubGroup(tp,aux.dncheck,false,1,cg)
if sg then local bg=sg:GetCount()
if sg and ft>0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,bg,bg,nil,e,tp)
if Duel.Release(tc,REASON_COST) ~=0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end end
Duel.ResetFlagEffect(tp,m)
end end
......
--清风之珠玉圣骑
local m=40010406
local cm=_G["c"..m]
cm.named_with_JewelPaladin=1
function cm.JewelPaladin(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_JewelPaladin
end
function cm.initial_effect(c)
--spsummon cost
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_SPSUMMON_COST)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE)
e0:SetRange(LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED)
e0:SetOperation(cm.jpop)
c:RegisterEffect(e0)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
--Activate
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,m)
e2:SetTarget(cm.sptg)
e2:SetOperation(cm.spop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CUSTOM+m)
--e3:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
end
function cm.jpfilter(c)
return c:IsType(TYPE_MONSTER)
end
function cm.jpop(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(cm.jpfilter,tp,LOCATION_MZONE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=-1 then return end
--if Duel.GetFlagEffect(tp,m+2)>0 then return end
if sg:GetCount()>0 and ft>0 then
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
local g=Duel.SelectReleaseGroup(tp,cm.jpfilter,1,1,nil)
Duel.Release(g,REASON_COST)
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
e:GetHandler():RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
end
else
local g=Duel.SelectReleaseGroup(tp,cm.jpfilter,1,1,nil)
Duel.Release(g,REASON_COST)
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
e:GetHandler():RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
end
--e:GetLabelObject():SetLabel(0)
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
--Debug.Message("0")
local rc=e:GetHandler():GetReasonCard()
if rc then else rc=e:GetHandler():GetReasonEffect():GetHandler() end
if rc then
--Debug.Message("1")
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1)
e1:SetLabelObject(rc)
e1:SetOperation(cm.op2)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_SUMMON_SUCCESS)
Duel.RegisterEffect(e2,tp)
end
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetOwner()
local rc=e:GetLabelObject()
--Debug.Message("2")
if rc and rc==eg:GetFirst() and rc:GetSequence()==c:GetPreviousSequence() and rc:IsControler(tp) then
--Debug.Message("3")
--Duel.RaiseEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,nil,0,0,tp,0)
end
e:Reset()
end
function cm.tgfilter(c,e,tp)
return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,c) and c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0
end
function cm.spfilter(c,e,tp)
return cm.JewelPaladin(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return (Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)) or (Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp)) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 and ft>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
else
local tg=Duel.SelectMatchingCard(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
local tc=tg:GetFirst()
if tc and Duel.Release(tc,REASON_COST) ~=0 and tc:IsLocation(LOCATION_GRAVE) then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.RegisterFlagEffect(tp,m,RESET_EVENT+0x1fe0000+RESET_CHAIN,EFFECT_FLAG_OATH,1)
end
end
Duel.ResetFlagEffect(tp,m)
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