Add DSum for Nidoran 6 catch

This commit is contained in:
Kyle Coburn 2015-04-16 12:38:17 -07:00
parent 193ab263d4
commit ddf072757a
2 changed files with 116 additions and 19 deletions

View File

@ -29,11 +29,7 @@ Strategies.flareon = true
Strategies.timeRequirements = { Strategies.timeRequirements = {
nidoran = function() nidoran = function()
local timeLimit = 8 return 10
if Pokemon.inParty("pidgey") then
timeLimit = timeLimit + 0.67
end
return timeLimit
end, end,
mt_moon = function() mt_moon = function()
@ -67,6 +63,108 @@ Strategies.timeRequirements = {
-- HELPERS -- HELPERS
local function nidoranDSum(enabled)
local px, py = Player.position()
if enabled and status.path == nil then
local opponentName = Battle.opponent()
local opponentLevel = Memory.value("battle", "opponent_level")
if opponentName == "rattata" then
if opponentLevel == 3 then
status.path = {4, 37}
elseif opponentLevel == 4 then
status.path = {0, 24}
end
elseif opponentName == "pidgey" then
if opponentLevel == 3 then
status.path = {0, 32}
elseif opponentLevel == 5 then
status.path = {0, 10}
end
elseif opponentName == "nidoran" then
if opponentLevel == 4 then
status.path = {0, 19}
end
elseif opponentName == "nidoranf" then
if opponentLevel == 4 then
status.path = {0, 14}
elseif opponentLevel == 6 then
status.path = {0, 4}
end
end
if status.path then
status.pathIndex = 1
status.pathX, status.pathY = px, py
else
status.path = 0
end
end
local dx, dy = px, py
if enabled and status.path ~= 0 then
if status.path[status.pathIndex] == 0 then
status.pathIndex = status.pathIndex + 1
if status.pathIndex > 2 then
status.path = 0
end
return nidoranDSum()
end
if status.pathX ~= px or status.pathY ~= py then
status.path[status.pathIndex] = status.path[status.pathIndex] - 1
status.pathX, status.pathY = px, py
end
if status.pathIndex == 1 then
dx = 4
else
dx = 3
end
if px == dx then
if Player.isFacing("Up") then
if py > 48 then
dy = 48
else
dy = 51
end
else
if py > 50 then
dy = 48
else
dy = 51
end
end
end
else
if px == 4 and py == 48 then
local encounterless = Memory.value("game", "encounterless")
if encounterless == 0 then
if not status.bonkWait then
local direction
if Player.isFacing("Up") then
direction = "Left"
else
direction = "Up"
end
Input.press(direction, direction == "Up" and 3 or 2)
end
status.bonkWait = not status.bonkWait
return
end
if encounterless < 2 then
dx = 3
else
dy = 49
end
else
status.bonkWait = nil
if py ~= 48 then
dy = 48
else
dx = 4
end
end
end
Walk.step(dx, dy)
end
local function depositPikachu() local function depositPikachu()
if Menu.isOpened() then if Menu.isOpened() then
local pc = Memory.value("menu", "size") local pc = Memory.value("menu", "size")
@ -162,13 +260,13 @@ strategyFunctions.catchNidoran = function()
return Strategies.reset("Ran too low on PokeBalls", pokeballs) return Strategies.reset("Ran too low on PokeBalls", pokeballs)
end end
if Battle.isActive() then if Battle.isActive() then
status.path = nil
local isNidoran = Pokemon.isOpponent("nidoran") local isNidoran = Pokemon.isOpponent("nidoran")
if isNidoran and Memory.value("battle", "opponent_level") == 6 then if isNidoran and Memory.value("battle", "opponent_level") == 6 then
if Strategies.initialize() then if Strategies.initialize() then
Bridge.pollForName() Bridge.pollForName()
end end
end end
status.tries = nil
if Memory.value("menu", "text_input") == 240 then if Memory.value("menu", "text_input") == 240 then
Textbox.name() Textbox.name()
elseif Menu.hasTextbox() then elseif Menu.hasTextbox() then
@ -182,30 +280,28 @@ strategyFunctions.catchNidoran = function()
end end
else else
Pokemon.updateParty() Pokemon.updateParty()
local px, py = Player.position()
local hasNidoran = Pokemon.inParty("nidoran") local hasNidoran = Pokemon.inParty("nidoran")
if hasNidoran then if hasNidoran then
if px < 8 then local px, py = Player.position()
px = 8 local dx, dy = px, py
if px ~= 8 then
dx = 8
elseif py > 47 then
dy = 47
else else
Bridge.caught("nidoran") Bridge.caught("nidoran")
return true return true
end end
Walk.step(dx, dy)
else else
local timeLimit = Strategies.getTimeRequirement("nidoran") local resetLimit = Strategies.getTimeRequirement("nidoran")
local resetMessage = "find a suitable Nidoran" local resetMessage = "find a suitable Nidoran"
if Strategies.resetTime(timeLimit, resetMessage) then if Strategies.resetTime(resetLimit, resetMessage) then
return true return true
end end
if py > 48 then local enableDSum = Control.escaped and not Strategies.overMinute(resetLimit - 0.25)
py = 48 nidoranDSum(enableDSum)
elseif px < 9 then
px = 9
else
px = 8
end
end end
Walk.step(px, py) --TODO DSum
end end
end end

View File

@ -42,6 +42,7 @@ local memoryNames = {
battle = 0x1057, battle = 0x1057,
textbox = 0x0FC4, textbox = 0x0FC4,
fly = 0x1FEF, fly = 0x1FEF,
encounterless = 0x113C,
}, },
time = { time = {
hours = 0x1A41, hours = 0x1A41,