Commit 296b3fd7 authored by wind2009's avatar wind2009 Committed by GitHub

Fix select effect (#2786)

parent 5d391c54
......@@ -36,29 +36,37 @@ end
function c40456412.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g1=Duel.GetMatchingGroup(c40456412.desfilter,tp,LOCATION_ONFIELD,0,nil)
local g2=Duel.GetMatchingGroup(c40456412.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,nil,e,tp)
local b1=Duel.GetFlagEffect(tp,40456412+1)==0
local b1=(Duel.GetFlagEffect(tp,40456412+1)==0 or not e:IsCostChecked())
and g1:GetCount()>0 and g2:GetCount()>0
local b2=Duel.GetFlagEffect(tp,40456412+2)==0
local b2=(Duel.GetFlagEffect(tp,40456412+2)==0 or not e:IsCostChecked())
and (Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1))
and Duel.IsExistingMatchingCard(c40456412.psfilter,tp,LOCATION_EXTRA,0,1,nil)
local b3=Duel.GetFlagEffect(tp,40456412+3)==0
local b3=(Duel.GetFlagEffect(tp,40456412+3)==0 or not e:IsCostChecked())
and Duel.IsExistingMatchingCard(c40456412.ssfilter,tp,LOCATION_DECK,0,1,nil)
if chk==0 then return b1 or b2 or b3 end
local op=aux.SelectFromOptions(tp,
{b1,aux.Stringid(40456412,1)},
{b2,aux.Stringid(40456412,2)},
{b3,aux.Stringid(40456412,3)})
Duel.RegisterFlagEffect(tp,40456412+op,RESET_PHASE+PHASE_END,0,1)
if e:IsCostChecked() then
Duel.RegisterFlagEffect(tp,40456412+op,RESET_PHASE+PHASE_END,0,1)
end
if op==1 then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA)
e:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
if e:IsCostChecked() then
e:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
end
e:SetOperation(c40456412.spop)
elseif op==2 then
e:SetCategory(0)
if e:IsCostChecked() then
e:SetCategory(0)
end
e:SetOperation(c40456412.psop)
else
e:SetCategory(0)
if e:IsCostChecked() then
e:SetCategory(0)
end
e:SetOperation(c40456412.ssop)
end
end
......
......@@ -19,24 +19,28 @@ function s.dfilter(c,tp)
end
function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.dfilter(chkc,tp) end
local b1=Duel.GetFlagEffect(tp,id)==0
local b1=(Duel.GetFlagEffect(tp,id)==0 or not e:IsCostChecked())
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp)
local b2=Duel.GetFlagEffect(tp,id+o)==0
local b2=(Duel.GetFlagEffect(tp,id+o)==0 or not e:IsCostChecked())
and Duel.IsExistingTarget(s.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp)
if chk==0 then return b1 or b2 end
local op=aux.SelectFromOptions(tp,{b1,aux.Stringid(id,0)},{b2,aux.Stringid(id,1)})
if op==1 then
e:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
e:SetProperty(0)
if e:IsCostChecked() then
e:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
e:SetProperty(0)
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
end
e:SetOperation(s.sop)
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
else
e:SetCategory(CATEGORY_DAMAGE)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
if e:IsCostChecked() then
e:SetCategory(CATEGORY_DAMAGE)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.RegisterFlagEffect(tp,id+o,RESET_PHASE+PHASE_END,0,1)
end
e:SetOperation(s.dop)
Duel.RegisterFlagEffect(tp,id+o,RESET_PHASE+PHASE_END,0,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectTarget(tp,s.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp):GetFirst()
local atk=tc:GetBaseAttack()
......
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