Commit 6b4d636f authored by sidschingis's avatar sidschingis

fixed indexing nil values

parent 22a6b3c0
......@@ -55,12 +55,14 @@ function c20457551.atkdown(e,tp,eg,ep,ev,re,r,rp)
local eqc=e:GetHandler():GetEquipTarget()
if Duel.GetAttacker()~=eqc and Duel.GetAttackTarget()~=eqc then return end
local tc=eqc:GetBattleTarget()
if tc then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_PHASE+RESET_DAMAGE_CAL)
e1:SetValue(-eqc:GetLevel()*100)
tc:RegisterEffect(e1)
end
end
function c20457551.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCurrentPhase()==PHASE_END end
......
......@@ -21,8 +21,10 @@ function c28357177.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
end
function c28357177.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g then g=g:Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
end
end
......@@ -35,5 +35,8 @@ function c36088082.regop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c36088082.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetOwner():GetBattleTarget(),REASON_EFFECT)
local tg=e:GetOwner():GetBattleTarget()
if tg then
Duel.Destroy(tg,REASON_EFFECT)
end
end
......@@ -16,7 +16,7 @@ function c4259068.initial_effect(c)
c:RegisterEffect(e2)
end
function c4259068.costchange(e,re,rp,val)
if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsType(TYPE_SPELL) and not re:GetHandler():IsCode(9236985) then
if re and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsType(TYPE_SPELL) and not re:GetHandler():IsCode(9236985) then
return 0
else
return val
......
......@@ -43,6 +43,8 @@ function c440556.spop(e,tp,eg,ep,ev,re,r,rp)
c:RegisterEffect(e1)
elseif cp~=tp then
local cg=Duel.GetFieldGroup(cp,LOCATION_EXTRA,0)
if cg and cg:GetCount()>0 then
Duel.ConfirmCards(cg,tp)
end
end
end
......@@ -41,12 +41,13 @@ function c47660516.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Overlay(sc,Group.FromCards(tc))
Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
sc:CompleteProcedure()
end
if Duel.GetOverlayCount(tp,0,1)~=0 then
Duel.BreakEffect()
local g1=Duel.GetOverlayGroup(tp,0,1)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(47660516,0))
local mg2=g1:Select(tp,1,1,nil)
Duel.Overlay(sc,mg2)
if Duel.GetOverlayCount(tp,0,1)~=0 then
Duel.BreakEffect()
local g1=Duel.GetOverlayGroup(tp,0,1)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(47660516,0))
local mg2=g1:Select(tp,1,1,nil)
Duel.Overlay(sc,mg2)
end
end
end
......@@ -11,8 +11,9 @@ function c59797187.initial_effect(c)
c:RegisterEffect(e1)
end
function c59797187.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetBattleTarget():IsRelateToBattle() end
Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler():GetBattleTarget(),1,0,0)
local tg=e:GetHandler():GetBattleTarget()
if chk==0 then return tg and tg:IsRelateToBattle() end
Duel.SetOperationInfo(0,CATEGORY_POSITION,tg,1,0,0)
end
function c59797187.operation(e,tp,eg,ep,ev,re,r,rp)
local bc=e:GetHandler():GetBattleTarget()
......
......@@ -47,8 +47,10 @@ function c6178850.value(e,c)
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),0,LOCATION_MZONE)*300
end
function c6178850.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsStatus(STATUS_DESTROY_CONFIRMED)
and e:GetHandler():GetEquipTarget():IsReason(REASON_BATTLE) end
local c=e:GetHandler()
local tg=c:GetEquipTarget()
if chk==0 then return c and not c:IsStatus(STATUS_DESTROY_CONFIRMED)
and tg and tg:IsReason(REASON_BATTLE) end
return Duel.SelectYesNo(tp,aux.Stringid(6178850,0))
end
function c6178850.desop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -87,7 +87,7 @@ function c69954399.destg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c69954399.desop(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetHandler():GetEquipTarget()
if ec:IsRelateToEffect(e) and Duel.Destroy(ec,REASON_EFFECT)~=0 then
if ec and ec:IsRelateToEffect(e) and Duel.Destroy(ec,REASON_EFFECT)~=0 then
Duel.RaiseSingleEvent(e:GetHandler(),69954400,e,0,0,0,0)
end
end
......
......@@ -42,7 +42,7 @@ function c73578229.adjustop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local ag=g:GetMaxGroup(Card.GetAttack)
local preg=e:GetLabelObject()
if ag:Equal(preg) then return end
if ag and ag:Equal(preg) then return end
preg:Clear()
preg:Merge(ag)
Duel.AdjustInstantly(e:GetHandler())
......
......@@ -11,7 +11,7 @@ end
function c75292259.atcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c==Duel.GetAttacker() and bc:IsRelateToBattle()
return c==Duel.GetAttacker() and bc and bc:IsRelateToBattle()
and bc:GetBattlePosition()==POS_FACEUP_ATTACK and c:IsChainAttackable(3)
end
......
......@@ -26,7 +26,11 @@ function c81426505.filter3(c)
return c:IsFacedown() and c:IsDestructable()
end
function c81426505.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil) end
if chk==0 then return
Duel.IsExistingMatchingCard(c81426505.filter1,tp,0,LOCATION_MZONE,1,nil) or
Duel.IsExistingMatchingCard(c81426505.filter2,tp,0,LOCATION_ONFIELD,1,nil) or
Duel.IsExistingMatchingCard(c81426505.filter3,tp,0,LOCATION_SZONE,1,nil)
end
local t={}
local p=1
if Duel.IsExistingMatchingCard(c81426505.filter1,tp,0,LOCATION_MZONE,1,nil) then t[p]=aux.Stringid(81426505,0) p=p+1 end
......
......@@ -19,7 +19,7 @@ function c85562745.initial_effect(c)
c:RegisterEffect(e2)
end
function c85562745.con(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and bit.band(r,REASON_BATTLE)==0 and re:GetHandler():GetCode()~=85562745
return ep~=tp and bit.band(r,REASON_BATTLE)==0 and re and re:GetHandler():GetCode()~=85562745
end
function c85562745.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
......
......@@ -44,6 +44,7 @@ function c85668449.lrcon(e,tp,eg,ep,ev,re,r,rp)
if tp~=ep then return false end
local lp=Duel.GetLP(ep)
if lp<=ev then return false end
if not re then return false end
local rc=re:GetHandler()
return rc:IsRace(RACE_PSYCHO)
end
......
......@@ -32,6 +32,7 @@ function c94585852.initial_effect(c)
c:RegisterEffect(e4)
end
function c94585852.repcon(e,tp,eg,ep,ev,re,r,rp)
if not re then return false end
local rc=re:GetHandler()
return Duel.GetCurrentPhase()==PHASE_STANDBY and rc:IsSetCard(0x45) and rc:IsType(TYPE_MONSTER)
end
......
......@@ -25,6 +25,7 @@ function c99594764.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c99594764.thop(e,tp,eg,ep,ev,re,r,rp)
local eqc=e:GetHandler():GetEquipTarget()
if not eqc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c99594764.filter,tp,LOCATION_DECK,0,1,1,nil,eqc:GetRace(),eqc:GetAttribute())
if g:GetCount()>0 then
......
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