Commit c13a1062 authored by mercury233's avatar mercury233 Committed by GitHub

fix Imperial Bower

can select 1 to hand and 1 to special summon
parent 75800c17
......@@ -21,32 +21,54 @@ function c56673112.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c56673112.opfilter(c,e,tp)
return (c:IsAbleToHand() or c:IsCanBeSpecialSummoned(e,0,tp,false,false)) and c:IsCode(64788463,25652259,90876561)
function c56673112.opfilter(c,e,tp,ft)
return (c:IsAbleToHand() or c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0) and c:IsCode(64788463,25652259,90876561)
end
function c56673112.opcheck(g,e,tp,spcheck)
return g:GetClassCount(Card.GetCode)==2
and (g:FilterCount(Card.IsAbleToHand,nil)==2 or g:FilterCount(Card.IsCanBeSpecialSummoned,nil,e,0,tp,false,false)==2)
function c56673112.opcheck(g,e,tp,ft)
if g:GetClassCount(Card.GetCode)<2 then return false end
local thct=g:FilterCount(Card.IsAbleToHand,nil)
local spct=g:FilterCount(Card.IsCanBeSpecialSummoned,nil,e,0,tp,false,false)
return thct+math.min(spct,ft)>=2
end
function c56673112.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local spcheck=Duel.GetMZoneCount(tp,e:GetHandler())>1 and not Duel.IsPlayerAffectedByEffect(tp,59822133)
local g=Duel.GetMatchingGroup(c56673112.opfilter,tp,LOCATION_DECK,0,nil,e,tp)
return g:CheckSubGroup(c56673112.opcheck,2,2,e,tp,spcheck)
local ft=Duel.GetMZoneCount(tp,e:GetHandler())
if ft<0 then ft=0 end
if ft>0 and Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local g=Duel.GetMatchingGroup(c56673112.opfilter,tp,LOCATION_DECK,0,nil,e,tp,ft)
return g:CheckSubGroup(c56673112.opcheck,2,2,e,tp,ft)
end
end
function c56673112.spop(e,tp,eg,ep,ev,re,r,rp)
local spcheck=Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and not Duel.IsPlayerAffectedByEffect(tp,59822133)
local g=Duel.GetMatchingGroup(c56673112.opfilter,tp,LOCATION_DECK,0,nil,e,tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<0 then ft=0 end
if ft>0 and Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local g=Duel.GetMatchingGroup(c56673112.opfilter,tp,LOCATION_DECK,0,nil,e,tp,ft)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sg=g:SelectSubGroup(tp,c56673112.opcheck,false,2,2,e,tp,spcheck)
local sg=g:SelectSubGroup(tp,c56673112.opcheck,false,2,2,e,tp,ft)
if not sg then return end
local tgc=sg:FilterCount(Card.IsAbleToHand,nil)
local sgc=sg:FilterCount(Card.IsCanBeSpecialSummoned,nil,e,0,tp,false,false)
if tgc==2 and (sgc~=2 or not spcheck or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
local thsg=Group.CreateGroup()
local spsg=Group.CreateGroup()
local thct=sg:FilterCount(Card.IsAbleToHand,nil)
local spct=sg:FilterCount(Card.IsCanBeSpecialSummoned,nil,e,0,tp,false,false)
if thct==0 then
spsg=sg
elseif spct==0 or ft==0 then
thsg=sg
else
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
if Duel.SelectYesNo(tp,aux.Stringid(56673112,1)) or ft<2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
thsg=sg:FilterSelect(tp,Card.IsAbleToHand,1,thct,nil)
spsg=sg-thsg
else
spsg=sg
end
end
if #thsg>0 then
Duel.SendtoHand(thsg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,thsg)
end
if #spsg>0 then
Duel.SpecialSummon(spsg,0,tp,tp,false,false,POS_FACEUP)
end
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