Commit dabe7160 authored by VanillaSalt's avatar VanillaSalt

Merge pull request #620 from sidschingis/master

fix sometimes referencing nil values
parents 51a9b729 61c98c9b
......@@ -44,7 +44,7 @@ function c20374351.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 false 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 c20374351.cfilter(c)
return c:IsSetCard(0x39) and c:IsAbleToRemoveAsCost()
......
......@@ -48,6 +48,7 @@ function c21702241.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e)
and not e:GetHandler():IsStatus(STATUS_CHAINING) end
local ec=e:GetHandler():GetEquipTarget()
if not ec then return false end
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,ec:GetControler(),ec:GetBaseAttack())
end
function c21702241.damop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -32,6 +32,7 @@ function c22628574.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(22628574,0))
local g=Duel.SelectTarget(tp,c22628574.filter,tp,0,LOCATION_GRAVE,1,1,nil)
if not g then return false end
local te,eg,ep,ev,re,r,rp=g:GetFirst():CheckActivateEffect(false,true,true)
e:SetLabelObject(te)
Duel.ClearTargetCard()
......
......@@ -45,7 +45,7 @@ function c24096228.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c24096228.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
if not tc or not tc:IsRelateToEffect(e) then return end
local tpe=tc:GetType()
local te=tc:GetActivateEffect()
local tg=te:GetTarget()
......
......@@ -44,7 +44,7 @@ function c440556.spop(e,tp,eg,ep,ev,re,r,rp)
elseif cp~=tp then
local cg=Duel.GetFieldGroup(cp,LOCATION_EXTRA,0)
if cg and cg:GetCount()>0 then
Duel.ConfirmCards(cg,tp)
Duel.ConfirmCards(tp,cg)
end
end
end
......@@ -37,6 +37,7 @@ function c56321639.initial_effect(c)
c:RegisterEffect(e4)
end
function c56321639.ctcon(e,tp,eg,ep,ev,re,r,rp)
if not re then return false end
local c=re:GetHandler()
return e:GetHandler()~=re:GetHandler() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and c:IsSetCard(0x106e)
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 and ag:Equal(preg) then return end
if not ag or ag:Equal(preg) then return end
preg:Clear()
preg:Merge(ag)
Duel.AdjustInstantly(e:GetHandler())
......@@ -52,6 +52,8 @@ function c73578229.desop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_ACTIVATED) then
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local ag=g:GetMaxGroup(Card.GetAttack)
Duel.Destroy(ag,REASON_EFFECT)
if ag then
Duel.Destroy(ag,REASON_EFFECT)
end
end
end
......@@ -36,6 +36,7 @@ function c78004197.spop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) and Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)>0 and e:GetLabel()==1 then
Duel.BreakEffect()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if not g then return end
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(sg,REASON_EFFECT)
end
......
......@@ -27,7 +27,7 @@ function c82377606.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c82377606.atkop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
......
......@@ -52,7 +52,7 @@ function c83135907.desop(e,tp,eg,ep,ev,re,r,rp)
end
function c83135907.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return bit.band(c:GetReason(),0x41)==0x41 and re:GetOwner():IsSetCard(0x24)
return bit.band(c:GetReason(),0x41)==0x41 and re and re:GetOwner():IsSetCard(0x24)
end
function c83135907.filter(c)
return c:IsSetCard(0x24) and c:IsType(TYPE_MONSTER) and c:GetCode()~=83135907 and c:IsAbleToHand()
......
......@@ -52,7 +52,7 @@ function c92373006.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c92373006.spop(e,tp,eg,ep,ev,re,r,rp)
local rc=Duel.GetFirstTarget()
if not rc:IsFaceup() or not rc:IsRelateToEffect(e) then return end
if not rc or not rc:IsFaceup() or not rc:IsRelateToEffect(e) then return end
local rt=Duel.SendtoDeck(rc,nil,2,REASON_EFFECT)
if rt==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......
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