Commit 2abcc29c authored by sidschingis's avatar sidschingis

fixed sometimes referencing nil values

parent 2d58a2cc
......@@ -18,7 +18,7 @@ function c11819616.discon(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return tg:IsExists(Card.IsOnField,1,nil) and Duel.IsChainNegatable(ev)
return tg and tg:IsExists(Card.IsOnField,1,nil) and Duel.IsChainNegatable(ev)
end
function c11819616.costfilter(c)
return c:IsFaceup() and c:IsRace(RACE_PLANT)
......
......@@ -64,7 +64,7 @@ function c14772491.rcon(e)
end
function c14772491.thcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
return tc:IsOnField() and e:GetHandler():IsHasCardTarget(tc)
return tc and tc:IsOnField() and e:GetHandler():IsHasCardTarget(tc)
end
function c14772491.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(e:GetLabelObject(),nil,REASON_EFFECT)
......
......@@ -22,7 +22,7 @@ function c31440542.ctltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c31440542.ctlop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and not Duel.GetControl(tc,tp,PHASE_END,1) then
if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and not Duel.GetControl(tc,tp,PHASE_END,1) then
if not tc:IsImmuneToEffect(e) and tc:IsAbleToChangeControler() then
Duel.Destroy(tc,REASON_EFFECT)
end
......
......@@ -53,7 +53,8 @@ function c56981417.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c56981417.operation(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if not te:GetHandler():IsRelateToEffect(e) then return end
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
if te and te:GetHandler():IsRelateToEffect(e) then
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
end
end
......@@ -27,11 +27,13 @@ function c56995655.op(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) then return end
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,1,nil)
local tc=g:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local op=Duel.SelectOption(tp,70,71,72)
Duel.ConfirmCards(tp,tc)
Duel.ShuffleHand(1-tp)
if (op==0 and tc:IsType(TYPE_MONSTER)) or (op==1 and tc:IsType(TYPE_SPELL)) or (op==2 and tc:IsType(TYPE_TRAP)) then
Duel.Damage(1-tp,700,REASON_EFFECT)
if tc then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local op=Duel.SelectOption(tp,70,71,72)
Duel.ConfirmCards(tp,tc)
Duel.ShuffleHand(1-tp)
if (op==0 and tc:IsType(TYPE_MONSTER)) or (op==1 and tc:IsType(TYPE_SPELL)) or (op==2 and tc:IsType(TYPE_TRAP)) then
Duel.Damage(1-tp,700,REASON_EFFECT)
end
end
end
......@@ -20,7 +20,7 @@ end
function c5818294.negcon(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return g:IsExists(c5818294.tfilter,1,nil,tp)
return g and g:IsExists(c5818294.tfilter,1,nil,tp)
end
function c5818294.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
......
......@@ -19,7 +19,7 @@ end
function c68786330.poscon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
return a:IsRelateToBattle() and d:IsRelateToBattle() and a:IsRace(RACE_REPTILE) and d:IsPosition(POS_DEFENCE)
return a and d and a:IsRelateToBattle() and d:IsRelateToBattle() and a:IsRace(RACE_REPTILE) and d:IsPosition(POS_DEFENCE)
end
function c68786330.posop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
......
......@@ -57,5 +57,8 @@ function c71315423.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,e:GetHandler():GetEquipTarget():GetControler(),400)
end
function c71315423.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(e:GetHandler():GetEquipTarget():GetControler(),400,REASON_EFFECT)
local tg=e:GetHandler():GetEquipTarget()
if tg then
Duel.Damage(tg:GetControler(),400,REASON_EFFECT)
end
end
......@@ -26,7 +26,9 @@ function c73414375.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if Duel.IsExistingTarget(c73414375.filter,1-tp,0,LOCATION_GRAVE,1,nil) and Duel.SelectYesNo(1-tp,aux.Stringid(73414375,1)) then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_REMOVE)
local rg=Duel.SelectTarget(1-tp,c73414375.filter,1-tp,0,LOCATION_GRAVE,1,3,nil)
g:Merge(rg)
if rg then
g:Merge(rg)
end
end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
end
......
......@@ -71,7 +71,7 @@ function c88307361.discon(e,tp,eg,ep,ev,re,r,rp)
if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return tg:IsContains(c) and Duel.IsChainNegatable(ev)
return tg and tg:IsContains(c) and Duel.IsChainNegatable(ev)
end
function c88307361.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsRace,1,e:GetHandler(),RACE_FISH) end
......
......@@ -14,7 +14,9 @@ function c99902789.initial_effect(c)
c:RegisterEffect(e1)
end
function c99902789.discon(e,tp,eg,ep,ev,re,r,rp)
return Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and Duel.GetAttacker():IsControler(tp) and Duel.GetAttackTarget()~=nil
local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget()
return Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and at and (a and a:IsControler(tp) or at:IsControler(tp))
and ep~=tp and re:GetActiveType()==TYPE_TRAP and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
end
function c99902789.discost(e,tp,eg,ep,ev,re,r,rp,chk)
......
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