v0.21-BETA
Update to route32 -now beat falkner -check for toto stats when received + at level 6 -check for toto attack (rage) at violet city -equip berries or bitter_berry if needed -use potions if needed (now work) -try to catch a sentret route29 -try to catch a poliwag route30-31 -try to catch a bellsprout if no sentret route30-31
This commit is contained in:
parent
a4eedba1f5
commit
0015e08e2a
|
@ -50,18 +50,22 @@ local function recover()
|
||||||
second = "super_potion"
|
second = "super_potion"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if first == "potion" or first == "super_potion" or first == "full_restore" then
|
||||||
local potion = Inventory.contains(first, second)
|
local potion = Inventory.contains(first, second)
|
||||||
if potionsForHit(potion, currentHP, maxHP) then
|
if potionsForHit(potion, currentHP, maxHP) then
|
||||||
Inventory.use(potion, nil, true)
|
Inventory.use(potion, nil)
|
||||||
|
--Inventory.use(potion, nil, true)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
--[[if Memory.value("battle", "paralyzed") == 64 then
|
--[[if Memory.value("battle", "paralyzed") == 64 then
|
||||||
local heals = Inventory.contains("paralyze_heal", "full_restore")
|
local heals = Inventory.contains("paralyze_heal", "full_restore")
|
||||||
if heals then
|
if heals then
|
||||||
Inventory.use(heals, nil, true)
|
Inventory.use(heals, nil)
|
||||||
|
--Inventory.use(heals, nil, true)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end]]
|
end]]
|
||||||
|
@ -78,17 +82,17 @@ local function openBattleMenu()
|
||||||
elseif battleMenu == 186 then
|
elseif battleMenu == 186 then
|
||||||
local rowSelected = Memory.value("battle", "menuY")
|
local rowSelected = Memory.value("battle", "menuY")
|
||||||
local columnSelected = Memory.value("battle", "menuX")
|
local columnSelected = Memory.value("battle", "menuX")
|
||||||
if columnSelected == 0 then
|
if columnSelected == 1 then
|
||||||
if rowSelected == 1 then
|
if rowSelected == 2 then
|
||||||
Input.press("Up")
|
Input.press("Up", 2)
|
||||||
else
|
else
|
||||||
Input.press("A")
|
Input.press("A", 2)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Input.press("Left")
|
Input.press("Left", 2)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Input.press("B")
|
Input.press("B", 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -96,7 +100,19 @@ local function attack(attackIndex)
|
||||||
if Memory.double("battle", "opponent_hp") < 1 then
|
if Memory.double("battle", "opponent_hp") < 1 then
|
||||||
Input.cancel()
|
Input.cancel()
|
||||||
elseif openBattleMenu() then
|
elseif openBattleMenu() then
|
||||||
Menu.select(attackIndex, true, false, false, 3)
|
local AttackRow = Memory.value("menu", "input_row")
|
||||||
|
--get waiting
|
||||||
|
local Waiting = Input.isWaiting()
|
||||||
|
if not Waiting then
|
||||||
|
if AttackRow < attackIndex then
|
||||||
|
Input.press("Down", 1)
|
||||||
|
elseif AttackRow > attackIndex then
|
||||||
|
Input.press("Up", 1)
|
||||||
|
else
|
||||||
|
Input.press("A", 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--Menu.select(attackIndex, true, false, false, 3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -105,7 +121,12 @@ function movePP(name)
|
||||||
if not midx then
|
if not midx then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
return Memory.raw(0x0634 + midx)
|
local PokemonID = Memory.value("battle", "our_id")
|
||||||
|
local PokemonIndex = Pokemon.indexOfbyID(PokemonID)
|
||||||
|
local SearchString = "pp"..midx
|
||||||
|
local MovePP = Pokemon.index(PokemonIndex, SearchString)
|
||||||
|
--return Memory.raw(0x0634 + midx)
|
||||||
|
return MovePP
|
||||||
end
|
end
|
||||||
Battle.pp = movePP
|
Battle.pp = movePP
|
||||||
|
|
||||||
|
@ -243,6 +264,20 @@ function Battle.automate(moveName, skipBuffs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Battle.inside_menu(inputing)
|
||||||
|
local battleText = Memory.value("battle", "text")
|
||||||
|
local MenuShopCurrent = Memory.value("menu", "shop_current")
|
||||||
|
if battleText ~= 1 or MenuShopCurrent ~= 79 then
|
||||||
|
if inputing then
|
||||||
|
Input.press("A", 2)
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
elseif battleText == 1 and MenuShopCurrent == 79 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- SACRIFICE
|
-- SACRIFICE
|
||||||
|
|
||||||
function Battle.sacrifice(...)
|
function Battle.sacrifice(...)
|
||||||
|
|
|
@ -29,9 +29,11 @@ end
|
||||||
|
|
||||||
function Textbox.name(letter, randomize)
|
function Textbox.name(letter, randomize)
|
||||||
local inputting = false
|
local inputting = false
|
||||||
if letter ~= TOTODILE_NAME and Memory.value("menu", "current") == 232 then
|
if letter == TOTODILE_NAME and Memory.value("menu", "option_current") == 17 then
|
||||||
inputting = true
|
inputting = true
|
||||||
elseif letter == TOTODILE_NAME and Memory.value("menu", "option_current") == 17 then
|
elseif letter == RIVAL_NAME and Memory.value("menu", "main") == 96 then
|
||||||
|
inputting = true
|
||||||
|
elseif Memory.value("menu", "current") == 232 then
|
||||||
inputting = true
|
inputting = true
|
||||||
end
|
end
|
||||||
if inputting then
|
if inputting then
|
||||||
|
@ -51,17 +53,6 @@ function Textbox.name(letter, randomize)
|
||||||
|
|
||||||
if NameTable[TableNumber] then
|
if NameTable[TableNumber] then
|
||||||
local GetUpper = true
|
local GetUpper = true
|
||||||
--Set Special Chars & Get UpperCase
|
|
||||||
--[[if NameTable[TableNumber] == "<" then
|
|
||||||
GetUpper = false
|
|
||||||
lidx = 28
|
|
||||||
elseif NameTable[TableNumber] == "{" then
|
|
||||||
GetUpper = false
|
|
||||||
lidx = 35
|
|
||||||
elseif NameTable[TableNumber] == "}" then
|
|
||||||
GetUpper = false
|
|
||||||
lidx = 36
|
|
||||||
else]]
|
|
||||||
--its a letter
|
--its a letter
|
||||||
if string.match(NameTable[TableNumber], '%a') then
|
if string.match(NameTable[TableNumber], '%a') then
|
||||||
if string.match(NameTable[TableNumber], '%u') then
|
if string.match(NameTable[TableNumber], '%u') then
|
||||||
|
@ -80,7 +71,6 @@ function Textbox.name(letter, randomize)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
lidx = getIndexForLetter(NameTable[TableNumber], GetUpper)
|
lidx = getIndexForLetter(NameTable[TableNumber], GetUpper)
|
||||||
--end
|
|
||||||
--Check For Waiting
|
--Check For Waiting
|
||||||
local Waiting = Input.isWaiting()
|
local Waiting = Input.isWaiting()
|
||||||
--Proceed
|
--Proceed
|
||||||
|
@ -208,7 +198,7 @@ end]]
|
||||||
end]]
|
end]]
|
||||||
|
|
||||||
function Textbox.isActive()
|
function Textbox.isActive()
|
||||||
if Memory.value("game", "textbox") == 65 then
|
if Memory.value("game", "textbox") == 65 or Memory.value("game", "textbox") == 64 then
|
||||||
return true
|
return true
|
||||||
elseif Memory.value("game", "textbox") == 1 then
|
elseif Memory.value("game", "textbox") == 1 then
|
||||||
return false
|
return false
|
||||||
|
@ -219,7 +209,8 @@ function Textbox.handle()
|
||||||
if not Textbox.isActive() then
|
if not Textbox.isActive() then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
Input.cancel()
|
Input.press("B", 2)
|
||||||
|
--Input.cancel()
|
||||||
end
|
end
|
||||||
|
|
||||||
return Textbox
|
return Textbox
|
||||||
|
|
|
@ -12,7 +12,7 @@ local Pokemon = require "storage.pokemon"
|
||||||
|
|
||||||
|
|
||||||
local path, stepIdx, currentMap, currentMap2
|
local path, stepIdx, currentMap, currentMap2
|
||||||
local pathIdx = 0
|
local pathIdx = 21 --0 or 14(after elm) or 21(inside gym)
|
||||||
local customIdx = 1
|
local customIdx = 1
|
||||||
local customDir = 1
|
local customDir = 1
|
||||||
--local custom_done = false
|
--local custom_done = false
|
||||||
|
@ -20,11 +20,10 @@ local customDir = 1
|
||||||
-- Private functions
|
-- Private functions
|
||||||
|
|
||||||
local function setPath(index, region, region2)
|
local function setPath(index, region, region2)
|
||||||
--if PRINT_PATH then
|
if PRINT_PATH then
|
||||||
-- print("Path Idx : "..index.." *******")
|
print("Path Idx : "..index.." *******")
|
||||||
--end
|
end
|
||||||
pathIdx = index
|
pathIdx = index
|
||||||
--stepIdx = 2
|
|
||||||
stepIdx = 3
|
stepIdx = 3
|
||||||
currentMap = region
|
currentMap = region
|
||||||
currentMap2 = region2
|
currentMap2 = region2
|
||||||
|
@ -46,9 +45,9 @@ end
|
||||||
end]]
|
end]]
|
||||||
|
|
||||||
local function completeStep(region, region2)
|
local function completeStep(region, region2)
|
||||||
--if PRINT_STEP then
|
if PRINT_STEP then
|
||||||
-- print("Step Idx : "..stepIdx)
|
print("Step Idx : "..stepIdx)
|
||||||
--end
|
end
|
||||||
stepIdx = stepIdx + 1
|
stepIdx = stepIdx + 1
|
||||||
return Walk.traverse(region, region2)
|
return Walk.traverse(region, region2)
|
||||||
end
|
end
|
||||||
|
|
|
@ -60,18 +60,20 @@ local function calcDamage(move, attacker, defender, rng)
|
||||||
if move.fixed then
|
if move.fixed then
|
||||||
return move.fixed, move.fixed
|
return move.fixed, move.fixed
|
||||||
end
|
end
|
||||||
--[[if move.power == 0 or isDisabled(move.id) then
|
--if move.power == 0 or isDisabled(move.id) then
|
||||||
|
if move.power == 0 then
|
||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
end
|
||||||
if move.power > 9000 then
|
if move.power > 9000 then
|
||||||
if Memory.value("battle", "x_accuracy") == 1 and defender.speed < attacker.speed then
|
--if Memory.value("battle", "x_accuracy") == 1 and defender.speed < attacker.speed then
|
||||||
return 9001, 9001
|
-- return 9001, 9001
|
||||||
|
--end
|
||||||
|
--return 0, 0
|
||||||
|
return 9001, 9001 --should not be here
|
||||||
end
|
end
|
||||||
return 0, 0
|
--if move.name == "Thrash" and Combat.disableThrash then
|
||||||
end
|
-- return 0, 0
|
||||||
if move.name == "Thrash" and Combat.disableThrash then
|
--end
|
||||||
return 0, 0
|
|
||||||
end]]
|
|
||||||
|
|
||||||
local attFactor, defFactor
|
local attFactor, defFactor
|
||||||
if move.special then
|
if move.special then
|
||||||
|
@ -135,16 +137,16 @@ local function getMoves(who)--Get the moveset of us [0] or them [1]
|
||||||
local moves = {}
|
local moves = {}
|
||||||
local base
|
local base
|
||||||
if who == 1 then
|
if who == 1 then
|
||||||
base = Memory.value("battle", "opponent_move_id")
|
base = 0x1208
|
||||||
else
|
else
|
||||||
base = Memory.value("battle", "our_move_id")
|
base = 0x062E
|
||||||
end
|
end
|
||||||
for idx=0,3 do
|
for idx=0,3 do
|
||||||
local val = Memory.raw(base + idx)
|
local val = Memory.raw(base + idx)
|
||||||
if val > 0 then
|
if val > 0 then
|
||||||
local moveTable = Movelist.get(val)
|
local moveTable = Movelist.get(val)
|
||||||
if who == 0 then
|
if who == 0 then
|
||||||
moveTable.pp = Memory.value("battle", "our_move_pp")
|
moveTable.pp = Memory.raw(0x0634 + idx)
|
||||||
end
|
end
|
||||||
moves[idx + 1] = moveTable
|
moves[idx + 1] = moveTable
|
||||||
end
|
end
|
||||||
|
@ -256,9 +258,9 @@ local function activePokemon(preset)
|
||||||
hp = Memory.double("battle", "our_hp"),
|
hp = Memory.double("battle", "our_hp"),
|
||||||
att = Memory.double("battle", "our_attack"),
|
att = Memory.double("battle", "our_attack"),
|
||||||
def = Memory.double("battle", "our_defense"),
|
def = Memory.double("battle", "our_defense"),
|
||||||
|
speed = Memory.double("battle", "our_speed"),
|
||||||
spec_att = Memory.double("battle", "our_special_attack"),
|
spec_att = Memory.double("battle", "our_special_attack"),
|
||||||
spec_def = Memory.double("battle", "our_special_defense"),
|
spec_def = Memory.double("battle", "our_special_defense"),
|
||||||
speed = Memory.double("battle", "our_speed"),
|
|
||||||
type1 = getOurType(0),
|
type1 = getOurType(0),
|
||||||
type2 = getOurType(1),
|
type2 = getOurType(1),
|
||||||
moves = getMoves(0),
|
moves = getMoves(0),
|
||||||
|
@ -284,9 +286,9 @@ local function activePokemon(preset)
|
||||||
hp = Memory.double("battle", "opponent_hp"),
|
hp = Memory.double("battle", "opponent_hp"),
|
||||||
att = Memory.double("battle", "opponent_attack"),
|
att = Memory.double("battle", "opponent_attack"),
|
||||||
def = Memory.double("battle", "opponent_defense"),
|
def = Memory.double("battle", "opponent_defense"),
|
||||||
|
speed = Memory.double("battle", "opponent_speed"),
|
||||||
spec_att = Memory.double("battle", "our_special_attack"),
|
spec_att = Memory.double("battle", "our_special_attack"),
|
||||||
spec_def = Memory.double("battle", "our_special_defense"),
|
spec_def = Memory.double("battle", "our_special_defense"),
|
||||||
speed = Memory.double("battle", "opponent_speed"),
|
|
||||||
type1 = getOpponentType(0),
|
type1 = getOpponentType(0),
|
||||||
type2 = getOpponentType(1),
|
type2 = getOpponentType(1),
|
||||||
moves = getMoves(1),
|
moves = getMoves(1),
|
||||||
|
@ -297,8 +299,11 @@ end
|
||||||
Combat.activePokemon = activePokemon
|
Combat.activePokemon = activePokemon
|
||||||
|
|
||||||
local function isSleeping()
|
local function isSleeping()
|
||||||
--return Memory.raw(0x116F) > 1
|
if Memory.value("battle", "our_status") >= 1 and Memory.value("battle", "our_status") <= 7 then
|
||||||
return Memory.value("battle", "our_status") == 14 --######################
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Combat.isSleeping = isSleeping
|
Combat.isSleeping = isSleeping
|
||||||
|
|
||||||
|
@ -356,9 +361,9 @@ function Combat.inKillRange(draw)
|
||||||
end
|
end
|
||||||
if ours.hp <= hpReq then
|
if ours.hp <= hpReq then
|
||||||
local outsped = enemyAttack.outspeed
|
local outsped = enemyAttack.outspeed
|
||||||
if outsped and outsped ~= true then
|
--if outsped and outsped ~= true then
|
||||||
outsped = Memory.value("battle", "attack_turns") > 0
|
-- outsped = Memory.value("battle", "attack_turns") > 0
|
||||||
end
|
--end
|
||||||
if outsped or isConfused or turnsToKill > 1 or ours.speed <= enemy.speed or isSleeping() then
|
if outsped or isConfused or turnsToKill > 1 or ours.speed <= enemy.speed or isSleeping() then
|
||||||
return ours, hpReq
|
return ours, hpReq
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,6 +59,12 @@ local controlFunctions = {
|
||||||
|
|
||||||
-- EXP
|
-- EXP
|
||||||
|
|
||||||
|
falknerExp = function()
|
||||||
|
minExp = 292
|
||||||
|
shouldFight = {{name="sentret"}, {name="poliwag"}, {name="bellsprout"}, {name="hoothoot"}}
|
||||||
|
--add spinarak
|
||||||
|
end,
|
||||||
|
|
||||||
--[[viridianExp = function()
|
--[[viridianExp = function()
|
||||||
minExp = 210
|
minExp = 210
|
||||||
shouldFight = {{name="rattata",lvl={2,3}}, {name="pidgey",lvl={2}}}
|
shouldFight = {{name="rattata",lvl={2,3}}, {name="pidgey",lvl={2}}}
|
||||||
|
@ -72,11 +78,30 @@ local controlFunctions = {
|
||||||
nidoranBackupExp = function()
|
nidoranBackupExp = function()
|
||||||
minExp = 210
|
minExp = 210
|
||||||
shouldFight = {{name="rattata"}, {name="pidgey"}, {name="nidoran"}, {name="nidoranf",lvl={2}}}
|
shouldFight = {{name="rattata"}, {name="pidgey"}, {name="nidoran"}, {name="nidoranf",lvl={2}}}
|
||||||
end,
|
end,]]
|
||||||
|
|
||||||
-- CATCH
|
-- CATCH
|
||||||
|
|
||||||
catchNidoran = function()
|
catchSentret = function()
|
||||||
|
print("We'll try to find a cutter !")
|
||||||
|
shouldCatch = {{name="sentret", hp=10}}
|
||||||
|
end,
|
||||||
|
|
||||||
|
catchPoliwag = function()
|
||||||
|
shouldCatch = {{name="sentret", hp=10}, {name="poliwag", hp=12}}
|
||||||
|
end,
|
||||||
|
|
||||||
|
catchBellsprout = function()
|
||||||
|
if Pokemon.inParty("sentret") then
|
||||||
|
print("We found a cutter - Sentret !")
|
||||||
|
shouldCatch = {{name="poliwag", hp=12}}
|
||||||
|
else
|
||||||
|
print("We didn't found a cutter so we'll try to find Bellsprout !")
|
||||||
|
shouldCatch = {{name="bellsprout", hp=12}, {name="poliwag", hp=12}}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
--[[catchNidoran = function()
|
||||||
shouldCatch = {{name="nidoran",lvl={3,4}}, {name="spearow"}}
|
shouldCatch = {{name="nidoran",lvl={3,4}}, {name="spearow"}}
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -132,8 +157,7 @@ function Control.canCatch(partySize)
|
||||||
partySize = Memory.value("player", "party_size")
|
partySize = Memory.value("player", "party_size")
|
||||||
end
|
end
|
||||||
local pokeballs = Inventory.count("pokeball")
|
local pokeballs = Inventory.count("pokeball")
|
||||||
--local minimumCount = 4 - partySize
|
local minimumCount = 3 - partySize
|
||||||
local minimumCount = 1
|
|
||||||
if pokeballs < minimumCount then
|
if pokeballs < minimumCount then
|
||||||
Strategies.reset("Not enough PokeBalls", pokeballs)
|
Strategies.reset("Not enough PokeBalls", pokeballs)
|
||||||
return false
|
return false
|
||||||
|
@ -173,7 +197,8 @@ function Control.shouldCatch(partySize)
|
||||||
if penultimate then
|
if penultimate then
|
||||||
require("action.battle").fight(penultimate.midx)
|
require("action.battle").fight(penultimate.midx)
|
||||||
else
|
else
|
||||||
Inventory.use("pokeball", nil, true)
|
Inventory.use("pokeball", nil, 1)
|
||||||
|
--Inventory.use("pokeball", nil, true, 1)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,11 +29,11 @@ local strategyFunctions = Strategies.functions
|
||||||
|
|
||||||
Strategies.timeRequirements = {
|
Strategies.timeRequirements = {
|
||||||
|
|
||||||
--[[charmander = function()
|
rival = function()
|
||||||
return 2.39
|
return 6.15
|
||||||
end,
|
end,
|
||||||
|
|
||||||
pidgey = function()
|
--[[pidgey = function()
|
||||||
local timeLimit = 7.55
|
local timeLimit = 7.55
|
||||||
return timeLimit
|
return timeLimit
|
||||||
end,
|
end,
|
||||||
|
@ -135,8 +135,7 @@ strategyFunctions.talk_mom = function()
|
||||||
Input.press("A", 2)
|
Input.press("A", 2)
|
||||||
elseif CurrentMenu == 32 and status.tempDir then
|
elseif CurrentMenu == 32 and status.tempDir then
|
||||||
return true
|
return true
|
||||||
--elseif CurrentMenu == 79 then --french
|
elseif CurrentMenu == 110 then
|
||||||
elseif CurrentMenu == 110 then --english
|
|
||||||
local OptionMenu = Memory.value("menu", "option_current")
|
local OptionMenu = Memory.value("menu", "option_current")
|
||||||
local DaysRow = Memory.value("menu", "days_row")
|
local DaysRow = Memory.value("menu", "days_row")
|
||||||
if OptionMenu == 0 or OptionMenu == 11 then
|
if OptionMenu == 0 or OptionMenu == 11 then
|
||||||
|
@ -156,58 +155,213 @@ strategyFunctions.talk_mom = function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--strategyFunctions.bulbasaurIChooseYou = function()
|
|
||||||
strategyFunctions.totodileIChooseYou = function()
|
strategyFunctions.totodileIChooseYou = function()
|
||||||
if Strategies.initialize() then
|
if Strategies.initialize() then
|
||||||
status.tempDir = false
|
status.tempDir = false
|
||||||
end
|
end
|
||||||
--if Pokemon.inParty("bulbasaur") then
|
if Pokemon.inParty("totodile") then
|
||||||
--if Pokemon.inParty("totodile") then
|
Bridge.caught("totodile")
|
||||||
--Bridge.caught("bulbasaur")
|
--check spec
|
||||||
-- Bridge.caught("totodile")
|
local totodileAtt = Pokemon.index(0, "attack")
|
||||||
-- return true
|
if totodileAtt < 12 then
|
||||||
--end
|
return Strategies.reset("Bad Totodile Attack : "..totodileAtt.." | Need : 12+")
|
||||||
if Player.face("Up") then
|
end
|
||||||
--if Textbox.isActive() then
|
end
|
||||||
if Textbox.name(TOTODILE_NAME) then
|
if Player.face("Up") then
|
||||||
-- status.tempDir = true
|
if Textbox.name(TOTODILE_NAME) then
|
||||||
--else
|
return true
|
||||||
-- if status.tempDir then
|
|
||||||
-- status.tempDir = false
|
|
||||||
return true
|
|
||||||
-- else
|
|
||||||
-- Input.press("A", 2)
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
--Textbox.name(BULBASAUR_NAME)
|
|
||||||
--Textbox.name(TOTODILE_NAME)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[strategyFunctions.fightCharmander = function()
|
strategyFunctions.totodileCheckSpec = function()
|
||||||
|
local totodileAtt = Pokemon.index(0, "attack")
|
||||||
|
local totodileDef = Pokemon.index(0, "defense")
|
||||||
|
local totodileSpeed = Pokemon.index(0, "speed")
|
||||||
|
local totodileScl_Def = Pokemon.index(0, "special_defense")
|
||||||
|
if totodileSpeed < 9 then
|
||||||
|
return Strategies.reset("Bad Totodile Speed : "..totodileSpeed.." | Need : 9+")
|
||||||
|
end
|
||||||
|
if totodileScl_Def < 11 then
|
||||||
|
return Strategies.reset("Bad Totodile Special_Defense : "..totodileScl_Def.." | Need : 11+")
|
||||||
|
end
|
||||||
|
if totodileSpeed == 9 then
|
||||||
|
if totodileAtt == 12 then
|
||||||
|
return Strategies.reset("Bad Totodile Attack : "..totodileAtt.." | Need : 13+")
|
||||||
|
else
|
||||||
|
if totodileDef < 12 then
|
||||||
|
return Strategies.reset("Bad Totodile Defense : "..totodileDef.." | Need : 12+")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
print("Totodile Speed are bit low (9spd) but we'll check stats again at level 6")
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
strategyFunctions.fightRival = function()
|
||||||
if status.tries < 9000 and Pokemon.index(0, "level") == 6 then
|
if status.tries < 9000 and Pokemon.index(0, "level") == 6 then
|
||||||
if status.tries > 200 then
|
if status.tries > 200 then
|
||||||
bulbasaurScl = Pokemon.index(0, "special")
|
--check spec
|
||||||
if bulbasaurScl < 12 then
|
local totodileAtt = Pokemon.index(0, "attack")
|
||||||
if UsingSTRATS == "Pidgey" then
|
local totodileSpeed = Pokemon.index(0, "speed")
|
||||||
return Strategies.reset("Bad Bulbasaur for pidgey strats - "..bulbasaurScl.." special")
|
local totodileScl_Att = Pokemon.index(0, "special_attack")
|
||||||
|
local totodileScl_Def = Pokemon.index(0, "special_defense")
|
||||||
|
--check attack
|
||||||
|
if totodileAtt < 14 then
|
||||||
|
if totodileScl_Att < 12 or totodileScl_Def < 12 then
|
||||||
|
return Strategies.reset("Bad Totodile Attack : "..totodileAtt.." | Need : 14+")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if totodileSpeed < 11 then
|
||||||
|
return Strategies.reset("Bad Totodile Speed : "..totodileSpeed.." | Need : 11+")
|
||||||
|
end
|
||||||
|
if totodileScl_Att < 12 then
|
||||||
|
return Strategies.reset("Bad Totodile Special_Attack : "..totodileScl_Att.." | Need : 12+")
|
||||||
|
end
|
||||||
|
--check special def
|
||||||
|
if totodileAtt < 14 then
|
||||||
|
if totodileScl_Def < 12 then
|
||||||
|
return Strategies.reset("Bad Totodile Special_Defense : "..totodileScl_Def.." | Need : 12+")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
UsingSTRATS = "PP"
|
if totodileScl_Def < 11 then
|
||||||
|
return Strategies.reset("Bad Totodile Special_Defense : "..totodileScl_Def.." | Need : 11+")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--continue everything fine
|
||||||
status.tries = 9001
|
status.tries = 9001
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
status.tries = status.tries + 1
|
status.tries = status.tries + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Battle.isActive() and Memory.double("battle", "opponent_hp") > 0 and Strategies.resetTime(Strategies.getTimeRequirement("charmander"), "kill Charmander") then
|
if Battle.isActive() and Memory.double("battle", "opponent_hp") > 0 and Strategies.resetTime(Strategies.getTimeRequirement("rival"), "kill Rival") then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
Battle.automate()
|
if Battle.inside_menu(true) then
|
||||||
|
--Battle.automate()
|
||||||
|
return Strategies.buffTo("leer", nil, 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
strategyFunctions.dodgePalletBoy = function()
|
strategyFunctions.chooseRivalName = function()
|
||||||
|
if Player.face("Right") then
|
||||||
|
if Textbox.name(RIVAL_NAME) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
strategyFunctions.howToCatch = function()
|
||||||
|
if Strategies.initialize() then
|
||||||
|
status.tempDir = false
|
||||||
|
end
|
||||||
|
local OptionMenu = Memory.value("menu", "option_current")
|
||||||
|
if OptionMenu ~= 11 and not status.tempDir then
|
||||||
|
Input.press("A", 2)
|
||||||
|
elseif OptionMenu ~= 11 and status.tempDir then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
Input.press("B", 2)
|
||||||
|
status.tempDir = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
strategyFunctions.CheckTotoHealth = function()
|
||||||
|
if Strategies.initialize() then
|
||||||
|
status.tempDir = false
|
||||||
|
status.canProgress = false
|
||||||
|
end
|
||||||
|
--check for rage
|
||||||
|
if not Pokemon.index(Pokemon.indexOf("totodile"), "move3") == 99 then
|
||||||
|
return Strategies.reset("Totodile didn't learned Rage at time")
|
||||||
|
end
|
||||||
|
local TotodileHP = Pokemon.index(0, "hp")
|
||||||
|
local TotodileDef = Pokemon.index(0, "defense")
|
||||||
|
local ShouldRecover = false
|
||||||
|
--check if totodile need recovering
|
||||||
|
if TotodileDef <= 14 then
|
||||||
|
if TotodileHP < 33 then
|
||||||
|
ShouldRecover = true
|
||||||
|
end
|
||||||
|
elseif TotodileDef > 14 then
|
||||||
|
if TotodileHP < 25 then
|
||||||
|
ShouldRecover = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--recover if needed
|
||||||
|
if ShouldRecover then
|
||||||
|
local px, py = Player.position()
|
||||||
|
local map = Memory.value("game", "map")
|
||||||
|
if map == 5 then
|
||||||
|
if not status.tempDir then
|
||||||
|
if py > 25 then
|
||||||
|
py = 25
|
||||||
|
end
|
||||||
|
else
|
||||||
|
status.canProgress = false
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
elseif map == 10 then
|
||||||
|
if not status.tempDir then
|
||||||
|
if py > 3 then
|
||||||
|
py = 3
|
||||||
|
elseif py == 3 then
|
||||||
|
if Textbox.isActive() then
|
||||||
|
Input.press("A", 2)
|
||||||
|
status.canProgress = true
|
||||||
|
else
|
||||||
|
if status.canProgress then
|
||||||
|
status.tempDir = true
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if py < 8 then
|
||||||
|
py = 8
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Walk.step(px, py)
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
strategyFunctions.fightBirdKeeperAbe = function()
|
||||||
|
if Battle.inside_menu(true) then
|
||||||
|
return Strategies.buffTo("rage", nil, "infinite")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
strategyFunctions.fightBirdKeeperRod = function()
|
||||||
|
if Battle.inside_menu(true) then
|
||||||
|
return Strategies.buffTo("rage", nil, "infinite")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
strategyFunctions.CheckTotoHealthGym1 = function()
|
||||||
|
local TotodileHP = Pokemon.index(0, "hp")
|
||||||
|
if Strategies.useItem("bitter_berry", "totodile", false, "give") then
|
||||||
|
if TotodileHP < 17 then
|
||||||
|
if Strategies.useItem("potion", "totodile", true) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
strategyFunctions.fightFalkner = function()
|
||||||
|
if Battle.inside_menu(true) then
|
||||||
|
return Strategies.buffTo("rage", nil, "infinite")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[strategyFunctions.dodgePalletBoy = function()
|
||||||
return Strategies.dodgeUp(0x0223, 14, 14, 15, 7)
|
return Strategies.dodgeUp(0x0223, 14, 14, 15, 7)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -128,29 +128,38 @@ function Strategies.initialize()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[function Strategies.buffTo(buff, defLevel, usePPAmount, oneHit)
|
function Strategies.buffTo(buff, defLevel, usePPAmount, secondAttack)
|
||||||
if Battle.isActive() then
|
if Battle.isActive() then
|
||||||
status.canProgress = true
|
status.canProgress = true
|
||||||
local forced
|
local forced
|
||||||
|
--go by def level
|
||||||
if not usePPAmount then
|
if not usePPAmount then
|
||||||
if defLevel and Memory.double("battle", "opponent_defense") > defLevel then
|
if defLevel and Memory.double("battle", "opponent_defense") > defLevel then
|
||||||
forced = buff
|
forced = buff
|
||||||
end
|
end
|
||||||
|
--go by use PP amount
|
||||||
else
|
else
|
||||||
local AvailablePP = Battle.pp(buff)
|
local AvailablePP = Battle.pp(buff)
|
||||||
if not oneHit then
|
if usePPAmount ~= "infinite" then
|
||||||
if AvailablePP > usePPAmount then
|
if Strategies.initialize() then
|
||||||
|
status.tempDir = AvailablePP-usePPAmount
|
||||||
|
end
|
||||||
|
if AvailablePP > status.tempDir and AvailablePP > 0 then
|
||||||
forced = buff
|
forced = buff
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if Strategies.initialize() then
|
if AvailablePP > 0 then
|
||||||
status.tempDir = AvailablePP
|
|
||||||
end
|
|
||||||
if AvailablePP > status.tempDir-1 then
|
|
||||||
forced = buff
|
forced = buff
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--second attack
|
||||||
|
if forced ~= buff and secondAttack ~= nil then
|
||||||
|
local AvailablePP = Battle.pp(secondAttack)
|
||||||
|
if AvailablePP > 0 then
|
||||||
|
forced = secondAttack
|
||||||
|
end
|
||||||
|
end
|
||||||
Battle.automate(forced, true)
|
Battle.automate(forced, true)
|
||||||
elseif status.canProgress then
|
elseif status.canProgress then
|
||||||
return true
|
return true
|
||||||
|
@ -159,7 +168,103 @@ end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Strategies.dodgeUp(npc, sx, sy, dodge, offset)
|
function Strategies.useItem(item, pokemon, Close, Option)
|
||||||
|
if Strategies.initialize() then
|
||||||
|
status.tempDir = false
|
||||||
|
status.canProgress = false
|
||||||
|
end
|
||||||
|
--set options
|
||||||
|
if not Option then
|
||||||
|
Option = 1 --use
|
||||||
|
status.canProgress = true
|
||||||
|
elseif Option == "give" then
|
||||||
|
--check if the pokemon held a item before give it
|
||||||
|
if not status.canProgress then
|
||||||
|
if Pokemon.index(Pokemon.indexOf(pokemon), "held") ~= 0 then
|
||||||
|
return true
|
||||||
|
elseif Pokemon.index(Pokemon.indexOf(pokemon), "held") == 0 then
|
||||||
|
status.canProgress = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Option = 2
|
||||||
|
end
|
||||||
|
--select/give/use items
|
||||||
|
if status.canProgress then
|
||||||
|
local MainMenu = Memory.value("menu", "main")
|
||||||
|
local Row = Memory.value("menu", "row")
|
||||||
|
local ItemRow = Memory.value("menu", "input_row")
|
||||||
|
local Column = Memory.value("menu", "column")
|
||||||
|
local ShopCurrent = Memory.value("menu", "shop_current")
|
||||||
|
local MenuSize = Memory.value("menu", "size")
|
||||||
|
--open menu
|
||||||
|
if MainMenu ~= 50 and MainMenu ~= 121 and MainMenu ~= 127 and not status.tempDir then
|
||||||
|
Input.press("Start", 2)
|
||||||
|
--close menu
|
||||||
|
elseif MainMenu == 1 and status.tempDir then
|
||||||
|
return true
|
||||||
|
--item menu
|
||||||
|
elseif MainMenu == 50 then
|
||||||
|
--select bitter berry and go equip it to totodile
|
||||||
|
if not status.tempDir then
|
||||||
|
if Column ~= 0 then
|
||||||
|
Input.press("Right", 2)
|
||||||
|
else
|
||||||
|
--select item
|
||||||
|
if ShopCurrent ~= 66 then
|
||||||
|
local ItemIdx = Inventory.indexOf(item)
|
||||||
|
if ItemRow ~= ItemIdx+1 then
|
||||||
|
Input.press("Down", 2)
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
|
--option menu
|
||||||
|
else
|
||||||
|
--reset option with menu size
|
||||||
|
if MenuSize == 3 and Option == 2 then
|
||||||
|
Option = 1
|
||||||
|
end
|
||||||
|
--use/give/toss
|
||||||
|
if ItemRow ~= Option then
|
||||||
|
Input.press("Down", 2)
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--switch to next function
|
||||||
|
else
|
||||||
|
if not Close then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
Input.press("B", 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--pokemon menu
|
||||||
|
elseif MainMenu == 127 then
|
||||||
|
local PokemonIdx = Pokemon.indexOf(pokemon)
|
||||||
|
if ItemRow ~= PokemonIdx+1 then
|
||||||
|
Input.press("Down", 2)
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
status.tempDir = true
|
||||||
|
end
|
||||||
|
--start menu(open bag)
|
||||||
|
elseif MainMenu == 121 and not status.tempDir then
|
||||||
|
if Row < 3 then
|
||||||
|
Input.press("Down", 2)
|
||||||
|
elseif Row > 3 then
|
||||||
|
Input.press("Up", 2)
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
|
--start menu(close)
|
||||||
|
elseif MainMenu == 121 and status.tempDir then
|
||||||
|
Input.press("B", 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[function Strategies.dodgeUp(npc, sx, sy, dodge, offset)
|
||||||
if not Battle.handleWild() then
|
if not Battle.handleWild() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -245,6 +350,35 @@ Strategies.functions = {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
setDirection = function(data)
|
||||||
|
if Player.isFacing(data.dir) then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
Input.press(data.dir, 2)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
openTextbox = function()
|
||||||
|
if Textbox.isActive() then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
use = function(data)
|
||||||
|
local Option
|
||||||
|
if not data.option then
|
||||||
|
Option = false
|
||||||
|
else
|
||||||
|
Option = data.option
|
||||||
|
end
|
||||||
|
if Strategies.useItem(data.item, data.poke, data.close, Option) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
confirm = function(data)
|
confirm = function(data)
|
||||||
if Battle.handleWild() then
|
if Battle.handleWild() then
|
||||||
if Textbox.isActive() then
|
if Textbox.isActive() then
|
||||||
|
|
|
@ -6,18 +6,75 @@ local paths = {
|
||||||
-- Go to lab
|
-- Go to lab
|
||||||
{4, 24, {13,6}, {6,6}, {6,3}},
|
{4, 24, {13,6}, {6,6}, {6,3}},
|
||||||
-- Choose your character!
|
-- Choose your character!
|
||||||
{5, 24, {4,4}, {c="a",a="Prof Orm Lab"}, {s="speak"}, {s="speak"}, {s="speak"}, {s="speak"}, {4,4}, {7,4}, {s="totodileIChooseYou"}, {5,3}, {5,8}, {s="speak"}, {5,12}},
|
{5, 24, {4,4}, {c="a",a="Elm. lab"}, {4,4}, {7,4}, {s="totodileIChooseYou"}, {5,3}, {s="totodileCheckSpec"}, {5,12}},
|
||||||
|
|
||||||
-- 1: GO TAKE THE EGG
|
-- 1: GO TALK IN WILD LAB
|
||||||
|
|
||||||
-- Go to route 29
|
-- Go to route 29
|
||||||
{4, 24, {6,4}, {6,7}, {2,7}, {2,9}, {-1,9}},
|
{4, 24, {6,4}, {6,7}, {2,7}, {2,9}, {-1,9}},
|
||||||
-- Route 29
|
-- Route 29
|
||||||
{3, 24, {59,9}, {44,9}, {44,15}, {39,15}, {39,16}, {31,16}, {31,10} , {36,10}, {36,7}, {23,7}, {23,5}, {21,5}, {21,3}, {16,3}, {16,7}, {14,7}, {14,8}, {4,8}, {4,7}, {-1,7}},
|
{3, 24, {c="a",a="Route29"}, {59,9}, {44,9}, {44,15}, {39,15}, {39,16}, {31,16}, {31,10} , {36,10}, {36,7}, {23,7}, {23,5}, {21,5}, {21,3}, {16,3}, {16,7}, {14,7}, {14,8}, {4,8}, {4,7}, {-1,7}},
|
||||||
-- CherryGrove City
|
-- CherryGrove City
|
||||||
{3, 26, {39,7}, {28,7}, {28,5}, {17,5}, {17,-1}},
|
{3, 26, {39,7}, {28,7}, {28,5}, {17,5}, {17,-1}},
|
||||||
-- Route 30
|
-- Route 30
|
||||||
{1, 26, {7,53}, {7,48}, {12,48}, {12,35}, {9,35}, {s="interact",dir="Left"}, {9,35}, {9,31}},
|
{1, 26, {c="a",a="Route30"}, {7,53}, {7,48}, {12,48}, {12,35}, {9,35}, {s="speak"}, {9,35}, {9,31}, {14,31}, {14,23}, {11,23}, {11,17}, {12,17}, {12,9}, {13,9}, {s="speak"}, {17,9}, {17,5}},
|
||||||
|
-- Inside wild lab house
|
||||||
|
{10, 26, {3,6}, {3,8}},
|
||||||
|
|
||||||
|
-- 2: GO BACK TO PROF ELM. LAB
|
||||||
|
|
||||||
|
-- Route 30
|
||||||
|
{1, 26, {17,6}, {17,11}, {12,11}, {12,17}, {11,17}, {11,23}, {14,23}, {14,31}, {3,31}, {3,39}, {4,39}, {s="speak"}, {4,41}, {7,41}, {7,54}},
|
||||||
|
-- CherryGrove City
|
||||||
|
{3, 26, {c="a",a="Rival Battle"}, {17,0}, {17,5}, {28,5}, {28,7}, {33,7}, {s="fightRival"}, {33,8}, {33,7}, {40,7}},
|
||||||
|
-- Route 29
|
||||||
|
{3, 24, {c="a",a="Route29"}, {0,7}, {7,7}, {7,10}, {16,10}, {16,14}, {31,14}, {31,11}, {39,11}, {39,12}, {42,12}, {42,9}, {60,9}},
|
||||||
|
-- Go to elm. lab
|
||||||
|
{4, 24, {0,9}, {5,9}, {5,5}, {6,5}, {6,3}},
|
||||||
|
-- Talk to Elm.
|
||||||
|
{4, 24, {4,11}, {4,3}, {s="chooseRivalName"}, {5,3}, {s="interact",dir="Up"}, {5,12}},
|
||||||
|
|
||||||
|
-- 3: GO TO VIOLET CITY
|
||||||
|
|
||||||
|
-- Go to route 29
|
||||||
|
{4, 24, {6,4}, {6,7}, {2,7}, {2,9}, {-1,9}},
|
||||||
|
-- Route 29
|
||||||
|
{3, 24, {59,9}, {53,9}, {s="howToCatch"}, {44,9}, {c="catchSentret"}, {44,15}, {39,15}, {39,16}, {31,16}, {31,10} , {36,10}, {36,7}, {23,7}, {23,5}, {21,5}, {21,3}, {16,3}, {16,7}, {14,7}, {14,8}, {4,8}, {4,7}, {-1,7}},
|
||||||
|
-- CherryGrove City
|
||||||
|
{3, 26, {39,7}, {28,7}, {28,5}, {17,5}, {17,-1}},
|
||||||
|
-- Route 30
|
||||||
|
{1, 26, {c="a",a="Route30"}, {c="falknerExp"}, {c="catchPoliwag"}, {7,53}, {7,48}, {12,48}, {12,31}, {9,31}, {9,29}, {6,29}, {6,27}, {5,27}, {5,24}, {4,24}, {4,18}, {3,18}, {3,16}, {4,16}, {4,12}, {0,12}, {0,6}, {6,6}, {6,-1}},
|
||||||
|
-- Route 31
|
||||||
|
{2, 26, {c="a",a="Route31"}, {26,17}, {26,14}, {c="catchBellsprout"}, {32,14}, {32,9}, {29,9}, {29,6}, {s="speak"}, {29,8}, {18,8}, {18,6}, {16,6}, {s="interact",dir="Down"}, {15,6}, {15,9}, {16,9}, {16,12}, {9,12}, {9,7}, {3,7}},
|
||||||
|
-- Inside guard area
|
||||||
|
{11, 26, {9,5}, {-1,5}},
|
||||||
|
|
||||||
|
-- 4: GET BADGE 1
|
||||||
|
|
||||||
|
-- Violet City
|
||||||
|
{5, 10, {c="a",a="Violet City"}, {39,25}, {36,25}, {36,26}, {31,26}, {s="CheckTotoHealth"}, {31,26}, {27,26}, {27,19}, {18,19}, {18,17}},
|
||||||
|
-- Inside Gym
|
||||||
|
{7, 10, {c="a",a="Falkner Gym"}, {4,15}, {s="use", poke="totodile", item="berry", close=true, option="give"}, {4,10}, {s="fightBirdKeeperAbe"}, {6,10}, {6,8}, {3,8}, {3,6}, {s="use", poke="totodile", item="potion", close=false}, {s="use", poke="totodile", item="bitter_berry", close=true, option="give"}, {4,6}, {s="fightBirdKeeperRod"}, {4,1}, {s="CheckTotoHealthGym1"}, {s="setDirection",dir="Right"}, {s="openTextbox"}, {s="fightFalkner"}, {4,6}, {3,6}, {3,8}, {6,8}, {6,10}, {5,10}, {5,16}},
|
||||||
|
|
||||||
|
-- 5: GO TO ##### CITY
|
||||||
|
|
||||||
|
--outside Falkner gym
|
||||||
|
{5, 10, {c="a",a="Violet City"}, {18,18}, {18,19}, {27,19}, {27,26}, {31,26}, {31,25}},
|
||||||
|
--inside poke-center
|
||||||
|
{10, 10, {3,7}, {3,3}, {s="speak"}, {s="setDirection",dir="Right"}, {s="speak"}, {3,8}},
|
||||||
|
-- Violet City again after recovering
|
||||||
|
{5, 10, {31,26}, {27,26}, {27,21}, {13,21}, {13,29}, {s="interact",dir="Right"}, {13,30}, {14,30}},
|
||||||
|
-- Route 32
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
--{, , {,}, {,}, {,}, {,}, {,}, {,}, {,}},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
main.lua
8
main.lua
|
@ -12,8 +12,8 @@ RESET_FOR_ENCOUNTERS = false -- Set to false if you just want to see the bot fi
|
||||||
GAME_NAME = "Crystal" -- Set to Gold/Silver(not done) or Crystal
|
GAME_NAME = "Crystal" -- Set to Gold/Silver(not done) or Crystal
|
||||||
GAME_RUN = "" -- Set to "" or "" for the run you want
|
GAME_RUN = "" -- Set to "" or "" for the run you want
|
||||||
GAME_HOURS = 17 -- Set the internal game hour (0-23h)
|
GAME_HOURS = 17 -- Set the internal game hour (0-23h)
|
||||||
GAME_MINUTES = 35 -- Set the internal game minutes (0-59min)
|
GAME_MINUTES = 50 -- Set the internal game minutes (0-59min)
|
||||||
GAME_DAY = 3 -- Set the internal game day (0-6 // sunday-saturday)
|
GAME_DAY = 0 -- Set the internal game day (0-6 // sunday-saturday)
|
||||||
GAME_GENDER = 1 -- Set the player gender (1-2 // boy-girl)
|
GAME_GENDER = 1 -- Set the player gender (1-2 // boy-girl)
|
||||||
|
|
||||||
GAME_TEXT_SPEED = 128 -- Set the Text Speed (247-249 // slow-fast)
|
GAME_TEXT_SPEED = 128 -- Set the Text Speed (247-249 // slow-fast)
|
||||||
|
@ -33,7 +33,7 @@ CUSTOM_SEED = nil -- Set to a known seed to replay it, or leave nil for rand
|
||||||
PAINT_ON = true -- Display contextual information while the bot runs
|
PAINT_ON = true -- Display contextual information while the bot runs
|
||||||
|
|
||||||
--Names Settings
|
--Names Settings
|
||||||
PLAYER_NAME = "TeSt" -- Player name
|
PLAYER_NAME = "TeSt-<" -- Player name
|
||||||
RIVAL_NAME = "URRival" -- Rival name
|
RIVAL_NAME = "URRival" -- Rival name
|
||||||
TOTODILE_NAME = "ToTo" -- Set Totodile name
|
TOTODILE_NAME = "ToTo" -- Set Totodile name
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ PRINT_STEP = false -- Print the current step in the console.
|
||||||
|
|
||||||
-- SET VALUES
|
-- SET VALUES
|
||||||
|
|
||||||
local VERSION = "0.2-BETA"
|
local VERSION = "0.21-BETA"
|
||||||
|
|
||||||
local START_WAIT = 99
|
local START_WAIT = 99
|
||||||
local hasAlreadyStartedPlaying = false
|
local hasAlreadyStartedPlaying = false
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
ItemList = {}
|
BagList = {}
|
||||||
|
|
||||||
ItemList.items = {
|
local ItemsTable = {
|
||||||
masterball = 1,
|
|
||||||
ultraball = 2,
|
|
||||||
bright_powder = 3,
|
bright_powder = 3,
|
||||||
greatball = 4,
|
|
||||||
pokeball = 5,
|
|
||||||
--teru_sama = 6,
|
--teru_sama = 6,
|
||||||
bicycle = 7,
|
|
||||||
moon_stone = 8,
|
moon_stone = 8,
|
||||||
antidote = 9,
|
antidote = 9,
|
||||||
burn_heal = 10,
|
burn_heal = 10,
|
||||||
|
@ -29,14 +24,16 @@ ItemList.items = {
|
||||||
super_repel = 42,
|
super_repel = 42,
|
||||||
--fresh_water = 60,
|
--fresh_water = 60,
|
||||||
--soda_pop = 61,
|
--soda_pop = 61,
|
||||||
coin_case = 54,
|
|
||||||
--pokeflute = 73,
|
--pokeflute = 73,
|
||||||
--ether = 80,
|
--ether = 80,
|
||||||
--max_ether = 81,
|
--max_ether = 81,
|
||||||
--elixer = 82,
|
--elixer = 82,
|
||||||
|
bitter_berry = 83,
|
||||||
--x_accuracy = 46,
|
--x_accuracy = 46,
|
||||||
--x_speed = 67,
|
--x_speed = 67,
|
||||||
--x_special = 68,
|
--x_special = 68,
|
||||||
|
berry = 173,
|
||||||
|
gold_berry = 174,
|
||||||
--horn_drill = 207,
|
--horn_drill = 207,
|
||||||
--bubblebeam = 211,
|
--bubblebeam = 211,
|
||||||
--water_gun = 212,
|
--water_gun = 212,
|
||||||
|
@ -48,7 +45,7 @@ ItemList.items = {
|
||||||
--rock_slide = 248,
|
--rock_slide = 248,
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemList.moves = {
|
local MovesTable = {
|
||||||
cut = 15,
|
cut = 15,
|
||||||
fly = 19,
|
fly = 19,
|
||||||
surf = 57,
|
surf = 57,
|
||||||
|
@ -58,5 +55,58 @@ ItemList.moves = {
|
||||||
whirlpool = 250,
|
whirlpool = 250,
|
||||||
}
|
}
|
||||||
|
|
||||||
--return ItemList
|
local BallsTable = {
|
||||||
|
masterball = 1,
|
||||||
|
ultraball = 2,
|
||||||
|
greatball = 4,
|
||||||
|
pokeball = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
local KeysTable = {
|
||||||
|
bicycle = 7,
|
||||||
|
coin_case = 54,
|
||||||
|
squirtbottle = 175,
|
||||||
|
}
|
||||||
|
|
||||||
|
--Get item
|
||||||
|
local function items(Name)
|
||||||
|
if ItemsTable[Name] then
|
||||||
|
return ItemsTable[Name]
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
BagList.items = items
|
||||||
|
|
||||||
|
--Get move
|
||||||
|
local function moves(Name)
|
||||||
|
if MovesTable[Name] then
|
||||||
|
return MovesTable[Name]
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
BagList.moves = moves
|
||||||
|
|
||||||
|
--Get balls
|
||||||
|
local function balls(Name)
|
||||||
|
if BallsTable[Name] then
|
||||||
|
return BallsTable[Name]
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
BagList.balls = balls
|
||||||
|
|
||||||
|
--Get key items
|
||||||
|
local function keys(Name)
|
||||||
|
if KeysTable[Name] then
|
||||||
|
return KeysTable[Name]
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
BagList.keys = keys
|
||||||
|
|
||||||
|
return BagList
|
||||||
|
|
|
@ -7,19 +7,30 @@ local Utils = require "util.utils"
|
||||||
|
|
||||||
local Pokemon = require "storage.pokemon"
|
local Pokemon = require "storage.pokemon"
|
||||||
|
|
||||||
local ItemList = require "storage.itemlist"
|
local BagList = require "storage.baglist"
|
||||||
|
|
||||||
local ITEM_BASE = Memory.value("inventory", "item_base")
|
local ITEM_BASE = 0x1893
|
||||||
|
local BALL_BASE = 0x18D8
|
||||||
|
local KEY_BASE = 0x18BD
|
||||||
|
|
||||||
-- Data
|
-- Data
|
||||||
|
|
||||||
function Inventory.indexOf(name)
|
function Inventory.indexOf(name)
|
||||||
--local searchID = items[name]
|
--local searchID = items[name]
|
||||||
local searchID = ItemList.items[name]
|
local searchID
|
||||||
|
local SEARCH_BASE
|
||||||
|
if BagList.items(name) then
|
||||||
|
SEARCH_BASE = ITEM_BASE
|
||||||
|
searchID = BagList.items(name)
|
||||||
|
elseif BagList.balls(name) then
|
||||||
|
SEARCH_BASE = BALL_BASE
|
||||||
|
searchID = BagList.balls(name)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
end
|
||||||
for i=0,19 do
|
for i=0,19 do
|
||||||
--local iidx = ITEM_BASE + i * 2
|
local iidx = SEARCH_BASE + i * 2
|
||||||
local SubIndex = i * 2
|
local read = Memory.raw(iidx)
|
||||||
local iidx = ITEM_BASE + SubIndex
|
|
||||||
if Memory.raw(iidx) == searchID then
|
if Memory.raw(iidx) == searchID then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
|
@ -28,10 +39,18 @@ function Inventory.indexOf(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Inventory.count(name)
|
function Inventory.count(name)
|
||||||
|
--get menu
|
||||||
|
local SEARCH_BASE
|
||||||
|
if BagList.items(name) then
|
||||||
|
SEARCH_BASE = ITEM_BASE
|
||||||
|
elseif BagList.balls(name) then
|
||||||
|
SEARCH_BASE = BALL_BASE
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
local index = Inventory.indexOf(name)
|
local index = Inventory.indexOf(name)
|
||||||
if index ~= -1 then
|
if index ~= -1 then
|
||||||
local SubIndex = index * 2
|
return Memory.raw(SEARCH_BASE + index + 1)
|
||||||
return Memory.raw(ITEM_BASE + SubIndex + 1)
|
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -89,101 +108,80 @@ function Inventory.isFull()
|
||||||
return Memory.value("inventory", "item_count") == 20
|
return Memory.value("inventory", "item_count") == 20
|
||||||
end
|
end
|
||||||
|
|
||||||
function Inventory.use(item, poke, midfight, BagMenu)
|
function Inventory.use(item, poke, BagMenu)
|
||||||
if midfight then
|
if not BagMenu then
|
||||||
|
BagMenu = 0
|
||||||
|
end
|
||||||
|
local column = Memory.value("menu", "column")
|
||||||
local battleMenu = Memory.value("battle", "menu")
|
local battleMenu = Memory.value("battle", "menu")
|
||||||
|
local battleText = Memory.value("battle", "text")
|
||||||
|
local itemRow = Memory.value("menu", "input_row")
|
||||||
|
local OptionMenu = Memory.value("menu", "option_current")
|
||||||
--open bag menu
|
--open bag menu
|
||||||
|
if battleText == 1 then
|
||||||
if battleMenu == 186 then
|
if battleMenu == 186 then
|
||||||
local rowSelected = Memory.value("battle", "menuY")
|
local rowSelected = Memory.value("battle", "menuY")
|
||||||
local ColumnSelected = Memory.value("battle", "menuX")
|
local ColumnSelected = Memory.value("battle", "menuX")
|
||||||
if ColumnSelected == 1 then
|
if ColumnSelected == 1 then
|
||||||
if rowSelected == 1 then
|
if rowSelected == 1 then
|
||||||
Input.press("Down")
|
Input.press("Down", 2)
|
||||||
else
|
else
|
||||||
--select bag
|
--select bag
|
||||||
Input.press("A")
|
Input.press("A", 2)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Input.press("Left")
|
Input.press("Left", 2)
|
||||||
end
|
end
|
||||||
--inside bag menu
|
--inside bag menu
|
||||||
elseif battleMenu == 128 then
|
elseif battleMenu == 128 then
|
||||||
--if its not done
|
if OptionMenu ~= 17 then
|
||||||
if not give_done then
|
|
||||||
if column ~= BagMenu then
|
if column ~= BagMenu then
|
||||||
--select proper bag menu
|
--select proper bag menu
|
||||||
Menu.setCol(BagMenu)
|
Input.press("Right", 2)
|
||||||
else
|
else
|
||||||
if Memory.value("menu", "shop_current") ~= 70 then
|
if Memory.value("menu", "shop_current") == 74 then
|
||||||
--select the item
|
--select the item
|
||||||
Menu.select(Inventory.indexOf(item)+1, "accelerate", "input")
|
local Index = Inventory.indexOf(item)
|
||||||
|
if itemRow < Index then
|
||||||
|
Input.press("Down", 2)
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
--accept the use
|
--accept the use
|
||||||
Menu.select(1, true, "input")
|
Input.press("A", 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--if its done
|
|
||||||
else
|
else
|
||||||
Menu.close()
|
--cancel menu (or set name)
|
||||||
|
Input.press("B", 2)
|
||||||
end
|
end
|
||||||
elseif Utils.onPokemonSelect(battleMenu) then
|
elseif Utils.onPokemonSelect(battleMenu) then
|
||||||
if poke then
|
if poke then
|
||||||
|
local Index
|
||||||
if type(poke) == "string" then
|
if type(poke) == "string" then
|
||||||
poke = Pokemon.indexOf(poke)
|
Index = Pokemon.indexOf(poke)+1
|
||||||
end
|
|
||||||
Menu.select(poke, true, "input")
|
|
||||||
else
|
else
|
||||||
Input.press("A")
|
Index = poke
|
||||||
|
end
|
||||||
|
if itemRow < Index then
|
||||||
|
Input.press("Down", 2)
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
|
--Menu.select(poke, true, "input")
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Input.press("B")
|
Input.press("B", 2)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
Input.press("A", 2)
|
||||||
|
end
|
||||||
|
--return true
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local main = Memory.value("menu", "main")
|
|
||||||
local column = Menu.getCol()
|
|
||||||
local give_done = false
|
|
||||||
--select item menu
|
|
||||||
if main == 121 then
|
|
||||||
Menu.select(3, true)
|
|
||||||
--inside bag menu
|
|
||||||
elseif main == 50 then
|
|
||||||
--if its not done
|
|
||||||
if not give_done then
|
|
||||||
if column ~= BagMenu then
|
|
||||||
--select proper bag menu
|
|
||||||
Menu.setCol(BagMenu)
|
|
||||||
else
|
|
||||||
if Memory.value("menu", "shop_current") ~= 66 then
|
|
||||||
--select the item
|
|
||||||
Menu.select(Inventory.indexOf(item)+1, "accelerate", "input")
|
|
||||||
else
|
|
||||||
--accept the use
|
|
||||||
Menu.select(1, true, "input")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--if its done
|
|
||||||
else
|
|
||||||
Menu.close()
|
|
||||||
end
|
|
||||||
--inside pokemon menu
|
|
||||||
elseif main == 127 then
|
|
||||||
local idx = 1
|
|
||||||
if poke then
|
|
||||||
idx = poke
|
|
||||||
end
|
|
||||||
if Memory.value("menu", "input_row") ~= idx then
|
|
||||||
Menu.select(idx, true, "input")
|
|
||||||
else
|
|
||||||
Input.press("A", 1)
|
|
||||||
give_done = true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return Inventory
|
return Inventory
|
||||||
|
|
||||||
|
|
|
@ -5,34 +5,7 @@ local Input = require "util.input"
|
||||||
local Memory = require "util.memory"
|
local Memory = require "util.memory"
|
||||||
local Menu = require "util.menu"
|
local Menu = require "util.menu"
|
||||||
|
|
||||||
local pokeIDs = {
|
local PokemonList = require "storage.pokemonlist"
|
||||||
pidgey = 16,
|
|
||||||
spearow = 21,
|
|
||||||
rattata = 19,
|
|
||||||
nidoranF = 29,
|
|
||||||
nidoranM = 32,
|
|
||||||
|
|
||||||
chikorita = 152,
|
|
||||||
bayleef = 153,
|
|
||||||
meganium = 154,
|
|
||||||
|
|
||||||
cyndaquil = 155,
|
|
||||||
quilava = 156,
|
|
||||||
typhlosion = 157,
|
|
||||||
|
|
||||||
totodile = 158,
|
|
||||||
croconaw = 159,
|
|
||||||
feraligatr = 160,
|
|
||||||
|
|
||||||
sentret = 161,
|
|
||||||
furret = 162,
|
|
||||||
hoothoot = 163,
|
|
||||||
marill = 183,
|
|
||||||
azumarill = 184,
|
|
||||||
sudowoodo = 185,
|
|
||||||
politoed = 186,
|
|
||||||
hoppip = 187,
|
|
||||||
}
|
|
||||||
|
|
||||||
local moveList = {
|
local moveList = {
|
||||||
cut = 15,
|
cut = 15,
|
||||||
|
@ -59,19 +32,23 @@ local moveList = {
|
||||||
thunderbolt = 85,
|
thunderbolt = 85,
|
||||||
earthquake = 89,
|
earthquake = 89,
|
||||||
dig = 91,
|
dig = 91,
|
||||||
|
rage = 99,
|
||||||
rock_slide = 157,
|
rock_slide = 157,
|
||||||
}
|
}
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
moves = {2},
|
held = {1},
|
||||||
|
move1 = {2},
|
||||||
|
move2 = {3},
|
||||||
|
move3 = {4},
|
||||||
|
move4 = {5},
|
||||||
exp = {7, true, true}, --0x1CE7
|
exp = {7, true, true}, --0x1CE7
|
||||||
|
pp1 = {23},
|
||||||
pp = {23},
|
pp2 = {24},
|
||||||
|
pp3 = {25},
|
||||||
|
pp4 = {26},
|
||||||
level = {31},
|
level = {31},
|
||||||
status = {32},
|
status = {32},
|
||||||
|
|
||||||
hp = {34, true},
|
hp = {34, true},
|
||||||
max_hp = {36, true},
|
max_hp = {36, true},
|
||||||
attack = {38, true},
|
attack = {38, true},
|
||||||
|
@ -84,7 +61,7 @@ local data = {
|
||||||
local previousPartySize
|
local previousPartySize
|
||||||
|
|
||||||
local function getAddress(index)
|
local function getAddress(index)
|
||||||
return 0x1CDF + index * 0x30 --+48 index
|
return 0x1CDF + index * 0x30
|
||||||
end
|
end
|
||||||
|
|
||||||
local function index(index, offset)
|
local function index(index, offset)
|
||||||
|
@ -115,7 +92,8 @@ Pokemon.index = index
|
||||||
|
|
||||||
local function indexOf(...)
|
local function indexOf(...)
|
||||||
for ni,name in ipairs(arg) do
|
for ni,name in ipairs(arg) do
|
||||||
local pid = pokeIDs[name]
|
local pid = PokemonList.ID(name)
|
||||||
|
--local pid = pokeIDs[name]
|
||||||
for i=0,5 do
|
for i=0,5 do
|
||||||
local atIdx = index(i)
|
local atIdx = index(i)
|
||||||
if atIdx == pid then
|
if atIdx == pid then
|
||||||
|
@ -127,13 +105,28 @@ local function indexOf(...)
|
||||||
end
|
end
|
||||||
Pokemon.indexOf = indexOf
|
Pokemon.indexOf = indexOf
|
||||||
|
|
||||||
|
local function indexOfbyID(ID)
|
||||||
|
for i=0,5 do
|
||||||
|
local PokemonID = Memory.raw(getAddress(i))
|
||||||
|
if PokemonID == ID then
|
||||||
|
return i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
Pokemon.indexOfbyID = indexOfbyID
|
||||||
|
|
||||||
-- Table functions
|
-- Table functions
|
||||||
|
|
||||||
function Pokemon.battleMove(name)
|
function Pokemon.battleMove(name)
|
||||||
local mid = moveList[name]
|
local mid = moveList[name]
|
||||||
for i=0,3 do
|
local PokemonID = Memory.value("battle", "our_id")
|
||||||
--if mid == Memory.raw(0x101B + i) then
|
local PokemonIndex = indexOfbyID(PokemonID)
|
||||||
if mid == Memory.raw(0x062E + i) then
|
for i=1,4 do
|
||||||
|
local SearchString = "move"..i
|
||||||
|
local MoveID = index(PokemonIndex, SearchString)
|
||||||
|
--if mid == Memory.raw(0x062E + i) then
|
||||||
|
if mid == MoveID then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -146,7 +139,7 @@ function Pokemon.moveIndex(move, pokemon)
|
||||||
else
|
else
|
||||||
pokemonIdx = 0
|
pokemonIdx = 0
|
||||||
end
|
end
|
||||||
local address = getAddress(pokemonIdx) + 7
|
local address = getAddress(pokemonIdx) + 1
|
||||||
local mid = moveList[move]
|
local mid = moveList[move]
|
||||||
for i=1,4 do
|
for i=1,4 do
|
||||||
if mid == Memory.raw(address + i) then
|
if mid == Memory.raw(address + i) then
|
||||||
|
@ -160,15 +153,17 @@ function Pokemon.info(name, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pokemon.getID(name)
|
function Pokemon.getID(name)
|
||||||
return pokeIDs[name]
|
--return pokeIDs[name]
|
||||||
|
return PokemonList.ID(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pokemon.getName(id)
|
function Pokemon.getName(id)
|
||||||
for name,pid in pairs(pokeIDs) do
|
return PokemonList.PokemonName(id)
|
||||||
if pid == id then
|
--for name,pid in pairs(pokeIDs) do
|
||||||
return name
|
-- if pid == id then
|
||||||
end
|
-- return name
|
||||||
end
|
-- end
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pokemon.getSacrifice(...)
|
function Pokemon.getSacrifice(...)
|
||||||
|
@ -192,7 +187,7 @@ function Pokemon.forMove(move)
|
||||||
local moveID = moveList[move]
|
local moveID = moveList[move]
|
||||||
for i=0,5 do
|
for i=0,5 do
|
||||||
local address = getAddress(i)
|
local address = getAddress(i)
|
||||||
for j=8,11 do
|
for j=2,5 do
|
||||||
if Memory.raw(address + j) == moveID then
|
if Memory.raw(address + j) == moveID then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
|
@ -209,7 +204,7 @@ function Pokemon.updateParty()
|
||||||
local partySize = Memory.value("player", "party_size")
|
local partySize = Memory.value("player", "party_size")
|
||||||
if partySize ~= previousPartySize then
|
if partySize ~= previousPartySize then
|
||||||
--local poke = Pokemon.inParty("tododile", "paras", "spearow", "pidgey", "nidoran", "squirtle")
|
--local poke = Pokemon.inParty("tododile", "paras", "spearow", "pidgey", "nidoran", "squirtle")
|
||||||
local poke = Pokemon.inParty("tododile")
|
local poke = Pokemon.inParty("tododile", "sentret", "poliwag", "bellsprout")
|
||||||
if poke then
|
if poke then
|
||||||
Bridge.caught(poke)
|
Bridge.caught(poke)
|
||||||
previousPartySize = partySize
|
previousPartySize = partySize
|
||||||
|
@ -228,7 +223,8 @@ end
|
||||||
function Pokemon.isOpponent(...)
|
function Pokemon.isOpponent(...)
|
||||||
local oid = Memory.value("battle", "opponent_id")
|
local oid = Memory.value("battle", "opponent_id")
|
||||||
for i,name in ipairs(arg) do
|
for i,name in ipairs(arg) do
|
||||||
if oid == pokeIDs[name] then
|
--if oid == pokeIDs[name] then
|
||||||
|
if oid == PokemonList.ID(name) then
|
||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -237,7 +233,8 @@ end
|
||||||
function Pokemon.isDeployed(...)
|
function Pokemon.isDeployed(...)
|
||||||
local deployedID = Memory.value("battle", "our_id")
|
local deployedID = Memory.value("battle", "our_id")
|
||||||
for i,name in ipairs(arg) do
|
for i,name in ipairs(arg) do
|
||||||
if deployedID == pokeIDs[name] then
|
--if deployedID == pokeIDs[name] then
|
||||||
|
if deployedID == PokemonList.ID(name) then
|
||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
PokemonList = {}
|
||||||
|
|
||||||
|
local pokeIDs = {
|
||||||
|
pidgey = 16,
|
||||||
|
spearow = 21,
|
||||||
|
rattata = 19,
|
||||||
|
nidoranF = 29,
|
||||||
|
nidoranM = 32,
|
||||||
|
|
||||||
|
poliwag = 60,
|
||||||
|
poliwhirl = 61,
|
||||||
|
poliwrath = 62,
|
||||||
|
abra = 63,
|
||||||
|
kadabra = 64,
|
||||||
|
alakazam = 65,
|
||||||
|
machop = 66,
|
||||||
|
machoke = 67,
|
||||||
|
machamp = 68,
|
||||||
|
bellsprout = 69,
|
||||||
|
weepinbell = 70,
|
||||||
|
victreebel = 71,
|
||||||
|
|
||||||
|
chikorita = 152,
|
||||||
|
bayleef = 153,
|
||||||
|
meganium = 154,
|
||||||
|
|
||||||
|
cyndaquil = 155,
|
||||||
|
quilava = 156,
|
||||||
|
typhlosion = 157,
|
||||||
|
|
||||||
|
totodile = 158,
|
||||||
|
croconaw = 159,
|
||||||
|
feraligatr = 160,
|
||||||
|
|
||||||
|
sentret = 161,
|
||||||
|
furret = 162,
|
||||||
|
hoothoot = 163,
|
||||||
|
marill = 183,
|
||||||
|
azumarill = 184,
|
||||||
|
sudowoodo = 185,
|
||||||
|
politoed = 186,
|
||||||
|
hoppip = 187,
|
||||||
|
}
|
||||||
|
|
||||||
|
--Get id
|
||||||
|
local function ID(Pokemon)
|
||||||
|
return pokeIDs[Pokemon]
|
||||||
|
end
|
||||||
|
PokemonList.ID = ID
|
||||||
|
|
||||||
|
--Get name
|
||||||
|
local function PokemonName(ID)
|
||||||
|
for name,pid in pairs(pokeIDs) do
|
||||||
|
if pid == ID then
|
||||||
|
return name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
PokemonList.PokemonName = PokemonName
|
||||||
|
|
||||||
|
return PokemonList
|
||||||
|
|
|
@ -19,17 +19,18 @@ local function bridgeButton(btn)
|
||||||
end
|
end
|
||||||
|
|
||||||
--local function sendButton(button, ab, hold, newgame)
|
--local function sendButton(button, ab, hold, newgame)
|
||||||
local function sendButton(button, ab, hold)
|
--local function sendButton(button, ab, hold)
|
||||||
|
local function sendButton(button, ab)
|
||||||
local inputTable = {}
|
local inputTable = {}
|
||||||
if hold then
|
--if hold then
|
||||||
inputTable = {[button]=true, B=true}
|
-- inputTable = {[button]=true, B=true}
|
||||||
else
|
--else
|
||||||
--if not newgame then
|
--if not newgame then
|
||||||
inputTable = {[button]=true}
|
inputTable = {[button]=true}
|
||||||
--else
|
--else
|
||||||
-- inputTable = {Up=true, B=true, Select=true}
|
-- inputTable = {Up=true, B=true, Select=true}
|
||||||
--end
|
--end
|
||||||
end
|
--end
|
||||||
joypad.set(inputTable)
|
joypad.set(inputTable)
|
||||||
if debug then
|
if debug then
|
||||||
if hold then
|
if hold then
|
||||||
|
@ -43,7 +44,7 @@ local function sendButton(button, ab, hold)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ab then
|
if ab then
|
||||||
buttonbutton = "A,B"
|
button = "A,B"
|
||||||
end
|
end
|
||||||
bridgeButton(button)
|
bridgeButton(button)
|
||||||
setForFrame = button
|
setForFrame = button
|
||||||
|
@ -59,7 +60,8 @@ function Input.isWaiting()
|
||||||
end
|
end
|
||||||
|
|
||||||
--function Input.press(button, frames, hold, newgame)
|
--function Input.press(button, frames, hold, newgame)
|
||||||
function Input.press(button, frames, hold)
|
--function Input.press(button, frames, hold)
|
||||||
|
function Input.press(button, frames)
|
||||||
if setForFrame then
|
if setForFrame then
|
||||||
print("ERR: Reassigning "..setForFrame.." to "..button)
|
print("ERR: Reassigning "..setForFrame.." to "..button)
|
||||||
return
|
return
|
||||||
|
@ -77,7 +79,8 @@ function Input.press(button, frames, hold)
|
||||||
remainingFrames = 0
|
remainingFrames = 0
|
||||||
end
|
end
|
||||||
bCancel = button ~= "B"
|
bCancel = button ~= "B"
|
||||||
sendButton(button, false, hold)
|
sendButton(button, false)
|
||||||
|
--sendButton(button, false, hold)
|
||||||
--sendButton(button, false, hold, newgame)
|
--sendButton(button, false, hold, newgame)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -93,8 +96,8 @@ function Input.cancel()
|
||||||
else
|
else
|
||||||
button = "A"
|
button = "A"
|
||||||
end
|
end
|
||||||
remainingFrames = 0
|
|
||||||
sendButton(button, true)
|
sendButton(button, true)
|
||||||
|
--sendButton(button, false)
|
||||||
bCancel = not bCancel
|
bCancel = not bCancel
|
||||||
--end
|
--end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ local memoryNames = {
|
||||||
},
|
},
|
||||||
inventory = {
|
inventory = {
|
||||||
item_count = 0x1892,
|
item_count = 0x1892,
|
||||||
item_base = 0x1893,
|
--item_base = 0x1893,
|
||||||
},
|
},
|
||||||
menu = {
|
menu = {
|
||||||
row = 0x0F88,
|
row = 0x0F88,
|
||||||
|
@ -105,10 +105,15 @@ local memoryNames = {
|
||||||
--miss = 0x105F,
|
--miss = 0x105F,
|
||||||
--our_turn = 0x1FF1,
|
--our_turn = 0x1FF1,
|
||||||
|
|
||||||
--TO DO GET SLEEPING STATUS
|
--SLEEPING STATUS = 1-7
|
||||||
--TO DO GET CONFUSED STATUS
|
--POISONED STATUS = 8-15 or 24-31 or 40-47 or 56-63 or 72-79 or 88-95 or 104-111 or 120-127 or 136-143 or 152-159 or 168-175 or 184-191 or 200-207 or 216-223 or 232-239 or 248-255
|
||||||
--TO DO GET PARALIZED STATUS ?
|
--BURN STATUS = 16-23 or 48-55 or 80-87 or 112-119 or 144-151 or 176-183 or 208-215 or 240-247
|
||||||
--TO DO GET CRITICAL'D STATUS ?
|
--FREEZE STATUS = 32-39 or 96-103 or 160-167 or 224-231
|
||||||
|
--PARALIZED STATUS = 64-71 or 192-199
|
||||||
|
--NOTHING STATUS = 128-135
|
||||||
|
|
||||||
|
--CONFUSED STATUS =
|
||||||
|
--CRITICAL'D STATUS =
|
||||||
|
|
||||||
--opponent_next_move = 0x0CDD, --C6E4 ?? NOT USED?
|
--opponent_next_move = 0x0CDD, --C6E4 ?? NOT USED?
|
||||||
--opponent_last_move = 0x0FCC,
|
--opponent_last_move = 0x0FCC,
|
||||||
|
|
Loading…
Reference in New Issue