Commit c2e5b9fa authored by POLYMER's avatar POLYMER

fix

parent 60d901d2
......@@ -57,6 +57,10 @@ function cm.initial_effect(c)
Duel.Hint(HINT_CARD,0,m)
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
Duel.ConfirmCards(1-tp,c)
if e:GetDescription()==0 then
e:SetDescription(aux.Stringid(11451531,3))
e:SetProperty(e:GetProperty()|EFFECT_FLAG_CLIENT_HINT)
end
local eid=_RegisterEffect(tc,e,bool)
Duel.Draw(tp,1,REASON_EFFECT)
return eid
......
......@@ -34,7 +34,7 @@ function cm.initial_effect(c)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(aux.TargetEqualFunction(Card.GetType,0x4))
e1:SetTargetRange(LOCATION_HAND,LOCATION_HAND)
c:RegisterEffect(e1)
--c:RegisterEffect(e1)
--summon proc
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
......@@ -129,8 +129,20 @@ function cm.initial_effect(c)
return _IsSpecialSummonable(c,sumtype,...)
end
function Duel.IsExistingMatchingCard(f,p,s,o,ct,nc,...)
local g=Duel.GetMatchingGroup(f,p,s,o,nc,...)
return #g>=ct
local s1=s&LOCATION_EXTRA>0 and LOCATION_GRAVE or 0
local o1=o&LOCATION_EXTRA>0 and LOCATION_GRAVE or 0
cm[0]=false
if cm[0] then
local g=_GetMatchingGroup(f,p,s1,o1,nc,...):Filter(function(c) return c:GetOriginalCode()==m end,nil)
if #g>0 then
cm[0]=false
local sg=_GetMatchingGroup(f,p,s,o,nc,...)
return #(sg+g)>ct
end
end
cm[0]=false
return _IsExistingMatchingCard(f,p,s,o,ct,nc,...)
--return #Duel.GetMatchingGroup(f,p,s,o,nc,...)>=ct
end
function Duel.SelectMatchingCard(sp,f,p,s,o,min,max,nc,...)
local g=Duel.GetMatchingGroup(f,p,s,o,nc,...)
......
--惊乐园的杂技师 <E丑角>
function c30829031.initial_effect(c)
local s,id,o=GetID()
function s.initial_effect(c)
--special summon
local custom_code=s.RegisterMergedEvent_ToSingleCard(c,id,EVENT_TO_GRAVE)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(30829031,0))
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCode(custom_code)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,30829031)
e1:SetCondition(c30829031.spcon)
e1:SetTarget(c30829031.sptg)
e1:SetOperation(c30829031.spop)
e1:SetCountLimit(1,id)
e1:SetCondition(s.spcon)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--Trap activate in set turn
local e2=Effect.CreateEffect(c)
......@@ -20,30 +22,30 @@ function c30829031.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_SZONE,0)
e2:SetCountLimit(1,30829032)
e2:SetCountLimit(1,id+o)
e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x15c))
c:RegisterEffect(e2)
end
function c30829031.cfilter(c,tp)
function s.cfilter(c,tp)
return c:IsSetCard(0x15c) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) and bit.band(c:GetPreviousTypeOnField(),TYPE_TRAP)~=0
end
function c30829031.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c30829031.cfilter,1,nil,tp)
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.cfilter,1,nil,tp) and not eg:IsContains(e:GetHandler())
end
function c30829031.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c30829031.setfilter(c)
function s.setfilter(c)
return c:IsType(TYPE_TRAP) and c:IsSSetable()
end
function c30829031.spop(e,tp,eg,ep,ev,re,r,rp)
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c30829031.setfilter),tp,LOCATION_GRAVE,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(30829031,2)) then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.setfilter),tp,LOCATION_GRAVE,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=g:Select(tp,1,1,nil)
......@@ -51,3 +53,108 @@ function c30829031.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
-----------------------------Custom_Code---------------------------------
function s.RegisterMergedEvent_ToSingleCard(c,code,events)
local g=Group.CreateGroup()
g:KeepAlive()
local mt=getmetatable(c)
local seed=0
if type(events) == "table" then
for _, event in ipairs(events) do
seed = seed + event
end
else
seed = events
end
while(mt[seed]==true) do
seed = seed + 1
end
mt[seed]=true
local event_code_single = (code ~ (seed << 16)) | EVENT_CUSTOM
if type(events) == "table" then
for _, event in ipairs(events) do
s.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,event,event_code_single)
end
else
s.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,events,event_code_single)
end
--listened to again
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e3:SetCode(EVENT_MOVE)
e3:SetLabelObject(g)
e3:SetOperation(s.ThisCardMovedToPublicResetCheck_ToSingleCard)
c:RegisterEffect(e3)
return event_code_single
end
function s.RegisterMergedEvent_ToSingleCard_AddOperation(c,g,event,event_code_single)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(event)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e1:SetRange(0xff)
e1:SetLabel(event_code_single)
e1:SetLabelObject(g)
e1:SetOperation(s.MergedDelayEventCheck1_ToSingleCard)
c:RegisterEffect(e1)
local ec={
EVENT_CHAIN_ACTIVATING,
EVENT_CHAINING,
EVENT_ATTACK_ANNOUNCE,
EVENT_BREAK_EFFECT,
EVENT_CHAIN_SOLVING,
EVENT_CHAIN_SOLVED,
EVENT_CHAIN_END,
EVENT_SUMMON,
EVENT_SPSUMMON,
EVENT_MSET,
EVENT_BATTLE_DESTROYED
}
for _,code in ipairs(ec) do
local ce=e1:Clone()
ce:SetCode(code)
ce:SetOperation(s.MergedDelayEventCheck2_ToSingleCard)
c:RegisterEffect(ce)
end
end
function s.MergedDelayEventCheck1_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local c=e:GetOwner()
g:Merge(eg)
if Duel.CheckEvent(EVENT_MOVE) then
local _,meg=Duel.CheckEvent(EVENT_MOVE,true)
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
g:Clear()
end
end
if Duel.GetCurrentChain()==0 and #g>0 and g:IsExists(Card.IsReason,1,nil,REASON_ADJUST|REASON_EFFECT) then
local _eg=g:Clone()
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,rp,ep,ev)
g:Clear()
end
end
function s.MergedDelayEventCheck2_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if Duel.CheckEvent(EVENT_MOVE) then
local _,meg=Duel.CheckEvent(EVENT_MOVE,true)
local c=e:GetOwner()
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
g:Clear()
end
end
if #g>0 then
local _eg=g:Clone()
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,rp,ep,ev)
g:Clear()
end
end
function s.ThisCardMovedToPublicResetCheck_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetOwner()
local g=e:GetLabelObject()
if c:IsFaceup() or c:IsPublic() then
g:Clear()
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