Commit 2b1edfb8 authored by nekrozar's avatar nekrozar Committed by DailyShana

fix Victory Viper XX03, Power Capsule (#638)

parent 71f898d1
...@@ -15,14 +15,18 @@ function c54289683.desfilter(c) ...@@ -15,14 +15,18 @@ function c54289683.desfilter(c)
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP) return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end end
function c54289683.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c54289683.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c54289683.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c54289683.filter,tp,LOCATION_MZONE,0,1,nil) end if chk==0 then return Duel.IsExistingTarget(c54289683.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local cg=Duel.SelectTarget(tp,c54289683.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SelectTarget(tp,c54289683.filter,tp,LOCATION_MZONE,0,1,1,nil)
local c=cg:GetFirst() end
local t1=Duel.IsExistingTarget(c54289683.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) function c54289683.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end
local t1=Duel.IsExistingMatchingCard(c54289683.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
local t2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 local t2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,93130022,0,0x4011,c:GetAttack(),c:GetDefense(),c:GetLevel(),c:GetRace(),c:GetAttribute()) and Duel.IsPlayerCanSpecialSummonMonster(tp,93130022,0,0x4011,tc:GetAttack(),tc:GetDefense(),tc:GetLevel(),tc:GetRace(),tc:GetAttribute())
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(93130021,0)) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(93130021,0))
if t1 and t2 then if t1 and t2 then
op=Duel.SelectOption(tp,aux.Stringid(93130021,1),aux.Stringid(93130021,2),aux.Stringid(93130021,3)) op=Duel.SelectOption(tp,aux.Stringid(93130021,1),aux.Stringid(93130021,2),aux.Stringid(93130021,3))
...@@ -32,41 +36,19 @@ function c54289683.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -32,41 +36,19 @@ function c54289683.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
op=Duel.SelectOption(tp,aux.Stringid(93130021,1),aux.Stringid(93130021,3)) op=Duel.SelectOption(tp,aux.Stringid(93130021,1),aux.Stringid(93130021,3))
if op==1 then op=2 end if op==1 then op=2 end
else op=Duel.SelectOption(tp,aux.Stringid(93130021,1)) end else op=Duel.SelectOption(tp,aux.Stringid(93130021,1)) end
e:SetLabel(op)
if op==1 then if op==1 then
e:SetCategory(CATEGORY_DESTROY)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c54289683.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) local g=Duel.SelectMatchingCard(tp,c54289683.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
e:SetLabelObject(g:GetFirst()) if g:GetCount()>0 then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.HintSelection(g)
elseif op==2 then Duel.Destroy(g,REASON_EFFECT)
e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
else
e:SetCategory(CATEGORY_ATKCHANGE)
end
end
function c54289683.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if e:GetLabel()==1 then
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local dc=e:GetLabelObject()
tc=g:GetFirst()
if tc==dc then tc=g:GetNext() end
if tc:IsFaceup() and tc:IsRelateToEffect(e) and dc:IsRelateToEffect(e) then
Duel.Destroy(dc,REASON_EFFECT)
end end
elseif e:GetLabel()==2 then elseif op==2 then
if tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end
local atk=tc:GetAttack() local atk=tc:GetAttack()
local def=tc:GetDefense() local def=tc:GetDefense()
local lv=tc:GetLevel() local lv=tc:GetLevel()
local race=tc:GetRace() local race=tc:GetRace()
local att=tc:GetAttribute() local att=tc:GetAttribute()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,93130022,0,0x4011,atk,def,lv,race,att) then return end
local token=Duel.CreateToken(tp,93130022) local token=Duel.CreateToken(tp,93130022)
tc:CreateRelation(token,RESET_EVENT+0x1fe0000) tc:CreateRelation(token,RESET_EVENT+0x1fe0000)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
...@@ -114,15 +96,12 @@ function c54289683.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -114,15 +96,12 @@ function c54289683.operation(e,tp,eg,ep,ev,re,r,rp)
token:RegisterEffect(e6,true) token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete() Duel.SpecialSummonComplete()
else else
if tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end local e1=Effect.CreateEffect(c)
if tc:IsRelateToEffect(e) and tc:IsFaceup() then e1:SetType(EFFECT_TYPE_SINGLE)
local e1=Effect.CreateEffect(c) e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetValue(400)
e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+0x1ff0000)
e1:SetValue(400) tc:RegisterEffect(e1)
e1:SetReset(RESET_EVENT+0x1ff0000)
tc:RegisterEffect(e1)
end
end end
end end
function c54289683.tokenatk(e,c) function c54289683.tokenatk(e,c)
......
...@@ -16,11 +16,10 @@ end ...@@ -16,11 +16,10 @@ end
function c93130021.filter(c) function c93130021.filter(c)
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP) return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end end
function c93130021.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c93130021.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsOnField() and c93130021.filter(chkc) end
if chk==0 then return true end if chk==0 then return true end
local c=e:GetHandler() local c=e:GetHandler()
local t1=Duel.IsExistingTarget(c93130021.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) local t1=Duel.IsExistingMatchingCard(c93130021.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
local t2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 local t2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,93130022,0,0x4011,c:GetAttack(),c:GetDefense(),c:GetLevel(),c:GetRace(),c:GetAttribute()) and Duel.IsPlayerCanSpecialSummonMonster(tp,93130022,0,0x4011,c:GetAttack(),c:GetDefense(),c:GetLevel(),c:GetRace(),c:GetAttribute())
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(93130021,0)) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(93130021,0))
...@@ -34,27 +33,25 @@ function c93130021.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -34,27 +33,25 @@ function c93130021.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
else op=Duel.SelectOption(tp,aux.Stringid(93130021,1)) end else op=Duel.SelectOption(tp,aux.Stringid(93130021,1)) end
e:SetLabel(op) e:SetLabel(op)
if op==1 then if op==1 then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetCategory(CATEGORY_DESTROY) e:SetCategory(CATEGORY_DESTROY)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.GetMatchingGroup(c93130021.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
local g=Duel.SelectTarget(tp,c93130021.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
elseif op==2 then elseif op==2 then
e:SetProperty(0)
e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
else else
e:SetProperty(0)
e:SetCategory(CATEGORY_ATKCHANGE) e:SetCategory(CATEGORY_ATKCHANGE)
end end
end end
function c93130021.operation(e,tp,eg,ep,ev,re,r,rp) function c93130021.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if e:GetLabel()==1 then if e:GetLabel()==1 then
local tc=Duel.GetFirstTarget() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
if tc:IsRelateToEffect(e) then local g=Duel.SelectMatchingCard(tp,c93130021.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.Destroy(tc,REASON_EFFECT) if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.Destroy(g,REASON_EFFECT)
end end
elseif e:GetLabel()==2 then elseif e:GetLabel()==2 then
local atk=c:GetAttack() local atk=c:GetAttack()
......
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