Commit a7f53663 authored by salix5's avatar salix5

Duel.CalculateDamage()

parent cbdede8a
......@@ -27,7 +27,8 @@ end
function c21924381.activate(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) and a:IsRelateToEffect(e) and a:IsFaceup() then
if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e)
and a:IsAttackable() and a:IsRelateToEffect(e) and not a:IsImmuneToEffect(e)then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......
......@@ -26,7 +26,7 @@ function c2732323.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
local a=Duel.GetAttacker()
if a:IsOnField() and a:IsFaceup() then
if a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,tc)
end
end
......
......@@ -30,6 +30,10 @@ function c29590905.activate(e,tp,eg,ep,ev,re,r,rp)
gd=gd:Select(tp,1,1,nil)
end
Duel.NegateAttack()
Duel.CalculateDamage(ga:GetFirst(),gd:GetFirst())
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE,1)
local a=ga:GetFirst()
local d=gd:GetFirst()
if a:IsAttackable() and not a:IsImmuneToEffect(e) and not d:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,d)
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE,1)
end
end
......@@ -25,7 +25,7 @@ function c34475451.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
local a=Duel.GetAttacker()
if a:IsOnField() and a:IsFaceup() and not a:IsImmuneToEffect(e) then
if a:IsAttackable() and not a:IsImmuneToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
......
......@@ -26,7 +26,7 @@ end
function c43452193.activate(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget()
if a:IsRelateToEffect(e) and at:IsRelateToEffect(e) and a:IsFaceup() and at:IsFaceup() then
if a:IsRelateToEffect(e) and a:IsAttackable() and at:IsRelateToEffect(e) then
if Duel.SwapControl(a,at,RESET_PHASE+PHASE_END,1) then
Duel.CalculateDamage(a,at)
end
......
......@@ -72,7 +72,7 @@ function c58820923.rmop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c58820923.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1
return Duel.GetTurnCount()~=1 and Duel.GetCurrentPhase()==PHASE_MAIN1 and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_BP)
end
function c58820923.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
......
......@@ -39,14 +39,15 @@ function c62878208.eqop(e,tp,eg,ep,ev,re,r,rp)
local tc=g:GetFirst()
if eq==tc then tc=g:GetNext() end
if eqc and eq:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.Equip(tp,eq,tc)
if Duel.Equip(tp,eq,tc)==0 then return end
Duel.BreakEffect()
local a=eqc
local d=tc
if Duel.GetTurnPlayer()~=tp then
a=tc
d=eqc
end
if a:IsPosition(POS_FACEUP_ATTACK) then
if a:IsAttackable() and not a:IsImmuneToEffect(e) and not d:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,d)
end
end
......
......@@ -55,7 +55,8 @@ end
function c67630339.operation(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local d=c67630339[2]
if a:GetFlagEffect(67630339)~=0 and d:GetFlagEffect(67630339)~=0 then
if a:GetFlagEffect(67630339)~=0 and d:GetFlagEffect(67630339)~=0
and a:IsAttackable() and not a:IsImmuneToEffect(e) and not d:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,d)
end
end
......@@ -48,8 +48,10 @@ function c86049351.activate(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+0x1fe0000)
sc:RegisterEffect(e1)
if bc==Duel.GetAttackTarget() then bc,sc=sc,bc end
Duel.CalculateDamage(bc,sc)
Duel.BreakEffect()
Duel.Damage(tp,atk,REASON_EFFECT)
if bc:IsAttackable() and not bc:IsImmuneToEffect(e) and not sc:IsImmuneToEffect(e) then
Duel.CalculateDamage(bc,sc)
Duel.BreakEffect()
Duel.Damage(tp,atk,REASON_EFFECT)
end
end
end
......@@ -57,7 +57,7 @@ function c91499077.cbop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) and Duel.ChangePosition(c,POS_FACEUP_DEFENCE)~=0 then
local at=Duel.GetAttacker()
if at:IsAttackable() then
if at:IsAttackable() and not at:IsImmuneToEffect(e) and not c:IsImmuneToEffect(e) then
Duel.CalculateDamage(at,c)
end
end
......
......@@ -30,8 +30,8 @@ function c93504463.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local a=Duel.GetAttacker()
if a:IsOnField() and a:IsFaceup() then
Duel.CalculateDamage(a, tc)
if a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,tc)
end
end
end
......@@ -27,13 +27,14 @@ function c96008713.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c96008713.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local a=Duel.GetAttacker()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
if not Duel.GetControl(tc,tp,PHASE_BATTLE,1) then
if not tc:IsImmuneToEffect(e) and tc:IsAbleToChangeControler() then
Duel.Destroy(tc,REASON_EFFECT)
end
else
Duel.ChangeAttackTarget(tc)
elseif a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,tc)
end
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