Commit ca0a8305 authored by POLYMER's avatar POLYMER

fix

parent d2e80698
No preview for this file type
--深海姬·珊瑚
local m=13015712
local cm=_G["c"..m]
function c13015712.initial_effect(c)
--SpecialSummon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_ADD_SETCODE)
e0:SetRange(LOCATION_MZONE+LOCATION_SZONE)
e0:SetValue(0xe01)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1,m+100)
e2:SetCondition(cm.setcon)
e2:SetOperation(cm.tdop)
c:RegisterEffect(e2)
--SpecialSummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_GRAVE)
e4:SetCountLimit(1,m)
e4:SetCost(aux.bfgcost)
e4:SetTarget(c13015712.xsptg)
e4:SetOperation(c13015712.xspop)
c:RegisterEffect(e4)
end
function cm.penfilter(c)
return c:IsSetCard(0xe08) and c:IsType(TYPE_MONSTER)
and not c:IsForbidden()
end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,cm.penfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
local c=e:GetHandler()
local ph=Duel.GetCurrentPhase()
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SKIP_BP)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e2:SetTargetRange(1,0)
if Duel.GetTurnPlayer()==tp and ph>PHASE_MAIN1 and ph<PHASE_MAIN2 then
e2:SetLabel(Duel.GetTurnCount())
e2:SetCondition(cm.skipcon)
e2:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,2)
else
e2:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,1)
end
Duel.RegisterEffect(e2,tp)
end
end
function cm.skipcon(e)
return Duel.GetTurnCount()~=e:GetLabel()
end
function cm.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetType()==TYPE_SPELL+TYPE_CONTINUOUS and (Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)) and Duel.IsExistingMatchingCard(cm.penfilter,tp,LOCATION_DECK,0,1,nil) end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
c:RegisterEffect(e1)
end
end
function c13015712.xspfil(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsRace(RACE_AQUA)
end
function c13015712.xsptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c13015712.xspfil,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_REMOVED)
end
function c13015712.xspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(c13015712.xspfil,tp,LOCATION_GRAVE,0,nil,e,tp)
if g:GetCount()>0 then
local tc=g:Select(tp,1,1,nil):GetFirst()
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ADD_SETCODE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(0xe01)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
end
--人间客
local m=13090003
local cm=_G["c"..m]
function c13090003.initial_effect(c)
aux.EnablePendulumAttribute(c)
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_TOEXTRA)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_PZONE)
e3:SetCountLimit(1,13090003)
e3:SetTarget(cm.srtg)
e3:SetOperation(cm.srop)
c:RegisterEffect(e3)
c13090003.star_knight_spsummon_effect=e3
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DAMAGE)
e2:SetRange(LOCATION_EXTRA)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,23091003)
e2:SetCost(cm.cost)
e2:SetTarget(cm.settg)
e2:SetCondition(cm.con2)
e2:SetOperation(cm.setop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_REMOVE)
e3:SetCondition(cm.con3)
c:RegisterEffect(e3)
c13090003.star_knight_summon_effect=e2
end
function cm.spfilter(c,e)
return not c:IsImmuneToEffect(e)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil,e) end
local tc=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,e)
Duel.Release(tc,REASON_COST)
end
function cm.thfilter(c)
return c:IsSetCard(0xe08) and c:IsAbleToHand()
end
function cm.srtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) and e:GetHandler():IsAbleToExtra() and e:GetHandler() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,e:GetHandler(),1,0,0)
end
function cm.srop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.BreakEffect()
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
Duel.SendtoExtraP(e:GetHandler(),nil,REASON_EFFECT)
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,2)
e1:SetTargetRange(1,0)
e1:SetTarget(cm.splimit1)
Duel.RegisterEffect(e1,tp)
end
end
function cm.splimit1(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_HAND) or c:IsLocation(LOCATION_GRAVE) or c:IsLocation(LOCATION_REMOVED) or c:IsLocation(LOCATION_DECK)
end
function cm.penfilter(c)
return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsSetCard(0xe08)
end
function cm.settg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.penfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
end
end
function cm.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,cm.penfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,1,1,nil)
local tc=g:GetFirst()
if tc:IsType(TYPE_PENDULUM) and (Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)) then
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
elseif tc:IsType(TYPE_FIELD) then
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
else
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(tc)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
end
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0 and ep~=tp
end
function cm.con3(e,tp,eg,ep,ev,re,r,rp)
local aa=eg:GetFirst():GetControler()
return rp==tp and aa~=tp
end
--白驹过江
local m=13090004
local cm=_G["c"..m]
function c13090004.initial_effect(c)
aux.EnablePendulumAttribute(c)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_PZONE)
e2:SetCountLimit(1,m)
e2:SetCondition(cm.sccon)
e2:SetOperation(cm.tdop)
c:RegisterEffect(e2)
c13090004.star_knight_spsummon_effect=e2
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetRange(LOCATION_EXTRA)
e3:SetTargetRange(0,LOCATION_MZONE)
e3:SetTarget(aux.TargetBoolFunction(Card.IsFaceup))
e3:SetCondition(cm.con)
e3:SetValue(cm.atkval)
c:RegisterEffect(e3)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DESTROY_REPLACE)
e1:SetRange(LOCATION_EXTRA)
e1:SetTarget(cm.desreptg)
e1:SetValue(cm.desrepval)
e1:SetOperation(cm.desrepop)
c:RegisterEffect(e1)
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_TOGRAVE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_PHASE+PHASE_BATTLE_START)
e4:SetRange(LOCATION_EXTRA)
e4:SetCountLimit(1,m+100)
e4:SetCost(cm.cost)
e4:SetOperation(cm.grop)
c:RegisterEffect(e4)
end
function cm.exfilter(c)
return c:GetSummonLocation()==LOCATION_EXTRA
end
function cm.grop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(1-tp,function(c) return c:IsCode(13090004) end,1-tp,0,LOCATION_EXTRA,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.exfilter,1-tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TODECK)
if Duel.SelectYesNo(1-tp,aux.Stringid(13090004,0)) then
local sg=Duel.SelectMatchingCard(1-tp,cm.exfilter,1-tp,LOCATION_MZONE,0,1,1,nil)
Duel.SendtoDeck(sg,nil,2,REASON_COST)
end
end
function cm.con(e,tp)
local c=e:GetHandler()
return Duel.IsExistingMatchingCard(cm.atkfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil)
end
function cm.repfilter(c,tp)
return c:IsControler(tp) and (c:IsLocation(LOCATION_EXTRA) or c:IsLocation(LOCATION_SZONE)) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end
function cm.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return eg:IsExists(cm.repfilter,1,nil,tp)
and c:IsAbleToGrave() end
return Duel.SelectEffectYesNo(tp,c,96)
end
function cm.desrepval(e,c)
return cm.repfilter(c,e:GetHandlerPlayer())
end
function cm.desrepop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT+REASON_REPLACE)
end
function cm.atkfilter(c)
return c:IsFaceup() and c:IsSetCard(0xe08)
end
function cm.atkval(e,c)
return Duel.GetMatchingGroupCount(cm.atkfilter,e:GetHandlerPlayer(),LOCATION_EXTRA,0,nil)*-200
end
function cm.penfilter(c)
return c:IsCode(13090003)
end
function cm.sccon(e,tp)
local c=e:GetHandler()
return (Duel.IsExistingMatchingCard(function(c) return c:IsSetCard(0xe08) end,e:GetHandlerPlayer(),LOCATION_PZONE,0,1,c) or not Duel.IsExistingMatchingCard(nil,tp,LOCATION_PZONE,0,1,c)) and Duel.IsExistingMatchingCard(cm.penfilter,e:GetHandlerPlayer(),LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil)
end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,cm.penfilter,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
local tc=g:GetFirst()
if tc:IsType(TYPE_PENDULUM) then
Duel.SendtoExtraP(e:GetHandler(),nil,REASON_EFFECT)
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
else
Duel.SendtoExtraP(e:GetHandler(),nil,REASON_EFFECT)
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(tc)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
end
--白驹过江
local m=13090005
local cm=_G["c"..m]
function c13090005.initial_effect(c)
aux.EnablePendulumAttribute(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
c13090005.star_knight_spsummon_effect=e1
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DAMAGE)
e2:SetRange(LOCATION_EXTRA)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,m+100)
e2:SetCondition(cm.con2)
e2:SetCost(cm.cost)
e2:SetOperation(cm.setop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_REMOVE)
e3:SetCondition(cm.con3)
c:RegisterEffect(e3)
c13090005.star_knight_summon_effect=e2
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(function(c) return c:IsSetCard(0xe08) and c:IsAbleToGraveAsCost() and c:IsFaceup() end,tp,LOCATION_EXTRA,0,1,nil) end
local tc=Duel.SelectMatchingCard(tp,function(c) return c:IsSetCard(0xe08) and c:IsAbleToGraveAsCost() and c:IsFaceup() end,tp,LOCATION_EXTRA,0,1,1,nil)
Duel.SendtoGrave(tc,REASON_COST)
end
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0 and ep~=tp
end
function cm.con3(e,tp,eg,ep,ev,re,r,rp)
local aa=eg:GetFirst():GetControler()
return rp==tp and aa~=tp
end
function cm.stfilter1(c)
return c:IsSetCard(0xe08)
end
function cm.thfilter1(c)
return c:IsType(TYPE_QUICKPLAY)
end
function cm.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--[[延迟效果可以空发,所以没必要检测卡组中是否存在满足条件的卡
local b1=Duel.IsExistingMatchingCard(cm.thfilter1,tp,LOCATION_DECK,0,1,nil)
local b2=Duel.IsExistingMatchingCard(cm.stfilter1,tp,LOCATION_DECK,0,1,nil)
local op=0
local off=1
local ops={}
local opval={}
if true then
ops[off]=aux.Stringid(m,1)
opval[off-1]=1
off=off+1
end
if true then
ops[off]=aux.Stringid(m,2)
opval[off-1]=2
off=off+1
end]]
local op=Duel.SelectOption(tp,aux.Stringid(m,1),aux.Stringid(m,2))
if op==0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetLabel(Duel.GetTurnCount())
e1:SetCondition(cm.thcon)
e1:SetOperation(cm.thop)
if Duel.GetCurrentPhase()<=PHASE_STANDBY then
e1:SetReset(RESET_PHASE+PHASE_STANDBY,2)
else
e1:SetReset(RESET_PHASE+PHASE_STANDBY)
end
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetTargetRange(1,0)
e2:SetTarget(cm.splimit)
Duel.RegisterEffect(e2,tp)
end
if op==1 then
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCountLimit(1)
e3:SetLabel(Duel.GetTurnCount())
e3:SetCondition(cm.stcon)
e3:SetOperation(cm.stop)
if Duel.GetCurrentPhase()<=PHASE_STANDBY then
e3:SetReset(RESET_PHASE+PHASE_STANDBY,2)
else
e3:SetReset(RESET_PHASE+PHASE_STANDBY)
end
Duel.RegisterEffect(e3,tp)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_SKIP_BP)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e4:SetTargetRange(1,0)
local ph=Duel.GetCurrentPhase()
if Duel.GetTurnPlayer()==tp and ph>PHASE_MAIN1 and ph<PHASE_MAIN2 then
e4:SetLabel(Duel.GetTurnCount())
e4:SetCondition(cm.skipcon)
e4:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,2)
else
e4:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,1)
end
Duel.RegisterEffect(e4,tp)
end
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()~=e:GetLabel()
and Duel.IsExistingMatchingCard(cm.thfilter1,tp,LOCATION_DECK,0,1,nil)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,cm.thfilter1,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,tp,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function cm.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_HAND) or c:IsLocation(LOCATION_GRAVE) or c:IsLocation(LOCATION_REMOVED) or c:IsLocation(LOCATION_DECK)
end
function cm.stcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()~=e:GetLabel()
and Duel.IsExistingMatchingCard(cm.stfilter1,tp,LOCATION_DECK,0,1,nil)
end
function cm.stop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.SelectMatchingCard(tp,cm.stfilter1,tp,LOCATION_DECK,0,1,1,nil)
local b1=g:GetFirst():IsAbleToHand()
local b2=g:GetFirst():IsSSetable()
local op=0
local off=1
local ops={}
local opval={}
if b1 then
ops[off]=aux.Stringid(m,3)
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=aux.Stringid(m,4)
opval[off-1]=2
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
if opval[op]==1 then
Duel.SendtoHand(g,tp,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
elseif opval[op]==2 then
Duel.SSet(tp,g)
end
end
function cm.skipcon(e)
return Duel.GetTurnCount()~=e:GetLabel()
end
function cm.thfilter(c)
return c:IsSetCard(0xe08) and (c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP))
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) and e:GetHandler() and Duel.GetLocationCount(tp,LOCATION_SZONE) end
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.BreakEffect()
local tc=g:GetFirst()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetCode(EFFECT_CHANGE_TYPE)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e3:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e3)
end
end
--秋叶夏花
local m=13090006
local cm=_G["c"..m]
function c13090006.initial_effect(c)
aux.EnablePendulumAttribute(c)
--to szone
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,13090006)
e1:SetCondition(cm.condition)
e1:SetTarget(cm.tstg)
e1:SetOperation(cm.tsop)
c:RegisterEffect(e1)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
e4:SetRange(LOCATION_EXTRA)
e4:SetCode(EVENT_CHAINING)
e4:SetCountLimit(1,23090006)
e4:SetCondition(cm.con2)
e4:SetTarget(cm.target)
e4:SetOperation(cm.activate)
c:RegisterEffect(e4)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
if Duel.GetTurnPlayer()==tp then
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
else
return ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE
end
end
function cm.tsfilter(c,tp)
return c:IsSetCard(0xe08) and c:IsFaceup() and not c:IsCode(13090006)
end
function cm.tstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tsfilter,tp,LOCATION_EXTRA,0,1,nil) and e:GetHandler() end
end
function cm.tsop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.SelectMatchingCard(tp,cm.tsfilter,tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst()
e:SetLabelObject(tc)
local te=tc.star_knight_spsummon_effect
local tg=te:GetTarget()
local aa=e:GetLabelObject()
local bb=tc.star_knight_spsummon_effect
local op=bb:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
end
function cm.penfilter(c)
return c:IsFaceup() and c:IsSetCard(0xe08)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsLocation(LOCATION_EXTRA) end
local tc=eg:GetFirst()
Duel.ClearTargetCard()
e:SetLabelObject(tc)
local te=tc.star_knight_summon_effect
local tg=te:GetTarget()
if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end
Duel.ClearOperationInfo(0)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
local te=tc.star_knight_summon_effect
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
end
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
local rc=eg:GetFirst()
return rc:IsLocation(LOCATION_EXTRA) and rc:IsFaceup() and rc:IsSetCard(0xe08) and rc:IsLevelBelow(5)
end
\ No newline at end of file
--少时侠胆
local m=13090011
local cm=_G["c"..m]
function cm.initial_effect(c)
--Activate
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_PZONE)
e3:SetCountLimit(1,m+m)
e3:SetTarget(cm.target)
e3:SetOperation(cm.activate)
c:RegisterEffect(e3)
c13090011.star_knight_spsummon_effect=e3
--cannot special summon
local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.FALSE)
c:RegisterEffect(e0)
--c:RegisterEffect(e0)
--set rule
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCountLimit(1,23090011)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(cm.setcon)
e1:SetOperation(cm.setop)
c:RegisterEffect(e1)
--negate
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_SUMMON+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_EXTRA)
e2:SetCountLimit(1,m)
e2:SetCondition(cm.discon)
e2:SetCost(cm.discost)
e2:SetTarget(cm.distg)
e2:SetOperation(cm.disop)
c:RegisterEffect(e2)
end
--
function cm.setfilter(c,tp)
return (c:IsLocation(LOCATION_ONFIELD) or not c:IsForbidden())
and (c:IsType(TYPE_MONSTER) or c:GetType()==TYPE_SPELL+TYPE_CONTINUOUS)
and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
and c:CheckUniqueOnField(tp)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
return Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,1,nil,tp) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
end
end
function cm.f2(c)
return c:IsType(TYPE_MONSTER) end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 or Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g1=Duel.GetDecktopGroup(tp,1)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONFIRM)
local g2=Duel.GetDecktopGroup(1-tp,1)
local atpsl=g1:GetFirst()
local ntpsl=g2:GetFirst()
Duel.ConfirmCards(1-tp,atpsl)
Duel.ConfirmCards(tp,atpsl)
Duel.ConfirmCards(tp,ntpsl)
Duel.ConfirmCards(1-tp,ntpsl)
local atplv=atpsl:IsType(TYPE_MONSTER) and atpsl:GetAttack() or 0
local ntplv=ntpsl:IsType(TYPE_MONSTER) and ntpsl:GetAttack() or 0
if atplv<=ntplv then
local g=Duel.GetMatchingGroup(cm.setfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,nil,tp)
if #g<1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local sg=g:Select(tp,1,1,nil)
Duel.HintSelection(sg)
local tc=sg:GetFirst()
if not tc:IsImmuneToEffect(e) and Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
if tc:IsType(TYPE_MONSTER) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
end
end
Duel.ShuffleHand(tp)
Duel.ShuffleHand(1-tp)
end
--set rule
function cm.costfilter(c)
return c:IsReleasable()
end
function cm.cfilter1(c,g)
return c:IsSetCard(0xe08) and g:IsExists(Card.IsType,1,c,TYPE_SPELL)
end
function cm.fselect(g)
return g:IsExists(cm.cfilter1,1,nil,g) and g:IsExists(Card.IsType,1,nil,TYPE_SPELL)
end
function cm.setcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(cm.costfilter,tp,LOCATION_ONFIELD,0,nil)
return g:CheckSubGroup(cm.fselect,2,2) and c:IsFacedown() and c:IsLocation(LOCATION_EXTRA) and Duel.GetTurnPlayer()==tp and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function cm.setop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.costfilter,tp,LOCATION_ONFIELD,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
if Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
local sg=g:SelectSubGroup(tp,cm.fselect,true,2,2)
Duel.Release(sg,REASON_RULE)
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
--
function cm.discon(e,tp,eg,ep,ev,re,r,rp)
return ep==1-tp and re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and e:GetHandler():IsFaceup()
end
function cm.sumfilter(c)
return c:IsSummonable(true,nil)
end
function cm.discost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
if chk==0 then return true end
end
function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsOnField() end
if chk==0 then
if e:GetLabel()==0 then return false end
e:SetLabel(0)
return Duel.IsExistingMatchingCard(nil,tp,LOCATION_ONFIELD,0,1,nil,tp)
end
--cost
local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,0,1,1,nil)
e:SetLabel(0)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local c=e:GetHandler()
if tc:IsType(TYPE_SPELL) or tc:IsType(TYPE_TRAP) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
local e1=Effect.CreateEffect(e:GetHandler())
--e1:SetDescription(aux.Stringid(m,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SKIP_BP)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
Duel.RegisterEffect(e1,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_DRAW)
e3:SetCountLimit(1)
e3:SetLabel(Duel.GetTurnCount())
e3:SetCondition(cm.stcon)
e3:SetOperation(cm.stop)
if Duel.GetCurrentPhase()<=PHASE_DRAW then
e3:SetReset(RESET_PHASE+PHASE_DRAW,2)
else
e3:SetReset(RESET_PHASE+PHASE_DRAW)
end
Duel.RegisterEffect(e3,tp)
else
Duel.Release(tc,REASON_EFFECT)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCountLimit(1)
e3:SetLabel(Duel.GetTurnCount())
e3:SetCondition(cm.stcon)
e3:SetOperation(cm.stop2)
if Duel.GetCurrentPhase()<=PHASE_STANDBY then
e3:SetReset(RESET_PHASE+PHASE_STANDBY,2)
else
e3:SetReset(RESET_PHASE+PHASE_STANDBY)
end
Duel.RegisterEffect(e3,tp)
local e1=Effect.CreateEffect(e:GetHandler())
--e1:SetDescription(aux.Stringid(m,2))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetTargetRange(1,0)
e1:SetTarget(cm.splimit)
--e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
function cm.stcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()~=e:GetLabel()
end
function cm.stop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerCanDraw(tp,1) then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function cm.stop2(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,1,1,nil)
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
function cm.splimit(e,c)
return c:IsLocation(LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED)
end
--及冠纵横
local m=13090012
local cm=_G["c"..m]
function c13090012.initial_effect(c)
c:EnableReviveLimit()
aux.EnablePendulumAttribute(c)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_PZONE)
e3:SetCountLimit(1,13090012)
e3:SetTarget(cm.tstg)
e3:SetOperation(cm.tsop)
c:RegisterEffect(e3)
c13090012.star_knight_spsummon_effect=e3
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_ATTACK_ANNOUNCE)
e4:SetRange(LOCATION_EXTRA)
e4:SetCondition(cm.con)
e4:SetCountLimit(1,13091012)
e4:SetOperation(cm.negop)
c:RegisterEffect(e4)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_EXTRA)
e2:SetCountLimit(1,23090012)
e2:SetCondition(c13090012.espcon)
e2:SetOperation(c13090012.espop)
c:RegisterEffect(e2)
Duel.AddCustomActivityCounter(13090012,ACTIVITY_SPSUMMON,c13090012.chainfilter)
end
function c13090012.chainfilter(c)
return not c:IsSummonLocation(LOCATION_HAND+LOCATION_DECK+LOCATION_REMOVED+LOCATION_GRAVE)
end
function cm.tstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return (Duel.IsExistingMatchingCard(function(c) return Card.IsAbleToRemove end,tp,0,LOCATION_ONFIELD,1,nil) and Duel.GetCustomActivityCount(13090012,tp,ACTIVITY_SPSUMMON)==0)or (Duel.IsExistingMatchingCard(function(c) return Card.IsFaceup and c:IsSetCard(0xe08) end,tp,LOCATION_EXTRA+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)) end
end
function cm.penfilter(c)
return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsSetCard(0xe08)
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsFaceup() end
function cm.tsop(e,tp,eg,ep,ev,re,r,rp)
local b1=Duel.IsExistingMatchingCard(function(c) return Card.IsAbleToRemove end,tp,0,LOCATION_ONFIELD,1,nil) and Duel.GetCustomActivityCount(13090012,tp,ACTIVITY_SPSUMMON)==0
local b2=Duel.IsExistingMatchingCard(function(c) return Card.IsFaceup and c:IsSetCard(0xe08) end,tp,LOCATION_EXTRA+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)
local off=1
local ops={}
local opval={}
if b1 then
ops[off]=aux.Stringid(m,1)
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=aux.Stringid(m,2)
opval[off-1]=2
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
if opval[op]==1 then
local ta=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.Remove(ta,POS_FACEUP,REASON_EFFECT)
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e3:SetTargetRange(1,0)
e3:SetTarget(cm.splimit1)
Duel.RegisterEffect(e3,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetReset(RESET_PHASE+PHASE_END)
e2:SetTargetRange(1,0)
e2:SetTarget(cm.sumlimit)
Duel.RegisterEffect(e2,tp)
elseif opval[op]==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,cm.penfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
local tc=g:GetFirst()
if tc:IsType(TYPE_PENDULUM) and (Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)) then
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
elseif tc:IsType(TYPE_FIELD) then
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
else
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(tc)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
local ph=Duel.GetCurrentPhase()
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SKIP_BP)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e2:SetTargetRange(1,0)
if Duel.GetTurnPlayer()==tp and ph>PHASE_MAIN1 and ph<PHASE_MAIN2 then
e2:SetLabel(Duel.GetTurnCount())
e2:SetCondition(cm.skipcon)
e2:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,2)
else
e2:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,1)
end
Duel.RegisterEffect(e2,tp)
end
end
function cm.sumlimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_HAND) or c:IsLocation(LOCATION_GRAVE) or c:IsLocation(LOCATION_REMOVED) or c:IsLocation(LOCATION_DECK)
end
function cm.skipcon(e)
return Duel.GetTurnCount()~=e:GetLabel()
end
function cm.splimit1(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_HAND) or c:IsLocation(LOCATION_GRAVE) or c:IsLocation(LOCATION_REMOVED) or c:IsLocation(LOCATION_DECK)
end
function cm.negop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateAttack()
if Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g1=Duel.GetDecktopGroup(tp,1)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONFIRM)
local g2=Duel.GetDecktopGroup(1-tp,1)
local atpsl=g1:GetFirst()
local ntpsl=g2:GetFirst()
Duel.ConfirmCards(1-tp,atpsl)
Duel.ConfirmCards(tp,atpsl)
Duel.ConfirmCards(tp,ntpsl)
Duel.ConfirmCards(1-tp,ntpsl)
local atplv=atpsl:IsType(TYPE_MONSTER) and atpsl:GetAttack() or 0
local ntplv=ntpsl:IsType(TYPE_MONSTER) and ntpsl:GetAttack() or 0
if atplv<=ntplv then
local tc=Duel.GetAttacker()
if tc:IsAbleToDeck() then
Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)
end
end
end
end
function cm.espcon(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetHandlerPlayer()
local c=e:GetHandler()
return Duel.IsExistingMatchingCard(cm.espfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp) and c:IsFacedown() and Duel.GetTurnPlayer()==tp and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) end
function cm.espop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(cm.espfilter,tp,LOCATION_SZONE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local ta=Duel.SelectMatchingCard(tp,cm.espfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp):GetFirst()
local tc
if #g<2 or (#g==2 and (ta:IsLocation(LOCATION_SZONE) and (ta:GetSequence()==0 or ta:GetSequence()==4))) then tc=Duel.SelectMatchingCard(tp,cm.espfilter2,tp,LOCATION_ONFIELD,0,1,1,ta):GetFirst()
else
tc=Duel.SelectMatchingCard(tp,cm.espfilter3,tp,LOCATION_ONFIELD,0,1,1,ta):GetFirst()
end
Duel.Release(Group.FromCards(ta,tc),REASON_COST)
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
function cm.espfilter(c)
return c:GetSequence()==0 or c:GetSequence()==4
end
function cm.espfilter1(c,tp)
local g=Duel.GetMatchingGroup(cm.espfilter,tp,LOCATION_SZONE,0,nil)
if #g<2 then
return c:IsCode(13090011) and c:IsReleasable() and Duel.IsExistingMatchingCard(cm.espfilter2,tp,LOCATION_ONFIELD,0,1,c)
else
return (c:IsCode(13090011) and c:IsReleasable() and Duel.IsExistingMatchingCard(cm.espfilter2,tp,LOCATION_ONFIELD,0,1,c) and (c:IsLocation(LOCATION_SZONE) and(c:GetSequence()==0 or c:GetSequence()==4)))
or (c:IsCode(13090011) and c:IsReleasable() and Duel.IsExistingMatchingCard(cm.espfilter3,tp,LOCATION_SZONE,0,1,c) and not (c:IsLocation(LOCATION_SZONE) and(c:GetSequence()==0 or c:GetSequence()==4)))
end
end
function cm.espfilter2(c)
return c:IsType(TYPE_SPELL) and c:IsReleasable()
end
function cm.espfilter3(c)
return c:IsType(TYPE_SPELL) and c:IsReleasable() and (c:GetSequence()==0 or c:GetSequence()==4)
end
--壮年登峰
local m=13090013
local cm=_G["c"..m]
function c13090013.initial_effect(c)
c:EnableReviveLimit()
aux.EnablePendulumAttribute(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_EXTRA)
e2:SetCountLimit(1,23090013)
e2:SetCondition(cm.espcon)
e2:SetOperation(cm.espop)
c:RegisterEffect(e2)
--spsummon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_IGNITION)
e0:SetRange(LOCATION_PZONE)
e0:SetCountLimit(1,13090013)
e0:SetCost(cm.srcost)
e0:SetOperation(cm.srop)
c:RegisterEffect(e0)
c13090013.star_knight_spsummon_effect=e0
--p
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SUMMON)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_EXTRA)
e4:SetCondition(cm.spcon1)
e4:SetCost(cm.spcost1)
e4:SetCountLimit(1,13091113)
e4:SetOperation(cm.negop)
c:RegisterEffect(e4)
end
function cm.filter3(c)
return c:IsSummonable(true,nil)
end
function cm.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.SelectMatchingCard(tp,function(c) return c:IsAbleToHand() end,tp,LOCATION_ONFIELD+LOCATION_EXTRA,0,1,1,nil)
c:RegisterFlagEffect(13090015,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,2)
if Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and Duel.SelectYesNo(tp,aux.Stringid(13090013,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter3,tp,LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil)
end
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_ATTACK_FINAL)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(0)
e2:SetReset(RESET_EVENT+0xff0000)
tc:RegisterEffect(e2)
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENSE_FINAL)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0xff0000)
tc:RegisterEffect(e1)
local fid=e:GetHandler():GetFieldID()
tc:RegisterFlagEffect(m-1,RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD,0,1,fid)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetLabel(fid)
e1:SetLabelObject(tc)
e1:SetCondition(cm.thcon)
e1:SetOperation(cm.thop)
Duel.RegisterEffect(e1,tp)
end
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffectLabel(m-1)==e:GetLabel() then
return true
else
e:Reset()
return false
end
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
function cm.spcost1(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(function(c) return c:IsAbleToHand() end,tp,LOCATION_ONFIELD+LOCATION_EXTRA,0,1,nil) end
end
function cm.spcon1(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2) and e:GetHandler():IsFaceup() and e:GetHandler():GetFlagEffect(13090015)==0
end
function cm.srcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_GRAVE+LOCATION_REMOVED,1,nil) end
local tc=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_GRAVE+LOCATION_REMOVED,1,3,nil)
Duel.SendtoDeck(tc,nil,2,REASON_COST)
end
function cm.srop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.SendtoExtraP(e:GetHandler(),nil,REASON_EFFECT)>0 then
local op=0
if Duel.GetFlagEffect(tp,m)==0 and Duel.GetFlagEffect(tp,m+1)==0 then op=Duel.SelectOption(tp,aux.Stringid(m,1),aux.Stringid(m,2))
elseif Duel.GetFlagEffect(tp,m)>0 and Duel.GetFlagEffect(tp,m+1)==0 then op=Duel.SelectOption(tp,aux.Stringid(m,1))
elseif Duel.GetFlagEffect(tp,m)==0 and Duel.GetFlagEffect(tp,m+1)>0 then op=Duel.SelectOption(tp,aux.Stringid(m,2))+1
end
if op==0 then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetTargetRange(1,0)
e2:SetTarget(cm.splimit2)
Duel.RegisterEffect(e2,tp)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetCondition(cm.con)
e1:SetOperation(cm.damop)
Duel.RegisterEffect(e1,tp)
Duel.RegisterFlagEffect(tp,m,0,0,1)
else
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetCountLimit(1)
e3:SetCondition(cm.con)
e3:SetOperation(cm.rmop)
Duel.RegisterEffect(e3,tp)
Duel.RegisterFlagEffect(tp,m+1,0,0,1)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_SKIP_BP)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e4:SetTargetRange(1,0)
Duel.RegisterEffect(e4,tp)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_REMOVE)
e5:SetOperation(cm.regop)
e5:SetLabel(tp)
Duel.RegisterEffect(e5,tp)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_CANNOT_ACTIVATE)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(0,1)
e6:SetValue(cm.actlimit)
Duel.RegisterEffect(e6,tp)
end
end
end
function cm.regop(e,tp,eg,ep,ev,re,r,rp)
for tc in aux.Next(eg) do
if tc:GetReasonPlayer()==e:GetLabel() then
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,2,0,1)
end
end
end
function cm.actlimit(e,re,tp)
return re:GetHandler():GetFlagEffect(m)>0
end
function cm.con(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function cm.damop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetTurnCount(tp)
local tb=Duel.GetTurnCount(1-tp)
local ta=tb+tc
Duel.Damage(1-tp,math.floor(ta*200),REASON_EFFECT)
end
function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetTurnCount(tp)
local tb=Duel.GetTurnCount(1-tp)
local ta=tb+tc
local tg=Duel.GetDecktopGroup(1-tp,ta)
if #tg==0 then return end
Duel.DisableShuffleCheck()
Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)
end
function cm.splimit2(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_HAND) or c:IsLocation(LOCATION_GRAVE) or c:IsLocation(LOCATION_REMOVED) or c:IsLocation(LOCATION_DECK)
end
function cm.rmfilter(c,rc)
return c:IsFaceup() and c:IsAttribute(rc) and c:IsStatus(STATUS_EFFECT_ENABLED)
end
function cm.con3(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return Duel.IsExistingMatchingCard(function(c) return c:IsSetCard(0xe08) end,tp,LOCATION_ONFIELD,0,1,nil) and c:IsFaceup() end
function cm.espcon(e,tp,eg,ep,ev,re,r,rp)
local tp=e:GetHandlerPlayer()
local c=e:GetHandler()
local ph=Duel.GetCurrentPhase()
return Duel.GetTurnPlayer()==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2) and Duel.IsExistingMatchingCard(cm.espfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp) and c:IsFacedown()
end
function cm.espop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(cm.espfilter,tp,LOCATION_SZONE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local ta=Duel.SelectMatchingCard(tp,cm.espfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp):GetFirst()
local tc
if #g<2 or (#g==2 and (ta:IsLocation(LOCATION_SZONE) and (ta:GetSequence()==0 or ta:GetSequence()==4))) then tc=Duel.SelectMatchingCard(tp,cm.espfilter2,tp,LOCATION_ONFIELD,0,1,1,ta):GetFirst()
else
tc=Duel.SelectMatchingCard(tp,cm.espfilter3,tp,LOCATION_ONFIELD,0,1,1,ta):GetFirst()
end
Duel.Release(Group.FromCards(ta,tc),REASON_COST)
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
function cm.espfilter(c)
return c:GetSequence()==0 or c:GetSequence()==4
end
function cm.espfilter1(c,tp)
local g=Duel.GetMatchingGroup(cm.espfilter,tp,LOCATION_SZONE,0,nil)
if #g<2 then
return c:IsCode(13090012) and c:IsReleasable() and Duel.IsExistingMatchingCard(cm.espfilter2,tp,LOCATION_ONFIELD,0,1,c)
else
return (c:IsCode(13090012) and c:IsReleasable() and Duel.IsExistingMatchingCard(cm.espfilter2,tp,LOCATION_ONFIELD,0,1,c) and (c:IsLocation(LOCATION_SZONE) and(c:GetSequence()==0 or c:GetSequence()==4)))
or (c:IsCode(13090012) and c:IsReleasable() and Duel.IsExistingMatchingCard(cm.espfilter3,tp,LOCATION_SZONE,0,1,c) and not (c:IsLocation(LOCATION_SZONE) and(c:GetSequence()==0 or c:GetSequence()==4)))
end
end
function cm.espfilter2(c)
return c:IsType(TYPE_SPELL) and c:IsReleasable()
end
function cm.espfilter3(c)
return c:IsType(TYPE_SPELL) and c:IsReleasable() and (c:GetSequence()==0 or c:GetSequence()==4)
end
\ No newline at end of file
--泥销骨
local s,id,o=GetID()
function s.initial_effect(c)
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(id,2))
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetOperation(s.operation)
c:RegisterEffect(e0)
--disable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-1600)
c:RegisterEffect(e1)
--equip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SUMMON_SUCCESS)
c:RegisterEffect(e3)
--set
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(s.setcon)
e4:SetOperation(s.setop)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_ADJUST)
e5:SetRange(LOCATION_SZONE)
e5:SetCondition(s.descon)
e5:SetOperation(s.desop)
c:RegisterEffect(e5)
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetEquipTarget()
if c==nil then return end
return c:IsAttack(0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetEquipTarget()
Duel.Destroy(c,REASON_EFFECT)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local tc=g:Select(tp,1,1,nil):GetFirst()
Duel.Equip(tp,c,tc)
local aa
local atk=tc:GetBaseAttack()
if tc:IsType(TYPE_XYZ) then aa=tc:GetRank()
elseif tc:IsType(TYPE_LINK) then aa=tc:GetLink()
else aa=tc:GetLevel() end
e:SetLabel(atk,aa)
--Add Equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetLabelObject(tc)
e1:SetValue(s.eqlimit)
c:RegisterEffect(e1)
end
end
--equip
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget()==nil
end
function s.tgfilter(c,tp,g)
return g:IsContains(c) and c:IsFaceup()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=eg
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc,tp,g) end
if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp,g) end
if g:GetCount()==1 then
Duel.SetTargetCard(g)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp,g)
end
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsLocation(LOCATION_SZONE) then return end
if not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(s.eqlimit)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
e2:SetLabelObject(tc)
c:RegisterEffect(e2)
else
c:CancelToGrave(false)
end
end
function s.eqlimit(e,c)
return c==e:GetLabelObject()
end
--set
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_LOST_TARGET)
and not e:GetHandler():GetPreviousEquipTarget():IsLocation(LOCATION_ONFIELD+LOCATION_OVERLAY)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetHandler():GetPreviousEquipTarget()
if tc==nil then return end
local atk=tc:GetBaseAttack()
local ct=tc:GetLevel()
if tc:IsType(TYPE_XYZ) then ct=tc:GetRank() elseif tc:IsType(TYPE_LINK) then ct=tc:GetLink() end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetValue(-500)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local rg1=Duel.GetDecktopGroup(1-tp,1)
local rg2=Duel.GetDecktopGroup(1-tp,1)
local b1=true
local b2=rg1:FilterCount(Card.IsAbleToRemove,nil)>=1
local off=1
local ops={}
local opval={}
if b1 then
ops[off]=1122
opval[off-1]=1
off=off+1
end
if b2 then
ops[off]=1102
opval[off-1]=2
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
if opval[op]==1 then
Duel.Damage(1-tp,200,REASON_EFFECT)
elseif opval[op]==2 then
Duel.BreakEffect()
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(96633955,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_REMOVE)
e1:SetOperation(s.regop)
e1:SetLabel(tp)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(0,1)
e2:SetValue(s.actlimit)
e2:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e2,tp)
Duel.Remove(rg1,POS_FACEUP,REASON_EFFECT)
--
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
for tc in aux.Next(eg) do
if tc:GetReasonPlayer()==e:GetLabel() then
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,2,0,1)
end
end
end
function s.actlimit(e,re,tp)
return re:GetHandler():GetFlagEffect(id)>0
end
\ No newline at end of file
--雪满头
local s,id=GetID()
function c13090021.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetCountLimit(1,id)
e1:SetCondition(s.con)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DAMAGE)
e2:SetRange(LOCATION_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,id+100)
e2:SetTarget(s.settg)
e2:SetCost(s.thcost)
e2:SetCondition(s.con2)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_REMOVE)
e3:SetCondition(s.con3)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e4:SetCondition(s.handcon)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e5:SetCode(EVENT_TO_HAND)
e5:SetOperation(s.spop)
c:RegisterEffect(e5)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(13090021,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function s.handcon(e)
return e:GetHandler():GetFlagEffect(13090021)~=0
end
function s.con2(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0 and ep~=tp and aux.exccon(e)
end
function s.con3(e,tp,eg,ep,ev,re,r,rp)
local aa=eg:GetFirst():GetControler()
return rp==tp and aa~=tp and aux.exccon(e)
end
function s.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0xe08)
end
function s.con(e)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_EXTRA,0,1,nil)
end
function s.disfilter(c)
return aux.NegateAnyFilter and c:IsFaceup()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and aux.NegateAnyFilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
Duel.SelectTarget(tp,aux.NegateAnyFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsCanBeDisabledByEffect(e,false) then
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
if tc:IsType(TYPE_TRAPMONSTER) then
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
end
end
end
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end
Duel.SendtoDeck(e:GetHandler(),nil,2,REASON_COST)
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)
if Duel.Draw(tp,1,REASON_EFFECT)==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then
Duel.BreakEffect()
Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT)
end
end
--朝如青丝暮成雪
local m=13090022
local cm=_G["c"..m]
function c13090022.initial_effect(c)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_FZONE)
e1:SetCountLimit(1,13090022)
e1:SetTarget(cm.settg)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e4:SetCountLimit(1,13091022)
e4:SetCost(cm.cost)
e4:SetCondition(cm.con)
e4:SetOperation(cm.prop)
c:RegisterEffect(e4)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeckAsCost,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeckAsCost,tp,LOCATION_HAND,0,1,1,nil)
Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_COST)
end
function cm.con(e,tp,eg,ep,ev,re,r,rp,chk)
return Duel.IsExistingMatchingCard(cm.penfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) and Duel.IsExistingMatchingCard(function(c) return not c:IsSetCard(0xe08) end,tp,LOCATION_HAND,0,1,nil)
end
function cm.penfilter(c)
return (c:IsFaceup() or c:IsLocation(LOCATION_DECK)) and c:IsSetCard(0xe08)
end
function cm.settg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(cm.penfilter,tp,LOCATION_EXTRA+LOCATION_DECK,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)
end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,cm.penfilter,tp,LOCATION_EXTRA+LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc:IsType(TYPE_PENDULUM) then
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
else
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(tc)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
Duel.Destroy(c,REASON_EFFECT)
local op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1))
if op==0 then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetTargetRange(1,0)
e2:SetTarget(cm.splimit)
Duel.RegisterEffect(e2,tp)
else
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_SKIP_BP)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e4:SetTargetRange(1,0)
Duel.RegisterEffect(e4,tp)
end
end
function cm.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsLocation(LOCATION_HAND) or c:IsLocation(LOCATION_GRAVE) or c:IsLocation(LOCATION_REMOVED) or c:IsLocation(LOCATION_DECK)
end
function cm.prop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.SelectMatchingCard(tp,function(c) return not c:IsSetCard(0xe08) end,tp,LOCATION_HAND,0,1,1,nil)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
local tc=g:GetFirst()
local t={}
local ta=1
local i=0
while i<=0xffff do
if tc:IsSetCard(i) then
t[ta]=i
ta=ta+1
end
i=i+1
end
if Duel.IsExistingMatchingCard(function(c,t) return (c:IsSetCard(t[1]) or c:IsSetCard(t[2]) or c:IsSetCard(t[3])) and c:IsType(TYPE_FIELD) end,tp,LOCATION_DECK,0,1,nil,t) then
local tb=Duel.SelectMatchingCard(tp,function(c,t) return (c:IsSetCard(t[1]) or c:IsSetCard(t[2]) or c:IsSetCard(t[3])) and c:IsType(TYPE_FIELD) end,tp,LOCATION_DECK,0,1,1,nil,t):GetFirst()
if tb then
local te=tb:GetActivateEffect()
local b1=tb:IsAbleToHand()
local b2=te:IsActivatable(tp,true,true)
if b1 and (not b2 or Duel.SelectOption(tp,1190,1150)==0) then
Duel.SendtoHand(tb,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tb)
else
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tb,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
te:UseCountLimit(tp,1,true)
local tep=tb:GetControler()
local cost=te:GetCost()
if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end
Duel.RaiseEvent(tb,4179255,te,0,tp,tp,Duel.GetCurrentChain())
end
local op=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1))
if op==0 then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetTargetRange(1,0)
e2:SetTarget(cm.splimit)
Duel.RegisterEffect(e2,tp)
else
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_SKIP_BP)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e4:SetTargetRange(1,0)
Duel.RegisterEffect(e4,tp)
end
end
end
end
end
......@@ -68,8 +68,12 @@ end
function cm.thop2(e,tp,eg,ep,ev,re,r,rp)
local tc1,tc2=Duel.GetFirstTarget()
if tc1~=e:GetLabelObject() then tc1,tc2=tc2,tc1 end
if cm.setfilter(tc2,tc1:GetColumnZone(LOCATION_SZONE,tp)) then
if tc1:IsRelateToEffect(e) and tc2:IsRelateToEffect(e) and Duel.SSet(tp,tc2,tc1:GetColumnZone(LOCATION_SZONE,tp))~=0 then
local seq=aux.GetColumn(tc1,tp)
if cm.setfilter(tc2) and Duel.CheckLocation(tp,LOCATION_SZONE,seq) then
if tc1:IsRelateToEffect(e) and tc2:IsRelateToEffect(e) and Duel.MoveToField(tc2,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false,1<<seq) then
tc2:SetStatus(STATUS_SET_TURN,true)
Duel.RaiseEvent(tc2,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.ConfirmCards(1-tp,tc2)
local g=tc2:GetColumnGroup()
local sg=g:Filter(cm.ofilter6,nil,tp)
if sg:GetCount()>0 then
......
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