Commit 22b2334e authored by VanillaSalt's avatar VanillaSalt

fix

parent a3d6af60
...@@ -425,6 +425,7 @@ public: ...@@ -425,6 +425,7 @@ public:
int32 process_idle_command(uint16 step); int32 process_idle_command(uint16 step);
int32 process_battle_command(uint16 step); int32 process_battle_command(uint16 step);
int32 process_damage_step(uint16 step); int32 process_damage_step(uint16 step);
void field::calculate_battle_damage(effect** pdamchange, card** preason_card, uint8 *battle_destroyed);
int32 process_turn(uint16 step, uint8 turn_player); int32 process_turn(uint16 step, uint8 turn_player);
int32 add_chain(uint16 step); int32 add_chain(uint16 step);
......
This diff is collapsed.
...@@ -55,7 +55,8 @@ end ...@@ -55,7 +55,8 @@ end
function c12644061.damcon(e,tp,eg,ep,ev,re,r,rp) function c12644061.damcon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker() local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget() local at=Duel.GetAttackTarget()
return ep==tp and ((a:IsControler(tp) and a:IsSetCard(0x1034)) or (at and at:IsControler(tp) and at:IsSetCard(0x1034))) return Duel.GetBattleDamage(tp)>0
and ((a:IsControler(tp) and a:IsSetCard(0x1034)) or (at and at:IsControler(tp) and at:IsSetCard(0x1034)))
end end
function c12644061.dfilter(c) function c12644061.dfilter(c)
return c:IsSetCard(0x1034) and c:IsAbleToGraveAsCost() return c:IsSetCard(0x1034) and c:IsAbleToGraveAsCost()
...@@ -74,7 +75,8 @@ function c12644061.damop(e,tp,eg,ep,ev,re,r,rp) ...@@ -74,7 +75,8 @@ function c12644061.damop(e,tp,eg,ep,ev,re,r,rp)
e1:SetCode(EVENT_PRE_BATTLE_DAMAGE) e1:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e1:SetRange(LOCATION_FZONE) e1:SetRange(LOCATION_FZONE)
e1:SetOperation(c12644061.dop) e1:SetOperation(c12644061.dop)
c:RegisterEffect(e1,tp) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE)
c:RegisterEffect(e1)
end end
function c12644061.dop(e,tp,eg,ep,ev,re,r,rp) function c12644061.dop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeBattleDamage(tp,0) Duel.ChangeBattleDamage(tp,0)
......
...@@ -51,12 +51,11 @@ function c14001430.reptg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -51,12 +51,11 @@ function c14001430.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return bit.band(r,REASON_EFFECT)~=0 and re and re:IsActiveType(TYPE_MONSTER) if chk==0 then return bit.band(r,REASON_EFFECT)~=0 and re and re:IsActiveType(TYPE_MONSTER)
and re:GetHandler():IsSetCard(0x71) and eg:IsExists(c14001430.repfilter,1,nil,tp) end and re:GetHandler():IsSetCard(0x71) and eg:IsExists(c14001430.repfilter,1,nil,tp) end
if Duel.SelectYesNo(tp,aux.Stringid(14001430,0)) then if Duel.SelectYesNo(tp,aux.Stringid(14001430,0)) then
local ct=eg:FilterCount(c14001430.repfilter,nil,tp) local g=eg:Filter(c14001430.repfilter,nil,tp)
local ct=g:GetCount()
if ct>1 then if ct>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
g=eg:FilterSelect(tp,c14001430.repfilter,1,ct,nil,tp) g=g:Select(tp,1,ct,nil)
else
g=eg:Filter(c14001430.repfilter,nil,tp)
end end
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
......
...@@ -9,7 +9,7 @@ function c16674846.initial_effect(c) ...@@ -9,7 +9,7 @@ function c16674846.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c16674846.condition(e,tp,eg,ep,ev,re,r,rp) function c16674846.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp return Duel.GetTurnPlayer()~=tp and Duel.GetBattleDamage(tp)>0
end end
function c16674846.filter(c) function c16674846.filter(c)
return c:IsDefenceBelow(1500) and c:IsType(TYPE_TUNER) and c:IsRace(RACE_WARRIOR) return c:IsDefenceBelow(1500) and c:IsType(TYPE_TUNER) and c:IsRace(RACE_WARRIOR)
...@@ -20,6 +20,7 @@ function c16674846.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -20,6 +20,7 @@ function c16674846.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PRE_BATTLE_DAMAGE) e1:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e1:SetOperation(c16674846.damop) e1:SetOperation(c16674846.damop)
e1:SetReset(RESET_PHASE+PHASE_DAMAGE)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
local g=Duel.GetMatchingGroup(c16674846.filter,tp,LOCATION_GRAVE,0,nil) local g=Duel.GetMatchingGroup(c16674846.filter,tp,LOCATION_GRAVE,0,nil)
if g:GetCount()~=0 and Duel.SelectYesNo(tp,aux.Stringid(16674846,0)) then if g:GetCount()~=0 and Duel.SelectYesNo(tp,aux.Stringid(16674846,0)) then
......
...@@ -21,15 +21,13 @@ end ...@@ -21,15 +21,13 @@ end
function c23171610.target(e,tp,eg,ep,ev,re,r,rp,chk) function c23171610.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c23171610.filter,tp,LOCATION_MZONE,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(c23171610.filter,tp,LOCATION_MZONE,0,1,nil) end
local g=Duel.GetMatchingGroup(c23171610.filter,tp,LOCATION_MZONE,0,nil) local g=Duel.GetMatchingGroup(c23171610.filter,tp,LOCATION_MZONE,0,nil)
g:KeepAlive() Duel.SetTargetCard(g)
e:SetLabelObject(g)
end end
function c23171610.filter2(c,e,tp) function c23171610.filter2(c,e)
return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsRace(RACE_MACHINE) and not c:IsImmuneToEffect(e) return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e)
end end
function c23171610.activate(e,tp,eg,ep,ev,re,r,rp) function c23171610.activate(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject() local sg=Duel.GetMatchingGroup(c23171610.filter2,tp,LOCATION_MZONE,0,nil,e)
local sg=g:Filter(c23171610.filter2,nil,e,tp)
local c=e:GetHandler() local c=e:GetHandler()
local fid=c:GetFieldID() local fid=c:GetFieldID()
local tc=sg:GetFirst() local tc=sg:GetFirst()
......
...@@ -10,7 +10,7 @@ function c24268052.initial_effect(c) ...@@ -10,7 +10,7 @@ function c24268052.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c24268052.condition(e,tp,eg,ep,ev,re,r,rp) function c24268052.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp return Duel.GetTurnPlayer()~=tp and Duel.GetBattleDamage(tp)>0
end end
function c24268052.target(e,tp,eg,ep,ev,re,r,rp,chk) function c24268052.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
...@@ -21,6 +21,7 @@ function c24268052.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -21,6 +21,7 @@ function c24268052.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PRE_BATTLE_DAMAGE) e1:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e1:SetOperation(c24268052.damop) e1:SetOperation(c24268052.damop)
e1:SetReset(RESET_PHASE+PHASE_DAMAGE)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
Duel.Draw(tp,1,REASON_EFFECT) Duel.Draw(tp,1,REASON_EFFECT)
end end
......
...@@ -11,22 +11,7 @@ function c29389368.initial_effect(c) ...@@ -11,22 +11,7 @@ function c29389368.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c29389368.condition(e,tp,eg,ep,ev,re,r,rp) function c29389368.condition(e,tp,eg,ep,ev,re,r,rp)
local ar=Duel.GetAttacker() return Duel.GetBattleDamage(tp)>=2000
local at=Duel.GetAttackTarget()
local v1=0
if ar:IsPosition(POS_DEFENCE) and ar:IsHasEffect(EFFECT_DEFENCE_ATTACK) then v1=ar:GetDefence()
else v1=ar:GetAttack() end
if at then
if at:IsPosition(POS_ATTACK) then
return v1-at:GetAttack()>=2000
elseif ar:IsHasEffect(EFFECT_PIERCE)
return v1-at:GetDefence()>=2000
else
return false
end
else
return v1>=2000
end
end end
function c29389368.target(e,tp,eg,ep,ev,re,r,rp,chk) function c29389368.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
......
...@@ -12,7 +12,7 @@ function c40640057.initial_effect(c) ...@@ -12,7 +12,7 @@ function c40640057.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c40640057.con(e,tp,eg,ep,ev,re,r,rp) function c40640057.con(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp return Duel.GetTurnPlayer()~=tp and Duel.GetBattleDamage(tp)>0
end end
function c40640057.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c40640057.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsDiscardable() end if chk==0 then return e:GetHandler():IsDiscardable() end
...@@ -23,6 +23,7 @@ function c40640057.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -23,6 +23,7 @@ function c40640057.op(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PRE_BATTLE_DAMAGE) e1:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e1:SetOperation(c40640057.damop) e1:SetOperation(c40640057.damop)
e1:SetReset(RESET_PHASE+PHASE_DAMAGE)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
end end
function c40640057.damop(e,tp,eg,ep,ev,re,r,rp) function c40640057.damop(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -14,7 +14,7 @@ function c47432275.initial_effect(c) ...@@ -14,7 +14,7 @@ function c47432275.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c47432275.con(e,tp,eg,ep,ev,re,r,rp) function c47432275.con(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttackTarget()==e:GetHandler() return Duel.GetAttackTarget()==e:GetHandler() and Duel.GetBattleDamage(tp)>0
end end
function c47432275.target(e,tp,eg,ep,ev,re,r,rp,chk) function c47432275.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
...@@ -29,6 +29,7 @@ function c47432275.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -29,6 +29,7 @@ function c47432275.op(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PRE_BATTLE_DAMAGE) e1:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e1:SetOperation(c47432275.damop) e1:SetOperation(c47432275.damop)
e1:SetReset(RESET_PHASE+PHASE_DAMAGE)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT) Duel.Recover(p,d,REASON_EFFECT)
......
...@@ -53,7 +53,7 @@ function c48868994.filter(c) ...@@ -53,7 +53,7 @@ function c48868994.filter(c)
return c:IsFaceup() and c:IsAttackPos() and c:IsAbleToChangeControler() return c:IsFaceup() and c:IsAttackPos() and c:IsAbleToChangeControler()
end end
function c48868994.tgd(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c48868994.tgd(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c48868994.filter(chkc) end if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c48868994.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c48868994.filter,tp,0,LOCATION_MZONE,1,nil) end and Duel.IsExistingTarget(c48868994.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
......
...@@ -27,7 +27,7 @@ function c60953118.initial_effect(c) ...@@ -27,7 +27,7 @@ function c60953118.initial_effect(c)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
function c60953118.damcon(e,tp,eg,ep,ev,re,r,rp) function c60953118.damcon(e,tp,eg,ep,ev,re,r,rp)
return true return Duel.GetBattleDamage(tp)>0
end end
function c60953118.damcost(e,tp,eg,ep,ev,re,r,rp,chk) function c60953118.damcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
...@@ -38,6 +38,7 @@ function c60953118.damop(e,tp,eg,ep,ev,re,r,rp) ...@@ -38,6 +38,7 @@ function c60953118.damop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PRE_BATTLE_DAMAGE) e1:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e1:SetOperation(c60953118.dop) e1:SetOperation(c60953118.dop)
e1:SetReset(RESET_PHASE+PHASE_DAMAGE)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
end end
function c60953118.dop(e,tp,eg,ep,ev,re,r,rp) function c60953118.dop(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -17,7 +17,8 @@ end ...@@ -17,7 +17,8 @@ end
function c83682725.dfilter(c,lv) function c83682725.dfilter(c,lv)
return (c:IsFacedown() or c:IsLevelBelow(lv-1)) and c:IsAbleToHand() return (c:IsFacedown() or c:IsLevelBelow(lv-1)) and c:IsAbleToHand()
end end
function c83682725.target(e,tp,eg,ep,ev,re,r,rp,chk) function c83682725.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c83682725.filter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(c83682725.filter,tp,LOCATION_MZONE,0,1,nil,tp) end if chk==0 then return Duel.IsExistingTarget(c83682725.filter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c83682725.filter,tp,LOCATION_MZONE,0,1,1,nil,tp) local g=Duel.SelectTarget(tp,c83682725.filter,tp,LOCATION_MZONE,0,1,1,nil,tp)
......
...@@ -15,7 +15,7 @@ function c99733359.initial_effect(c) ...@@ -15,7 +15,7 @@ function c99733359.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c99733359.condition(e,tp,eg,ep,ev,re,r,rp) function c99733359.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp return Duel.GetTurnPlayer()~=tp and Duel.GetBattleDamage(tp)>0
end end
function c99733359.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c99733359.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end if chk==0 then return Duel.CheckLPCost(tp,1000) end
...@@ -40,6 +40,7 @@ function c99733359.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -40,6 +40,7 @@ function c99733359.operation(e,tp,eg,ep,ev,re,r,rp)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PRE_BATTLE_DAMAGE) e2:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e2:SetOperation(c99733359.damop) e2:SetOperation(c99733359.damop)
e2:SetReset(RESET_PHASE+PHASE_DAMAGE)
Duel.RegisterEffect(e2,tp) Duel.RegisterEffect(e2,tp)
end 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