Commit e694978f authored by Satty's avatar Satty

fix

parent fd971575
Pipeline #36031 failed with stages
in 18 minutes and 37 seconds
......@@ -107,7 +107,7 @@ function cm.rmop(e,tp)
if Duel.Remove(rc,POS_FACEUP,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCode(EVENT_CHAIN_END)
e1:SetLabelObject(rc)
e1:SetOperation(cm.retop)
e1:SetReset(RESET_PHASE+PHASE_END)
......
......@@ -13,6 +13,7 @@ function cm.initial_effect(c)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1)
e1:SetCondition(cm.obcon)
e1:SetTarget(cm.postg)
e1:SetOperation(cm.posop)
c:RegisterEffect(e1)
......@@ -54,6 +55,9 @@ function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(rp,18700781,RESET_PHASE+PHASE_END,0,1)
end
function cm.obcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2
end
function cm.llf(c,tp)
return c:IsCode(m-2) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_SZONE)
end
......
......@@ -42,7 +42,7 @@ function cm.spcfilter(c)
return c:IsFaceup() and c:IsSetCard(0x829) and c:IsType(TYPE_MONSTER)
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.spcfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,nil)
return Duel.IsExistingMatchingCard(cm.spcfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,nil) and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -111,7 +111,7 @@ function cm.eff2op(e,tp,eg,ep,ev,re,r,rp)
if Duel.Remove(rc,POS_FACEUP,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCode(EVENT_CHAIN_END)
e1:SetLabelObject(rc)
e1:SetOperation(cm.retop)
e1:SetReset(RESET_PHASE+PHASE_END)
......
......@@ -6,7 +6,7 @@ function s.initial_effect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1,id+o)
e1:SetCountLimit(1,id)
e1:SetCondition(s.negcon)
e1:SetCost(s.negcost)
e1:SetTarget(s.negtg)
......@@ -59,7 +59,7 @@ end
function s.negop(e,tp,eg,ep,ev,re,r,rp)
local c =e:GetHandler()
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
if Duel.NegateActivation(ev) then
local handler=re:GetHandler()
local remove_flag=false
local spsummon_flag=false
......
......@@ -63,8 +63,8 @@ local c=e:GetHandler()
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(REASON_COST,tp,nil,1,nil,tp) end
local g=Duel.SelectReleaseGroup(REASON_COST,tp,nil,1,1,nil,tp)
if chk==0 then return Duel.CheckReleaseGroup(tp,nil,1,nil,tp) end
local g=Duel.SelectReleaseGroup(tp,nil,1,1,nil,tp)
Duel.Release(g,REASON_COST)
e:SetLabelObject(g:GetFirst())
end
......
......@@ -30,12 +30,14 @@ function s.initial_effect(c)
--Activate only when you have 40+ "Fire's Dawn" cards
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN+EFFECT_CANNOT_INACTIVATE+EFFECT_CANNOT_DISABLE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCondition(s.condition)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
c:RegisterEffect(e1)
end
......@@ -61,8 +63,7 @@ function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
ex1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(ex1,tp)
end
Duel.PayLPCost(tp,2000)
Duel.SetLP(tp,Duel.GetLP(tp)-2000)
end
......@@ -74,8 +75,9 @@ function s.lmffilter(c)
return c:IsCode(36700304)
end
function s.relfilter(c,code)
return c.mention_code and c:IsAbleToHand() and c.mention_code[code]
function s.relfilter(c,code,tp)
return aux.IsCodeListed(c,code) and (c:IsAbleToHand() or c:IsSSetable()
or Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE))
end
function s.trapfilter(c)
......@@ -124,119 +126,62 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE)
end
end
function s.publicfilter(c)
return not c:IsPublic()
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
-- Apply all effects if LP=0
if op==0 then
-- First effect: The Gathering
-- Effect 1: The Gathering
if op==1 or op==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.fdfilter,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then
local tc=g:GetFirst()
if s.lmffilter(tc) then
if s.lmffilter(tc) and Duel.SelectYesNo(tp,aux.Stringid(id,7)) then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,4))
local sg=Duel.SelectMatchingCard(tp,s.relfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tc:GetCode())
local sg=Duel.SelectMatchingCard(tp,s.relfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tc:GetCode(),tp)
if #sg>0 then
local sc=sg:GetFirst()
local op2=Duel.SelectOption(tp,aux.Stringid(id,5),aux.Stringid(id,6))
if op2==0 then
Duel.SendtoHand(sc,nil,REASON_EFFECT)
if sc:IsType(TYPE_MONSTER) and (not sc:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
or sc:IsLocation(LOCATION_EXTRA) and sc:IsFaceup() and Duel.GetLocationCountFromEx(tp,tp,nil,sc)>0)
and sc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE)
and Duel.SelectYesNo(tp,aux.Stringid(id,6)) then
Duel.BreakEffect()
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.ConfirmCards(1-tp,sc)
else
elseif (sc:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0)
and sc:IsSSetable(true) and Duel.SelectYesNo(tp,aux.Stringid(id,6)) then
Duel.BreakEffect()
Duel.SSet(tp,sc)
if sc:IsType(TYPE_QUICKPLAY) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(id,8))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
sc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
sc:RegisterEffect(e2)
end
end
end
end
-- Second effect: No Glues
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE)
e3:SetTargetRange(0,LOCATION_MZONE)
e3:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e3,tp)
local e4=Effect.CreateEffect(e:GetHandler())
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_DISABLE_EFFECT)
e4:SetTargetRange(0,LOCATION_MZONE)
e4:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e4,tp)
local e5=Effect.CreateEffect(e:GetHandler())
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_CANNOT_ACTIVATE)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(0,1)
e5:SetValue(s.aclimit)
e5:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e5,tp)
-- Third effect: Black sheep wall
local hg=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,0,LOCATION_HAND,nil)
local sg=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_SZONE,nil)
if #hg>0 then
Duel.ConfirmCards(tp,hg)
end
if #sg>0 then
Duel.ConfirmCards(tp,sg)
end
local trap_exist=Duel.IsExistingMatchingCard(s.trapfilter,tp,0,LOCATION_HAND+LOCATION_SZONE,1,nil)
if trap_exist then
local e6=Effect.CreateEffect(e:GetHandler())
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_CANNOT_ACTIVATE)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(0,1)
e6:SetValue(s.aclimit2)
e6:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e6,tp)
end
-- Effect 1: The Gathering
elseif op==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.fdfilter,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then
local tc=g:GetFirst()
if s.lmffilter(tc) then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,4))
local sg=Duel.SelectMatchingCard(tp,s.relfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tc:GetCode())
if #sg>0 then
local sc=sg:GetFirst()
local op2=Duel.SelectOption(tp,aux.Stringid(id,5),aux.Stringid(id,6))
if op2==0 then
Duel.SendtoHand(sc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sc)
else
Duel.SSet(tp,sc)
elseif sc:IsType(TYPE_TRAP) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(id,8))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
sc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
sc:RegisterEffect(e2)
end
else
Duel.SendtoHand(sc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sc)
end
end
end
end
end
-- Effect 2: No Glues
elseif op==2 then
if op==2 or op==0 then
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE)
......@@ -257,19 +202,16 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp)
e5:SetValue(s.aclimit)
e5:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e5,tp)
end
-- Effect 3: Black sheep wall
elseif op==3 then
local hg=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,0,LOCATION_HAND,nil)
if op==3 or op==0 then
local hg=Duel.GetMatchingGroup(s.publicfilter,tp,0,LOCATION_HAND,nil)
local sg=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_SZONE,nil)
hg:Merge(sg)
if #hg>0 then
Duel.ConfirmCards(tp,hg)
end
if #sg>0 then
Duel.ConfirmCards(tp,sg)
end
local trap_exist=Duel.IsExistingMatchingCard(s.trapfilter,tp,0,LOCATION_HAND+LOCATION_SZONE,1,nil)
local trap_exist=hg:IsExists(s.trapfilter,1,nil)
if trap_exist then
local e6=Effect.CreateEffect(e:GetHandler())
e6:SetType(EFFECT_TYPE_FIELD)
......@@ -282,45 +224,6 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp)
end
end
-- Skip to next opponent's battle phase
if Duel.GetTurnPlayer()==tp then
-- End current player's turn
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_SKIP_TURN)
e3:SetTargetRange(1,0)
e3:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN)
Duel.RegisterEffect(e3,tp)
-- Skip to opponent's battle phase next turn
local e4=Effect.CreateEffect(e:GetHandler())
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCode(EFFECT_SKIP_M1)
e4:SetTargetRange(0,1)
e4:SetReset(RESET_PHASE+PHASE_BATTLE_START+RESET_OPPO_TURN)
Duel.RegisterEffect(e4,tp)
else
-- Skip to battle phase if not first turn
if Duel.GetTurnCount()>1 then
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_SKIP_M1)
e3:SetTargetRange(0,1)
e3:SetReset(RESET_PHASE+PHASE_BATTLE_START+RESET_OPPO_TURN)
Duel.RegisterEffect(e3,tp)
end
end
-- Force all monsters to attack if possible
local e5=Effect.CreateEffect(e:GetHandler())
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_MUST_ATTACK)
e5:SetTargetRange(0,LOCATION_MZONE)
e5:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e5,tp)
end
function s.aclimit(e,re,tp)
......
......@@ -61,8 +61,8 @@ function s.typecheck(g)
end
function s.spcon(e,c)
if c==nil then return true end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local tp=c:GetControler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND,0,c)
return g:CheckSubGroup(s.typecheck,2,2)
end
......
......@@ -61,8 +61,8 @@ function s.typecheck(g)
end
function s.spcon(e,c)
if c==nil then return true end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local tp=c:GetControler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND,0,c)
return g:CheckSubGroup(s.typecheck,2,2)
end
......
......@@ -61,8 +61,8 @@ function s.typecheck(g)
end
function s.spcon(e,c)
if c==nil then return true end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local tp=c:GetControler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND,0,c)
return g:CheckSubGroup(s.typecheck,2,2)
end
......
......@@ -60,8 +60,8 @@ function s.typecheck(g)
end
function s.spcon(e,c)
if c==nil then return true end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local tp=c:GetControler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND,0,c)
return g:CheckSubGroup(s.typecheck,2,2)
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