Add miss message, ensure immediate escape for DSum
This commit is contained in:
parent
57b3d74966
commit
d42b289aff
|
@ -273,15 +273,29 @@ function Control.encounters()
|
||||||
return encounters
|
return encounters
|
||||||
end
|
end
|
||||||
|
|
||||||
function Control.encounter(wildBattle)
|
function Control.encounter(battleState)
|
||||||
|
if battleState > 0 then
|
||||||
|
local wildBattle = battleState == 1
|
||||||
local isCritical
|
local isCritical
|
||||||
local battleMenu = Memory.value("battle", "menu")
|
local battleMenu = Memory.value("battle", "menu")
|
||||||
if battleMenu == 94 then
|
if battleMenu == 94 then
|
||||||
isCritical = false
|
isCritical = false
|
||||||
|
Control.missed = false
|
||||||
elseif Memory.double("battle", "our_hp") == 0 then
|
elseif Memory.double("battle", "our_hp") == 0 then
|
||||||
if Memory.value("battle", "critical") == 1 then
|
if Memory.value("battle", "critical") == 1 then
|
||||||
isCritical = true
|
isCritical = true
|
||||||
end
|
end
|
||||||
|
elseif not Control.missed then
|
||||||
|
local turnMarker = Memory.value("battle", "our_turn")
|
||||||
|
if turnMarker == 100 or turnMarker == 128 then
|
||||||
|
local isMiss = Memory.value("battle", "miss") == 1
|
||||||
|
if isMiss then
|
||||||
|
if Battle.accurateAttack and Memory.value("battle", "accuracy") == 7 then
|
||||||
|
Bridge.chat("Gen 1 missed! (1 in 256 chance.)")
|
||||||
|
end
|
||||||
|
Control.missed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if isCritical ~= nil and isCritical ~= Control.criticaled then
|
if isCritical ~= nil and isCritical ~= Control.criticaled then
|
||||||
Control.criticaled = isCritical
|
Control.criticaled = isCritical
|
||||||
|
@ -289,6 +303,7 @@ function Control.encounter(wildBattle)
|
||||||
if wildBattle then
|
if wildBattle then
|
||||||
local opponentHP = Memory.double("battle", "opponent_hp")
|
local opponentHP = Memory.double("battle", "opponent_hp")
|
||||||
if not Control.inBattle then
|
if not Control.inBattle then
|
||||||
|
Control.escaped = false
|
||||||
if opponentHP > 0 then
|
if opponentHP > 0 then
|
||||||
Control.killedCatch = false
|
Control.killedCatch = false
|
||||||
Control.inBattle = true
|
Control.inBattle = true
|
||||||
|
@ -315,6 +330,12 @@ function Control.encounter(wildBattle)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif Control.inBattle then
|
||||||
|
if Memory.value("battle", "turns") == 0 then
|
||||||
|
Control.escaped = true
|
||||||
|
end
|
||||||
|
Control.inBattle = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Control.reset()
|
function Control.reset()
|
||||||
|
|
|
@ -125,7 +125,7 @@ Strategies.timeRequirements = {
|
||||||
|
|
||||||
local function nidoranDSum(disabled)
|
local function nidoranDSum(disabled)
|
||||||
local sx, sy = Player.position()
|
local sx, sy = Player.position()
|
||||||
if not disabled and status.tries == nil then
|
if not disabled and status.tries == nil and Control.escaped then
|
||||||
local opponentName = Battle.opponent()
|
local opponentName = Battle.opponent()
|
||||||
local opLevel = Memory.value("battle", "opponent_level")
|
local opLevel = Memory.value("battle", "opponent_level")
|
||||||
if opponentName == "rattata" then
|
if opponentName == "rattata" then
|
||||||
|
@ -156,7 +156,7 @@ local function nidoranDSum(disabled)
|
||||||
status.tries = 0
|
status.tries = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not disabled and status.tries ~= 0 then
|
if not disabled and status.tries ~= 0 and Control.escaped then
|
||||||
if status.tries[status.tries.idx] == 0 then
|
if status.tries[status.tries.idx] == 0 then
|
||||||
status.tries.idx = status.tries.idx + 1
|
status.tries.idx = status.tries.idx + 1
|
||||||
if status.tries.idx > 3 then
|
if status.tries.idx > 3 then
|
||||||
|
|
|
@ -75,7 +75,9 @@ end
|
||||||
|
|
||||||
function Strategies.death(extra)
|
function Strategies.death(extra)
|
||||||
local reason
|
local reason
|
||||||
if Control.criticaled then
|
if Control.missed then
|
||||||
|
reason = "Missed"
|
||||||
|
elseif Control.criticaled then
|
||||||
reason = "Critical'd"
|
reason = "Critical'd"
|
||||||
elseif Control.yolo then
|
elseif Control.yolo then
|
||||||
reason = "Yolo strats"
|
reason = "Yolo strats"
|
||||||
|
|
6
main.lua
6
main.lua
|
@ -147,11 +147,7 @@ while true do
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local battleState = Memory.value("game", "battle")
|
local battleState = Memory.value("game", "battle")
|
||||||
if battleState > 0 then
|
Control.encounter(battleState)
|
||||||
Control.encounter(battleState == 1)
|
|
||||||
else
|
|
||||||
Control.inBattle = false
|
|
||||||
end
|
|
||||||
local curr_hp = Pokemon.index(0, "hp")
|
local curr_hp = Pokemon.index(0, "hp")
|
||||||
-- if curr_hp ~= lastHP then
|
-- if curr_hp ~= lastHP then
|
||||||
-- Bridge.hp(curr_hp, Pokemon.index(0, "max_hp"))
|
-- Bridge.hp(curr_hp, Pokemon.index(0, "max_hp"))
|
||||||
|
|
|
@ -63,6 +63,9 @@ local memoryNames = {
|
||||||
|
|
||||||
opponent_move = 0x0FEE,
|
opponent_move = 0x0FEE,
|
||||||
critical = 0x105E,
|
critical = 0x105E,
|
||||||
|
miss = 0x105F,
|
||||||
|
our_turn = 0x1FF1,
|
||||||
|
turns = 0x0CD5,
|
||||||
|
|
||||||
opponent_bide = 0x106F,
|
opponent_bide = 0x106F,
|
||||||
opponent_id = 0x0FE5,
|
opponent_id = 0x0FE5,
|
||||||
|
|
Loading…
Reference in New Issue