diff --git a/ai/red/strategies.lua b/ai/red/strategies.lua index bb4c134..731bf2d 100644 --- a/ai/red/strategies.lua +++ b/ai/red/strategies.lua @@ -732,8 +732,6 @@ end -- dodgeCerulean --- dodgeCeruleanLeft - strategyFunctions.rivalSandAttack = function(data) if Battle.isActive() then if Battle.redeployNidoking() then diff --git a/ai/strategies.lua b/ai/strategies.lua index 37ca537..a17e395 100644 --- a/ai/strategies.lua +++ b/ai/strategies.lua @@ -219,20 +219,20 @@ function Strategies.dodgeUp(npc, sx, sy, dodge, offset) Walk.step(wx, wy) end -local function dodgeH(options) +local function dodgeSideways(options) local left = 1 if options.left then left = -1 end local px, py = Player.position() - if px * left > options.sx * left + (options.dist or 1) * left then + if px * left > (options.sx + (options.dist or 1)) * left then return true end local wx, wy = px, py if px * left > options.sx * left then wx = px + 1 * left elseif py == options.sy or py == options.dodge then - if py - Memory.raw(options.npc) == options.offset then + if px + left == options.npcX and py - Memory.raw(options.npc) == options.offset then if py == options.sy then wy = options.dodge else @@ -899,24 +899,16 @@ Strategies.functions = { return true end, - dodgeCerulean = function() - return dodgeH{ + dodgeCerulean = function(data) + local left = data.left + return dodgeSideways { npc = 0x0242, - sx = 14, sy = 18, - dodge = 19, + npcX = 15, + sx = (left and 16 or 14), sy = 18, + dodge = (left and 17 or 19), offset = 10, - dist = 4 - } - end, - - dodgeCeruleanLeft = function() - return dodgeH{ - npc = 0x0242, - sx = 16, sy = 18, - dodge = 17, - offset = 10, - dist = -7, - left = true + dist = (left and -7 or 4), + left = left } end, diff --git a/ai/yellow/strategies.lua b/ai/yellow/strategies.lua index 4dcb42b..5524f90 100644 --- a/ai/yellow/strategies.lua +++ b/ai/yellow/strategies.lua @@ -291,6 +291,23 @@ strategyFunctions.centerMoon = function() return takeCenter(5, 15, 11, 5, 12) end +strategyFunctions.centerCerulean = function() + local currentMap = Memory.value("game", "map") + local ppRequired = 15 + if currentMap == 3 then + if Pokemon.pp(0, "horn_attack") > ppRequired then + local px, py = Player.position() + if py > 8 then + return strategyFunctions.dodgeCerulean({left=true}) + end + end + if not strategyFunctions.dodgeCerulean({}) then + return false + end + end + takeCenter(ppRequired, 3, 19, 17, 16) +end + -- reportMtMoon -- PROCESS diff --git a/data/red/paths.lua b/data/red/paths.lua index 9c76975..192cc38 100644 --- a/data/red/paths.lua +++ b/data/red/paths.lua @@ -96,7 +96,7 @@ local Paths = { -- Cerulean Center {64, {3,7}, {3,3}, {s="confirm",dir="Up"}, {3,8}}, -- To the house - {3, {19,18}, {16,18}, {s="dodgeCeruleanLeft"}, {8,16}, {8,12}, {9,12}, {9,11}}, + {3, {19,18}, {16,18}, {s="dodgeCerulean",left=true}, {8,16}, {8,12}, {9,12}, {9,11}}, -- In the house {230, {2,7}, {2,0}}, -- Outback