Commit f77806eb authored by salix5's avatar salix5

fix Mimighoul flip effect

FLIP: If it is the Main Phase: Apply these effects in sequence.
parent 3dce9340
...@@ -8,6 +8,7 @@ function s.initial_effect(c) ...@@ -8,6 +8,7 @@ function s.initial_effect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,id) e1:SetCountLimit(1,id)
e1:SetCondition(aux.MimighoulFlipCondition)
e1:SetTarget(s.target) e1:SetTarget(s.target)
e1:SetOperation(s.operation) e1:SetOperation(s.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
...@@ -42,25 +43,23 @@ function s.spfilter(c,e,tp) ...@@ -42,25 +43,23 @@ function s.spfilter(c,e,tp)
return c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,1-tp) return c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,1-tp)
end end
function s.operation(e,tp,eg,ep,ev,re,r,rp) function s.operation(e,tp,eg,ep,ev,re,r,rp)
if (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) then local tg=Duel.GetDecktopGroup(tp,3)
local tg=Duel.GetDecktopGroup(tp,3) if #tg==0 then return end
if #tg==0 then return end Duel.DisableShuffleCheck()
Duel.DisableShuffleCheck() if Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)>0 and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
if Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)>0 and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) then
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) if #g>0 then
if #g>0 then
Duel.BreakEffect()
Duel.SpecialSummon(g:GetFirst(),0,tp,1-tp,false,false,POS_FACEUP_DEFENSE)
end
end
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.BreakEffect() Duel.BreakEffect()
Duel.GetControl(c,1-tp) Duel.SpecialSummon(g:GetFirst(),0,tp,1-tp,false,false,POS_FACEUP_DEFENSE)
end end
end end
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.BreakEffect()
Duel.GetControl(c,1-tp)
end
end end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
......
...@@ -8,6 +8,7 @@ function s.initial_effect(c) ...@@ -8,6 +8,7 @@ function s.initial_effect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,id) e1:SetCountLimit(1,id)
e1:SetCondition(aux.MimighoulFlipCondition)
e1:SetTarget(s.target) e1:SetTarget(s.target)
e1:SetOperation(s.operation) e1:SetOperation(s.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
...@@ -43,21 +44,19 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -43,21 +44,19 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,1)
end end
function s.operation(e,tp,eg,ep,ev,re,r,rp) function s.operation(e,tp,eg,ep,ev,re,r,rp)
if (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) then Duel.Draw(1-tp,1,REASON_EFFECT)
Duel.Draw(1-tp,1,REASON_EFFECT) local tg1=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
local tg1=Duel.GetFieldGroup(tp,LOCATION_HAND,0) if tg1:GetCount()>0 then
if tg1:GetCount()>0 then Duel.ShuffleHand(tp)
Duel.ShuffleHand(tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc1=tg1:Select(tp,1,1,nil):GetFirst()
local tc1=tg1:Select(tp,1,1,nil):GetFirst() Duel.BreakEffect()
Duel.BreakEffect() Duel.SendtoGrave(tc1,REASON_EFFECT)
Duel.SendtoGrave(tc1,REASON_EFFECT) end
end local c=e:GetHandler()
local c=e:GetHandler() if c:IsRelateToEffect(e) then
if c:IsRelateToEffect(e) then Duel.BreakEffect()
Duel.BreakEffect() Duel.GetControl(c,1-tp)
Duel.GetControl(c,1-tp)
end
end end
end end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
...@@ -8,6 +8,7 @@ function s.initial_effect(c) ...@@ -8,6 +8,7 @@ function s.initial_effect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,id) e1:SetCountLimit(1,id)
e1:SetCondition(aux.MimighoulFlipCondition)
e1:SetTarget(s.target) e1:SetTarget(s.target)
e1:SetOperation(s.operation) e1:SetOperation(s.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
...@@ -46,14 +47,12 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -46,14 +47,12 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0)
end end
function s.operation(e,tp,eg,ep,ev,re,r,rp) function s.operation(e,tp,eg,ep,ev,re,r,rp)
if (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) then local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil)
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) Duel.Destroy(g,REASON_EFFECT)
Duel.Destroy(g,REASON_EFFECT) local c=e:GetHandler()
local c=e:GetHandler() if c:IsRelateToEffect(e) then
if c:IsRelateToEffect(e) then Duel.BreakEffect()
Duel.BreakEffect() Duel.GetControl(c,1-tp)
Duel.GetControl(c,1-tp)
end
end end
end end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
......
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