Update DSum for Yellow with custom walking control

This commit is contained in:
Kyle Coburn 2015-05-05 23:57:47 -07:00
parent bc3af41054
commit cb3527cafa
2 changed files with 27 additions and 6 deletions

View File

@ -115,6 +115,7 @@ local function nidoranDSum(enabled)
local dx, dy = px, py
local cornerBonk = true
local encounterlessSteps = Memory.value("game", "encounterless")
local pikachuX = Memory.value("player", "pikachu_x") - 4
if enabled and status.path ~= 0 then
local duration = status.path[status.pathIndex]
local currentTime = Utils.frames()
@ -125,7 +126,7 @@ local function nidoranDSum(enabled)
else
status.pathIndex = status.pathIndex + 1
end
return nidoranDSum()
return nidoranDSum(enabled)
end
local walkOutside = (status.pathIndex - 1) % 2 == 0
if walkOutside then
@ -139,8 +140,16 @@ local function nidoranDSum(enabled)
elseif encounterlessSteps <= 1 then
if px < 3 then
dx = 3
elseif pikachuX > px then
dx = 2
end
elseif encounterlessSteps >= 2 then
elseif encounterlessSteps == 2 then
if px == 4 then
dx = 3
else
dx = 4
end
elseif encounterlessSteps > 2 then
if px == 3 then
dx = 2
else
@ -150,7 +159,6 @@ local function nidoranDSum(enabled)
end
end
if cornerBonk then
local pikachuX = Memory.value("player", "pikachu_x") - 4
if px == 4 and py == 48 and pikachuX >= px then
dx = px + 1
elseif px >= 4 and py == 48 then
@ -169,7 +177,9 @@ local function nidoranDSum(enabled)
status.bonkWait = not status.bonkWait
return
end
if encounterlessSteps < 2 or dx ~= 3 then
if encounterlessSteps == 1 and dx <= 6 then
dx = px + 1
elseif dx ~= 3 then
dx = 3
else
dx = 4
@ -183,7 +193,7 @@ local function nidoranDSum(enabled)
end
end
end
Walk.step(dx, dy)
Walk.step(dx, dy, true)
end
local function depositPikachu()

View File

@ -29,7 +29,7 @@ local function sendButton(button, ab)
setForFrame = button
end
function Input.press(button, frames)
function Input.press(button, frames, walk)
if setForFrame then
print("ERR: Reassigning "..setForFrame.." to "..button)
return
@ -48,6 +48,17 @@ function Input.press(button, frames)
end
bCancel = button ~= "B"
sendButton(button)
if walk then
local cancel
if bCancel then
cancel = "B"
else
cancel = "A"
end
local inputTable = {[button]=true, [cancel]=true}
joypad.set(inputTable)
end
end
function Input.cancel(accept)