Commit 6090c272 authored by 花桃白音's avatar 花桃白音

fix operation

parent b1becd0b
......@@ -24,42 +24,47 @@ function cm.initial_effect(c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end)
.e("SetOperation",function(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_HAND,0,1,1,nil)
local tg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
local setg=Duel.GetMatchingGroup(Card.IsSSetable,tp,LOCATION_HAND,0,g):Filter(Card.IsType,nil,TYPE_TRAP)
if Duel.Remove(g,POS_FACEUP,REASON_EFFECT)~=0
and Duel.Destroy(tg,REASON_EFFECT)~=0
and setg:GetCount()>0 then
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
if Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local tc=setg:Select(tp,1,1,nil):GetFirst()
if Duel.SSet(tp,tc,tp,false)~=0 then
local c=e:GetHandler()
local fid=c:GetFieldID()
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1,fid)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(tc)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
local g=Group.FromCards(e:GetLabelObject())
return g:IsContains(re:GetHandler()) and tc:GetFlagEffectLabel(m)==e:GetLabel()
end)
e1:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
end)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
local tg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.Destroy(tg,REASON_EFFECT)
local exc=nil
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then exc=e:GetHandler() end
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_HAND,0,1,1,nil)
if g and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local tg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,exc)
if tg and Duel.Destroy(tg,REASON_EFFECT)~=0 then
local setg=Duel.GetMatchingGroup(Card.IsSSetable,tp,LOCATION_HAND,0,g):Filter(Card.IsType,nil,TYPE_TRAP)
if setg:GetCount()>0 then
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
if Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local tc=setg:Select(tp,1,1,nil):GetFirst()
if Duel.SSet(tp,tc,tp,false)~=0 then
local c=e:GetHandler()
local fid=c:GetFieldID()
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1,fid)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(tc)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
local g=Group.FromCards(e:GetLabelObject())
return g:IsContains(re:GetHandler()) and tc:GetFlagEffectLabel(m)==e:GetLabel()
end)
e1:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
end)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
local tg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.Destroy(tg,REASON_EFFECT)
end
end)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
Duel.RegisterEffect(e1,tp)
end
end)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
Duel.RegisterEffect(e1,tp)
end
end
end
end
......
......@@ -10,7 +10,7 @@ function cm.initial_effect(c)
.e("SetCountLimit",1,4260609)
.e("SetCost",function(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToRemove() end
if chk==0 then return c:IsAbleToRemoveAsCost() end
Duel.Remove(c,POS_FACEUP,REASON_COST) end)
.e("SetTarget",function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=5 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