Commit 0c713bfb authored by POLYMER's avatar POLYMER

fix

parent ca03f9f8
--OneInAMillion --白露未已
local s,id,o=GetID() local cm, m, o = GetID()
function s.initial_effect(c) local yr = 13020010
aux.AddCodeList(c,13020032) xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end)
--Activate function cm.initial_effect(c)
local e1=Effect.CreateEffect(c) c:EnableReviveLimit()
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTarget(s.target) e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetCountLimit(1,id) e1:SetValue(aux.FALSE)
e1:SetOperation(s.activate) c:RegisterEffect(e1)
c:RegisterEffect(e1)
--back local e2 = Effect.CreateEffect(c)
local e3=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD)
e3:SetDescription(aux.Stringid(id,0)) e2:SetCode(EFFECT_SPSUMMON_PROC)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
e3:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_EXTRA)
e3:SetCode(EVENT_FREE_CHAIN) e2:SetCountLimit(1, m)
e3:SetRange(0x30) e2:SetCondition(cm.condition)
e3:SetCountLimit(1,id) e2:SetOperation(cm.operation)
e3:SetCost(s.spcost) c:RegisterEffect(e2)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop) local e11 = Effect.CreateEffect(c)
c:RegisterEffect(e3) -- e11:SetDescription(aux.Stringid(m, 0))
e11:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
e11:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
e11:SetProperty(EFFECT_FLAG_DELAY)
e11:SetCode(EVENT_SPSUMMON_SUCCESS)
e11:SetCost(cm.cost)
e11:SetTarget(cm.drtg)
e11:SetOperation(cm.drop)
c:RegisterEffect(e11)
if not cm.global_check then
cm.global_check = true
local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_ADJUST)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e4:SetOperation(cm.adop)
Duel.RegisterEffect(e4, tp)
end
end end
function s.ckfi1ter(c)
return c:GetSequence()==0 function cm.cfilter(c, e, tp, sc)
return c:IsAbleToDeckAsCost() and aux.IsCodeListed(c, yr) and (c:IsLocation(QY_sk) or
Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0)
end end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0x01,0)>0 end function cm.cfilter2(c, e, tp, sc)
return c:IsAbleToExtraAsCost() and Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0
end end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() function cm.condition(e, tp, eg, ep, ev, re, r, rp)
local g=Duel.GetMatchingGroup(s.ckfi1ter,tp,0x01,0,nil) local c = e:GetHandler()
if #g>0 then local g = Duel.GetMatchingGroup(cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil, e, tp, c)
local tc=g:GetFirst() local g2 = Duel.GetMatchingGroup(cm.cfilter2, tp, LOCATION_ONFIELD, 0, nil, e, tp, c)
Duel.MoveSequence(tc,SEQ_DECKTOP) return #g > 0 and #g2 > 0
Duel.ConfirmDecktop(tp,1)
local ThCheck=false
local LockCheck=true
if tc:IsType(TYPE_RITUAL) then
LockCheck=false
if tc:IsAbleToHand() and Duel.SendtoHand(tc,nil,0x40)>0 then
Duel.ConfirmCards(1-tp,tc)
ThCheck=true
end
end
if not ThCheck then
Duel.MoveSequence(tc,SEQ_DECKBOTTOM)
end
if LockCheck then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetValue(s.aclimit)
e1:SetLabel(13020040)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
end end
function s.aclimit(e,re,tp)
return re:GetHandler():IsCode(e:GetLabel()) function cm.operation(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g1 = Duel.SelectMatchingCard(tp, cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, 1, 1, nil, e, tp, c)
local g2 = Duel.SelectMatchingCard(tp, cm.cfilter2, tp, LOCATION_ONFIELD, 0, 1, 1, g1, e, tp, c)
g2:Merge(g1)
c:SetMaterial(g2)
Duel.SendtoDeck(g2, tp, SEQ_DECKSHUFFLE, REASON_COST + REASON_MATERIAL)
end end
function s.rlfil(c)
return c:IsReleasable() and c:GetOriginalType()&TYPE_MONSTER>0 function cm.cfilter3(c, e, tp, sc)
return (c:IsAbleToRemove() or c:IsAbleToGrave()) and aux.IsCodeListed(c, yr)
end end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.rlfil,tp,0x06,0,1,nil) function cm.cost(e, tp, eg, ep, ev, re, r, rp, chk)
and e:GetHandler():IsAbleToHandAsCost() end local g = Duel.GetMatchingGroup(cm.cfilter3, tp, QY_kz, 0, nil)
Duel.Hint(3,tp,500) if chk == 0 then return #g > 0 end
local g=Duel.SelectMatchingCard(tp,s.rlfil,tp,0x0e,0,1,1,e:GetHandler()) Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
Duel.Release(g,REASON_COST) if #g == 0 then return end
Duel.SendtoHand(e:GetHandler(),nil,REASON_COST) local sg = g:Select(tp, 1, 1, nil):GetFirst()
local off = 1
local ops = {}
local opval = {}
if sg:IsAbleToRemove() then
ops[off] = aux.Stringid(m, 0)
opval[off - 1] = 1
off = off + 1
end
if sg:IsAbleToGrave() then
ops[off] = aux.Stringid(m, 1)
opval[off - 1] = 2
off = off + 1
end
local op = Duel.SelectOption(tp, table.unpack(ops))
if opval[op] == 1 then
Duel.SendtoGrave(sg, REASON_EFFECT)
elseif opval[op] == 2 then
Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
end
e:SetLabel(sg:GetCode())
end end
function s.rlgck(g,sc,tp)
Duel.SetSelectedCard(g) function cm.cfilter4(c, code)
return g:CheckWithSumGreater(Card.GetLevel,sc:GetLevel()) return c:IsAbleToHand() and aux.IsCodeListed(c, yr) and not c:IsCode(code)
and g:FilterCount(Card.IsLocation,nil,0x04)<=1
and Duel.GetMZoneCount(tp,g)>0
end
function s.rspfi1ter(c,e,tp)
local g=Duel.GetMatchingGroup(s.matfilter,c:GetControler(),0x36,0,c)
return c:IsType(TYPE_RITUAL) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true)
and g:CheckSubGroup(s.rlgck,1,1,c,tp)
end
function s.matfilter(c)
return ((c:IsLocation(0x32) and c:IsAbleToDeck())
or (c:IsLocation(0x04) and c:IsReleasableByEffect()))
and c:IsType(TYPE_RITUAL) and c:IsLevelAbove(1)
end end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.rspfi1ter,tp,0x70,0,1,c,e,tp) end function cm.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0x02) local c = e:GetHandler()
local code = e:GetLabel()
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
if chk == 0 then return #g > 0 end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, QY_kz + QY_md + QY_cw)
end
function cm.drop(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local code = e:GetLabel()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
local sg = g:Select(tp, 1, 1, nil)
Duel.SendtoHand(sg, tp, REASON_EFFECT)
if Duel.SelectYesNo(tp, aux.Stringid(m, 2)) then
local g = Duel.GetFieldGroup(tp, LOCATION_HAND, 0):Select(tp, 1, 1, nil)
if g:GetCount() > 0 then
Duel.BreakEffect()
if Duel.SendtoDeck(g, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) ~= 0 then
Duel.RegisterFlagEffect(tp, m, RESET_PHASE + PHASE_END, 0, 2)
end
end
end
end
function cm.adop(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local ng = Duel.GetMatchingGroup(cm.filsn, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + QY_kz, 0, nil)
local nc = ng:GetFirst()
while nc do
if not cm.reg then
cm.reg = Card.RegisterEffect
Card.RegisterEffect = cm.reg2
end
nc:RegisterFlagEffect(m, 0, 0, 1)
nc:ReplaceEffect(nc:GetOriginalCodeRule(), 0)
nc = ng:GetNext()
end
end
function cm.filsn(c)
return aux.IsCodeListed(c, yr) and c:GetFlagEffect(m) == 0
end
function cm.reg2(c, ie, ob)
local b = ob or false
local p = ie:GetCode()
local id, ida = ie:GetCountLimit()
if not aux.IsCodeListed(c, yr) and (not ie:IsActivated() or not id or not ida) or
bit.band(ie:GetProperty(), EFFECT_FLAG_CARD_TARGET) == 0 then
return cm.reg(c, ie, b)
end
-- Debug.Message(id, ida)
local co = ie:GetCondition()
local ie2 = ie:Clone()
if id or ida then
ie2:SetCountLimit(id + 1, ida)
end
ie2:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code > 0
end)
if bit.band(ie2:GetProperty(), EFFECT_FLAG_CARD_TARGET) ~= 0 then
local tn = ie:GetTarget()
ie2:SetProperty(ie2:GetProperty() - EFFECT_FLAG_CARD_TARGET)
ie2:SetTarget(function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
local exis = Duel.IsExistingTarget
local exis2 = Duel.SelectTarget
local operat = Duel.SetOperationInfo
Duel.IsExistingTarget = function(fun, tp2, s1, o1, num, cg, ...)
-- cm[ie2] = { tp, fun, tp2, s1, o1, num, cg, ... }
return Duel.IsExistingMatchingCard(fun, tp2, s1, o1, num, cg, ...)
end
Duel.SelectTarget = function(tp1, fun, tp2, s1, o1, min, max, cg, ...)
local t = { ... }
for _, va in ipairs(t) do
if aux.GetValueType(va) == "Group" then
Group.KeepAlive(va)
end
end
cm[ie2] = { tp1, fun, tp2, s1, o1, min, max, cg, { ... } }
-- Duel.ConfirmCards(tp, table.unpack({ ... }))
return Group.CreateGroup()
end
Duel.SetOperationInfo = function(chainc, category, targets, count, target_player, target_param)
return operat(chainc, category, nil, count, target_player, target_param)
end
local jg = tn(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
Duel.IsExistingTarget = exis
Duel.SelectTarget = exis2
Duel.SetOperationInfo = operat
return jg
end)
local op = ie:GetOperation()
ie2:SetOperation(function(e, tp, eg, ep, ev, re, r, rp)
local ma = cm[ie2]
-- Debug.Message(ma[0])
-- Debug.Message(ma[1])
-- Debug.Message(ma[2])
-- Debug.Message(ma[3])
-- Debug.Message(ma[4])
-- Debug.Message(ma[5])
-- Debug.Message(ma[6])
-- Debug.Message(table.unpack(ma[8]))
-- Duel.ConfirmCards(tp, table.unpack(ma[9]))
local g = Duel.SelectMatchingCard(ma[1], ma[2], ma[3], ma[4], ma[5], ma[6], ma[7], ma[8],
table.unpack(ma[9]))
--ma[0], ma[1], ma[2], ma[3], ma[4], 1, ma[5],ma[6], table.unpack(ma[7])
-- local g = Group.CreateGroup()
local xta = Duel.GetFirstTarget
Duel.GetFirstTarget = function() return g:GetFirst(), g:GetNext(), g:GetNext(), g:GetNext() end
for tc in aux.Next(g) do
tc:CreateEffectRelation(e)
end
op(e, tp, eg, ep, ev, re, r, rp)
Duel.GetFirstTarget = xta
end)
end
ie:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code == 0
end)
return cm.reg(c, ie, b), cm.reg(c, ie2, b)
end end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then return end
::cancel::
local mg=Duel.GetMatchingGroup(s.matfilter,tp,0x36,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,s.rspfi1ter,tp,0x70,0,1,1,nil,e,tp,mg)
if tg:GetCount()>0 then
local tc=tg:GetFirst()
mg:RemoveCard(tc)
local lv=tc:GetLevel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local mat=mg:SelectSubGroup(tp,s.rlgck,false,1,1,tc,tp)
if not mat then goto cancel end
tc:SetMaterial(mat)
local check=false
local matg=mat:Filter(Card.IsCode,nil,13020032)
if mat:FilterCount(Card.IsLocation,nil,0x0c)>0 then
check=true
elseif #matg>0 then
local ctc=matg:GetFirst()
if ctc:IsLocation(0x02) then Duel.ConfirmCards(1-tp,ctc) end
if ctc:IsLocation(0x10) then Duel.HintSelection(matg) end
check=true
end
local mg1=mat:Filter(Card.IsLocation,nil,0x32)
local mg2=mat:Filter(Card.IsLocation,nil,0x04)
if #mg1>0 then Duel.SendtoDeck(mg1,nil,2,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL) end
if #mg2>0 then Duel.Release(mg2,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL) end
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
if check then
local g=Duel.GetFieldGroup(tp,0x1c,0x1c):Filter(Card.IsAbleToHand,nil)
if #g>0 then
Duel.Hint(3,tp,505)
local sg=g:Select(tp,1,1,nil)
Duel.HintSelection(sg)
Duel.SendtoHand(sg,nil,0x40)
end
end
end
end
\ No newline at end of file
...@@ -9,8 +9,8 @@ function cm.initial_effect(c) ...@@ -9,8 +9,8 @@ function cm.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND) e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_QUICK_O) e1:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_SPSUMMON) e1:SetCode(EVENT_SPSUMMON)
e1:SetRange(LOCATION_HAND) e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,m) e1:SetCountLimit(1,m)
e1:SetCondition(cm.discon) e1:SetCondition(cm.discon)
......
...@@ -16,8 +16,8 @@ function s.filter(c) ...@@ -16,8 +16,8 @@ function s.filter(c)
end end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) 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 chkc then return chkc:IsOnField() and aux.NegateAnyFilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(aux.NegateAnyFilter,tp,0,LOCATION_ONFIELD,1,nil) end
local sgt=Duel.GetMatchingGroupCount(s.filter,tp,LOCATION_MZONE,0,nil) local sgt=Duel.GetMatchingGroupCount(s.filter,tp,LOCATION_MZONE,0,nil)
if chk==0 then return sgt>0 and Duel.IsExistingTarget(aux.NegateAnyFilter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,aux.NegateAnyFilter,tp,0,LOCATION_ONFIELD,1,sgt,nil) Duel.SelectTarget(tp,aux.NegateAnyFilter,tp,0,LOCATION_ONFIELD,1,sgt,nil)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment