Commit 0cbb9e2a authored by songtongtong's avatar songtongtong

update lua

parent e8b5a991
--大户爱 黎明之光
local m=33503210
local cm=_G["c"..m]
local code=33503200
Duel.LoadScript("c33503200.lua")
function cm.initial_effect(c)
aux.AddCodeList(c,33503200)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--synchro level
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetCode(EFFECT_SYNCHRO_LEVEL)
e2:SetTarget(cm.imtg)
e2:SetValue(cm.slevel)
c:RegisterEffect(e2)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_FZONE)
e4:SetCountLimit(1)
e4:SetCost(cm.spcost)
e4:SetTarget(cm.sptg)
e4:SetOperation(cm.spop)
c:RegisterEffect(e4)
end
function cm.filter(c,e,tp,ft)
return c:IsCode(code)
and (c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_DECK,0,nil,e,tp,ft)
if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local tc=g:Select(tp,1,1,nil):GetFirst()
local opt=0
if not tc:IsAbleToHand() then
opt=1
elseif not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) or ft<=0 then
opt=0
else
opt=Duel.SelectOption(tp,1190,1152)
end
if opt==0 then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
end
function cm.imtg(e,c)
return c:IsCode(m-10)
end
function cm.slevel(e,c,rc)
return c:GetLevel()+2*65536
end
function cm.cfilter(c,ft,tp)
return c:IsCode(code)
and (ft>0 or (c:IsControler(tp) and c:GetSequence()<5)) and (c:IsControler(tp) or c:IsFaceup())
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then return ft>-1 and Duel.CheckReleaseGroup(tp,cm.cfilter,1,nil,ft,tp) end
local g=Duel.SelectReleaseGroup(tp,cm.cfilter,1,1,nil,ft,tp)
Duel.Release(g,REASON_COST)
end
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_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function cm.spfilter(c,e,tp)
return c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then
local hg=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,nil)
if hg:GetCount()>0 then
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=hg:Select(tp,1,1,nil)
Duel.SynchroSummon(tp,sg:GetFirst(),nil)
end
end
end
end
--大户爱 黎明之光
local m=33503210
local cm=_G["c"..m]
local code=33503200
Duel.LoadScript("c33503200.lua")
function cm.initial_effect(c)
aux.AddCodeList(c,33503200)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--synchro level
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SYNCHRO_LEVEL)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(cm.slevel)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e5:SetRange(LOCATION_SZONE)
e5:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e5:SetTargetRange(LOCATION_MZONE,0)
e5:SetTarget(cm.imtg)
e5:SetLabelObject(e2)
c:RegisterEffect(e5)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_FZONE)
e4:SetCountLimit(1)
e4:SetCost(cm.spcost)
e4:SetTarget(cm.sptg)
e4:SetOperation(cm.spop)
c:RegisterEffect(e4)
end
function cm.filter(c,e,tp,ft)
return c:IsCode(code)
and (c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_DECK,0,nil,e,tp,ft)
if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local tc=g:Select(tp,1,1,nil):GetFirst()
local opt=0
if not tc:IsAbleToHand() then
opt=1
elseif not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) or ft<=0 then
opt=0
else
opt=Duel.SelectOption(tp,1190,1152)
end
if opt==0 then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
end
function cm.imtg(e,c)
return c:IsCode(m-10)
end
function cm.slevel(e,c,rc)
local lv=aux.GetCappedLevel(e:GetHandler())
return (2<<16)+lv
end
function cm.cfilter(c,ft,tp)
return c:IsCode(code)
and (ft>0 or (c:IsControler(tp) and c:GetSequence()<5)) and (c:IsControler(tp) or c:IsFaceup())
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then return ft>-1 and Duel.CheckReleaseGroup(tp,cm.cfilter,1,nil,ft,tp) end
local g=Duel.SelectReleaseGroup(tp,cm.cfilter,1,1,nil,ft,tp)
Duel.Release(g,REASON_COST)
end
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_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function cm.spfilter(c,e,tp)
return c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then
local hg=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,nil)
if hg:GetCount()>0 then
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=hg:Select(tp,1,1,nil)
Duel.SynchroSummon(tp,sg:GetFirst(),nil)
end
end
end
end
end
\ No newline at end of file
--神心樱舞·厄科
function c66914013.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,nil,4,4,c66914013.ovfilter,aux.Stringid(66914013,0),4,c66914013.xyzop)
c:EnableReviveLimit()
--activate from hand
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_QP_ACT_IN_NTPHAND)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x373))
e1:SetTargetRange(LOCATION_HAND,0)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
c:RegisterEffect(e2)
--Overlay&Tohand
local e12=Effect.CreateEffect(c)
e12:SetCategory(CATEGORY_TOHAND)
e12:SetType(EFFECT_TYPE_QUICK_O)
e12:SetCode(EVENT_FREE_CHAIN)
e12:SetRange(LOCATION_MZONE)
e12:SetCost(c66914013.disrmcost)
e12:SetTarget(c66914013.disrmtg)
e12:SetOperation(c66914013.disrmop)
c:RegisterEffect(e12)
--
Duel.AddCustomActivityCounter(66914013,ACTIVITY_CHAIN,c66914013.chainfilter)
end
function c66914013.chainfilter(re,tp,cid)
return not (Duel.GetCurrentChain()>4)
end
function c66914013.ovfilter(c)
return c:IsFaceup() and c:IsCode(66914000)
end
function c66914013.xyzop(e,tp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,66914010)==0
and (Duel.GetCustomActivityCount(66914013,tp,ACTIVITY_CHAIN)>0
or Duel.GetCustomActivityCount(66914013,1-tp,ACTIVITY_CHAIN)>0) end
Duel.RegisterFlagEffect(tp,66914010,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c66914013.disrmcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(66914009)==0 end
c:RegisterFlagEffect(66914009,RESET_CHAIN,0,1)
end
function c66914013.disrmtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=e:GetHandler():GetOverlayGroup()
local b1=e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(c66914013.ofilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,1,e:GetHandler()) and Duel.GetFlagEffect(tp,6691408)==0
local b2=g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetFlagEffect(tp,6691405)==0
if chk==0 then return b1 or b2 end
end
function c66914013.ofilter(c,e)
return c:IsCanOverlay() and (not e or not c:IsImmuneToEffect(e)) and c:IsSetCard(0x373)
end
function c66914013.disrmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=e:GetHandler():GetOverlayGroup()
local b1=e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(c66914013.ofilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,1,e:GetHandler()) and Duel.GetFlagEffect(tp,6691408)==0
local b2=g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetFlagEffect(tp,6691405)==0
if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(66914013,1),aux.Stringid(66914013,2))
elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(66914013,1))
elseif b2 then op=Duel.SelectOption(tp,aux.Stringid(66914013,2))+1
else return end
if op==0 then
if c:IsRelateToEffect(e) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,c66914013.ofilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,1,1,e:GetHandler(),e)
local tc=g:GetFirst()
if tc then
Duel.Overlay(c,tc)
end
Duel.ShuffleDeck(tp)
end
Duel.RegisterFlagEffect(tp,6691408,RESET_PHASE+PHASE_END,0,1)
else
if c:IsRelateToEffect(e) then
local g=c:GetOverlayGroup()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=g:FilterSelect(tp,Card.IsAbleToHand,1,1,nil)
if tg:GetCount()>0 then
Duel.SendtoHand(tg,nil,REASON_EFFECT)
end
end
Duel.RegisterFlagEffect(tp,6691405,RESET_PHASE+PHASE_END,0,1)
end
--神心樱舞·厄科
function c66914013.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,nil,4,4,c66914013.ovfilter,aux.Stringid(66914013,0),4,c66914013.xyzop)
c:EnableReviveLimit()
--activate from hand
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_QP_ACT_IN_NTPHAND)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x373))
e1:SetTargetRange(LOCATION_HAND,0)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
c:RegisterEffect(e2)
--Overlay&Tohand
local e12=Effect.CreateEffect(c)
e12:SetCategory(CATEGORY_TOHAND)
e12:SetType(EFFECT_TYPE_QUICK_O)
e12:SetCode(EVENT_FREE_CHAIN)
e12:SetRange(LOCATION_MZONE)
e12:SetCost(c66914013.disrmcost)
e12:SetTarget(c66914013.disrmtg)
e12:SetOperation(c66914013.disrmop)
c:RegisterEffect(e12)
--
Duel.AddCustomActivityCounter(66914013,ACTIVITY_CHAIN,c66914013.chainfilter)
end
function c66914013.chainfilter(re,tp,cid)
return not (Duel.GetCurrentChain()>4)
end
function c66914013.ovfilter(c)
return c:IsFaceup() and c:IsCode(66914000)
end
function c66914013.xyzop(e,tp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,66914010)==0
and (Duel.GetCustomActivityCount(66914013,tp,ACTIVITY_CHAIN)>0
or Duel.GetCustomActivityCount(66914013,1-tp,ACTIVITY_CHAIN)>0) end
Duel.RegisterFlagEffect(tp,66914010,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c66914013.disrmcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(66914009)==0 end
c:RegisterFlagEffect(66914009,RESET_CHAIN,0,1)
end
function c66914013.disrmtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=e:GetHandler():GetOverlayGroup()
local b1=e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(c66914013.ofilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,1,e:GetHandler()) and Duel.GetFlagEffect(tp,6691408)==0
local b2=g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetFlagEffect(tp,6691405)==0
if chk==0 then return b1 or b2 end
end
function c66914013.ofilter(c,e)
return c:IsCanOverlay() and (not e or not c:IsImmuneToEffect(e)) and c:IsSetCard(0x373)
end
function c66914013.disrmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=e:GetHandler():GetOverlayGroup()
local b1=e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(c66914013.ofilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,0,1,e:GetHandler()) and Duel.GetFlagEffect(tp,6691408)==0
local b2=g:IsExists(Card.IsAbleToHand,1,nil) and Duel.GetFlagEffect(tp,6691405)==0
if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(66914013,1),aux.Stringid(66914013,2))
elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(66914013,1))
elseif b2 then op=Duel.SelectOption(tp,aux.Stringid(66914013,2))+1
else return end
if op==0 then
if c:IsRelateToEffect(e) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,c66914013.ofilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,1,1,e:GetHandler(),e)
local tc=g:GetFirst()
if tc then
if tc:IsStatus(STATUS_LEAVE_CONFIRMED) then
tc:CancelToGrave()
end
Duel.Overlay(c,tc)
end
Duel.ShuffleDeck(tp)
end
Duel.RegisterFlagEffect(tp,6691408,RESET_PHASE+PHASE_END,0,1)
else
if c:IsRelateToEffect(e) then
local g=c:GetOverlayGroup()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=g:FilterSelect(tp,Card.IsAbleToHand,1,1,nil)
if tg:GetCount()>0 then
Duel.SendtoHand(tg,nil,REASON_EFFECT)
end
end
Duel.RegisterFlagEffect(tp,6691405,RESET_PHASE+PHASE_END,0,1)
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment