Commit a8dd2c18 authored by POLYMER's avatar POLYMER

fix

parent db656edf
......@@ -46,7 +46,7 @@ function cm.fselect2(g)
end
function cm.fselect3(g)
local ct2=g:FilterCount(cm.sfilter,nil)
return #g%2==0 and #g<=2*ct2
return #g<=2*ct2
end
function cm.fselect4(g)
return #g%2==0
......@@ -55,6 +55,52 @@ function cm.fselect5(g)
local ct4=g:FilterCount(cm.mfilter,nil)
return #g<=2*ct4
end
function cm.SelectSubGroup(g,tp,f,cancelable,min,max,...)
Auxiliary.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if Auxiliary.CheckGroupRecursiveCapture(c,sg,eg,f,min,max,ext_params) then
cg:Merge(Auxiliary.SubGroupCaptured)
end
end
end
cg:Sub(sg)
finish=(#sg>=min and #sg<=max and f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
if not tc then break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
return nil
end
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return false end
......@@ -62,12 +108,15 @@ function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
--local g=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,c,e)
local g1=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c,e)
local g2=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e)
local g3=Duel.GetMatchingGroup(cm.mfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e)
--Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,13))
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
--aux.GCheckAdditional=cm.fselect
local tg=g1:SelectSubGroup(tp,cm.fselect3,false,0,#g1)
local min=2
if Duel.IsExistingTarget(cm.mfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e) then min=0 end
aux.GCheckAdditional=cm.fselect3
local tg=cm.SelectSubGroup(g1,tp,cm.fselect4,false,min,#g1)
--Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,14))
aux.GCheckAdditional=cm.fselect5
local tg2=g2:SelectSubGroup(tp,cm.fselect4,false,math.max(0,2-#g1),#g2)
local tg2=cm.SelectSubGroup(g2,tp,cm.fselect4,false,math.max(0,2-#tg),#g2)
aux.GCheckAdditional=nil
tg:Merge(tg2)
Duel.SetTargetCard(tg)
......@@ -119,35 +168,6 @@ function cm.acop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(g,nil,REASON_EFFECT)
pnfl_adjusting=false
end
function cm.coincon(e,tp,eg,ep,ev,re,r,rp)
return re:GetCode()~=EVENT_TOSS_COIN_NEGATE
end
function cm.coinop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetFlagEffect(m)==0 and Duel.SelectEffectYesNo(tp,c) then
Duel.ConfirmCards(1-tp,c)
Duel.Hint(HINT_CARD,0,m)
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
local res={Duel.GetCoinResult()}
local ac=1
local ct=ev
if ct>1 then
--choose the index of results
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,11))
local val,idx=Duel.AnnounceNumber(tp,table.unpack(aux.idx_table,1,ct))
ac=idx+1
end
res[ac]=1
Duel.SetCoinResult(table.unpack(res))
--[[local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_PUBLIC)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
cm[c]=e1--]]
Duel.RaiseSingleEvent(c,EVENT_CUSTOM+m,e,0,0,0,0)
end
end
function cm.pzcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsSummonPlayer,1,nil,tp)
end
......
......@@ -9,6 +9,7 @@ function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
......@@ -31,7 +32,7 @@ function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
--e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(cm.descon)
e1:SetOperation(cm.desop2)
Duel.RegisterEffect(e1,0)
......@@ -73,7 +74,6 @@ function cm.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.filter12,1,nil,e)
end
function cm.desop2(e,tp,eg,ep,ev,re,r,rp)
if (re and re:GetHandler():GetOriginalCode()==m) then return end
Duel.RaiseEvent(eg,EVENT_CUSTOM+11450901,re,r,rp,ep,ev)
end
function cm.descon3(e,tp,eg,ep,ev,re,r,rp)
......@@ -109,15 +109,20 @@ function cm.resetop(e,tp,eg,ep,ev,re,r,rp)
end
function cm.dsop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not re:GetHandler():IsSetCard(0x6e) or not c:IsSSetable() or cm.column~=0 then return end
if not re:GetHandler():IsSetCard(0x6e) or not c:IsSSetable() or cm.column~=0 or Duel.GetFlagEffect(tp,m)>0 then return end
if Duel.SelectEffectYesNo(tp,c) then
Duel.Hint(HINT_CARD,0,m)
Duel.SSet(tp,c,tp,true)
c:RegisterFlagEffect(m-10,RESET_CHAIN,0,1)
c:RegisterFlagEffect(m-11,RESET_CHAIN,0,1)
cm.thop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,m)==0 end
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
--if Duel.GetFlagEffect(tp,m)>0 then return end
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
local c=e:GetHandler()
local fd=Duel.SelectField(tp,2,LOCATION_SZONE,0,~0x1f00)
for i=0,4 do
......@@ -136,7 +141,7 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
e3:SetCode(EVENT_MOVE)
e3:SetLabel(i)
e3:SetCountLimit(1)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_NO_TURN_RESET)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCondition(cm.thcon2)
e3:SetTarget(cm.thtg2)
e3:SetOperation(cm.thop2)
......@@ -150,7 +155,7 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.clfilter(c,tp,i)
return aux.GetColumn(c,tp)==i and not c:IsStatus(STATUS_SUMMONING) and c:GetFlagEffect(m-10)==0
return aux.GetColumn(c,tp)==i and not c:IsStatus(STATUS_SUMMONING) and c:GetFlagEffect(m-11)==0
end
function cm.thcon2(e,tp,eg,ep,ev,re,r,rp)
local ng=Duel.GetMatchingGroup(cm.clfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,tp,e:GetLabel())
......@@ -184,7 +189,7 @@ function cm.thop2(e,tp,eg,ep,ev,re,r,rp)
g=g:Filter(Card.IsRelateToEffect,nil,e)
if #g==0 then return end
g:KeepAlive()
g:ForEach(Card.RegisterFlagEffect,m-10,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET,EFFECT_FLAG_CLIENT_HINT,1,aux.Stringid(m,10))
g:ForEach(Card.RegisterFlagEffect,m-10,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,10))
for tc in aux.Next(g) do
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_SINGLE)
......@@ -227,7 +232,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local eset={tc:IsHasEffect(EFFECT_FLAG_EFFECT+m)}
local te=eset[1]:GetLabelObject()
if #eset>1 then
Duel.Hint(HINT_SELECTMSG,tp,550)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,6))
local ct=Duel.AnnounceNumber(tp,table.unpack(aux.idx_table,1,#eset))
te=eset[ct]:GetLabelObject()
end
......
......@@ -11,6 +11,7 @@ function cm.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
--e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e1:SetHintTiming(TIMING_END_PHASE+TIMING_STANDBY_PHASE)
e1:SetCondition(function(e,tp) return (Duel.GetCurrentPhase()~=PHASE_MAIN1 and Duel.GetCurrentPhase()~=PHASE_MAIN2) or Duel.GetTurnPlayer()==1-tp end)
e1:SetTarget(cm.thtg)
......@@ -103,6 +104,8 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.DisableShuffleCheck()
sc:ReverseInDeck()
end
Duel.ConfirmCards(tp,dg)
Duel.ConfirmCards(1-tp,dg)
Duel.AdjustAll()
dg:KeepAlive()
dg:ForEach(Card.RegisterFlagEffect,m,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
......
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