Skip to content

Commit d895eb3

Browse files
committed
V2.4.6
Added reset if 10 mins over next split. Clean up
1 parent bd9898c commit d895eb3

File tree

6 files changed

+70
-5
lines changed

6 files changed

+70
-5
lines changed

ai/red/strategies.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,16 @@ Strategies.timeRequirements = {
8383
return timeLimit
8484
end,
8585

86+
route3 = function()
87+
return 19 + timeSaveFor("spearow")
88+
end,
89+
8690
mt_moon = function() --RESET
8791
if BEAST_MODE then
8892
return 24.75
8993
end
9094

91-
local timeLimit = 25.25 + timeSaveFor("paras")
95+
local timeLimit = 25.50 + timeSaveFor("paras")
9296
if Pokemon.info("nidoking", "level") >= 18 then
9397
timeLimit = timeLimit + 0.33
9498
elseif Pokemon.getExp() > 3730 then
@@ -566,7 +570,7 @@ strategyFunctions.shopPewterMart = function()
566570
local pokeballs = Inventory.count("pokeball")
567571
if stats.nidoran.rating == nil then
568572
p("Game failed to read memory")
569-
Strategies.reset("Memory", "Game messed up reading memory")
573+
Strategies.reset("Memory", "Oops, forgot to switch to nidoran, now not right level!")
570574
end
571575
if pokeballs < (Pokemon.inParty("spearow") and 2 or 3) then
572576
pokeballs = pokeballs + 1

ai/strategies.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function Strategies.hardReset(reason, message, extra, wait)
6666
local seed = Data.run.seed
6767
local newmessage = message.." | "..seed
6868

69-
local f, err = io.open("C:/Users/rjrhy/Desktop/Pokebot/Github work/PokeBotBad/wiki/red/runs.txt", "a")
69+
local f, err = io.open(RUNS_FILE, "a")
7070
if f==nil then
7171
print("Couldn't open file: "..err)
7272
else
@@ -1078,7 +1078,7 @@ Strategies.functions = {
10781078
end,
10791079

10801080
speedchange = function(data)
1081-
p(data.extra..", speed changed too "..data.speed.."%")
1081+
p(data.extra..", speed changed to "..data.speed.."%")
10821082
client.speedmode(data.speed)
10831083
return true
10841084
end,

main.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ BEAST_MODE = false -- WARNING: Do not engage. Will yolo everything, and reset at
66
INITIAL_SPEED = 750
77
AFTER_BROCK_SPEED = 350
88

9+
RUNS_FILE = "C:/Users/rjrhy/Desktop/Pokebot/Github work/PokeBotBad/wiki/red/runs.txt" -- Use / insted of \ otherwise it will not work
10+
911
local CUSTOM_SEED = nil -- Set to a known seed to replay it, or leave nil for random runs
1012
local NIDORAN_NAME = "A" -- Set this to the single character to name Nidoran (note, to replay a seed, it MUST match!)
1113
local PAINT_ON = true -- Display contextual information while the bot runs
1214

1315
-- START CODE (hard hats on)
1416

15-
VERSION = "2.4.5"
17+
VERSION = "2.4.6"
1618

1719
local Data = require "data.data"
1820

@@ -49,6 +51,7 @@ function resetAll()
4951
Walk.reset()
5052
Paint.reset()
5153
Bridge.reset()
54+
Utils.reset()
5255
oldSeconds = 0
5356
running = false
5457
client.speedmode(INITIAL_SPEED)
@@ -70,6 +73,7 @@ end
7073
p("Welcome to PokeBot "..Utils.capitalize(Data.gameName).." v"..VERSION, true)
7174

7275
Control.init()
76+
Utils.init()
7377
STREAMING_MODE = true
7478

7579
if CUSTOM_SEED then
@@ -123,6 +127,7 @@ local function generateNextInput(currentMap)
123127
end
124128
else
125129
Bridge.time()
130+
Utils.splitCheck()
126131
local battleState = Memory.value("game", "battle")
127132
Control.encounter(battleState)
128133

util/bridge.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ function Bridge.split(finished)
158158
timeStopped = true
159159
end
160160
send("split")
161+
Utils.splitUpdate()
161162
end
162163

163164
function Bridge.pausegametime()

util/utils.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
local Utils = {}
22

33
local Memory = require "util.memory"
4+
local Strategies
5+
local Data = require "data.data"
46

57
local EMP = 1
8+
local splitCheck = 0
9+
local splitNum = 1
610

711
-- GLOBAL
812

@@ -25,6 +29,15 @@ end
2529

2630
-- GENERAL
2731

32+
function Utils.reset()
33+
splitCheck = 0
34+
splitNum = 1
35+
end
36+
37+
function Utils.splitUpdate()
38+
splitNum = splitNum + 1
39+
end
40+
2841
function Utils.dist(x1, y1, x2, y2)
2942
return math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2))
3043
end
@@ -174,4 +187,28 @@ function Utils.elapsedTime()
174187
return hours..":"..clockSegment(mins)..":"..clockSegment(secs)
175188
end
176189

190+
function Utils.timeToSplit(splitName)
191+
local currTime = Utils.igt()
192+
local splitTime = Strategies.getTimeRequirement(splitName) * 60
193+
local diff = currTime - splitTime
194+
return diff
195+
end
196+
197+
function Utils.splitCheck()
198+
local order = { "bulbasaur", "nidoran", "brock", "route3", "mt_moon", "mankey", "misty", "trash", "safari_carbos", "safari_carbos" , "safari_carbos", "victory_road", "victory_road", "victory_road", "victory_road", "victory_road", "e4center", "blue", "blue", "blue", "champion" }
199+
if splitCheck == 600 then
200+
local timediff = Utils.timeToSplit(order[splitNum])
201+
if timediff >= 600 then
202+
Strategies.reboot()
203+
end
204+
splitCheck = 0
205+
else
206+
splitCheck = splitCheck + 1
207+
end
208+
end
209+
210+
function Utils.init()
211+
Strategies = require("ai."..Data.gameName..".strategies")
212+
end
213+
177214
return Utils

wiki/red/runs.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,21 @@ Reset at Brock's Gym | 0:10:32 | Died. | 1468423103
77
Reset at Nidoran grass | 0:07:07 | Ran too low on Pokeballs. | 1468423180
88
Reset at Brock's Gym | 0:11:11 | Critical'd. | 1468423235
99
Reset at Pallet Rival | 0:02:14 | Took too long to beat Bulbasaur. | 1468423322
10+
Reset at Pallet Rival | 0:01:15 | Took too long to beat Bulbasaur. | 1469134181
11+
Reset at Pallet Rival | 0:01:15 | Took too long to beat Bulbasaur. | 1469134198
12+
Reset at Pallet Rival | 0:01:15 | Took too long to beat Bulbasaur. | 1469134214
13+
Reset at Pallet Rival | 0:01:16 | Took too long to beat Bulbasaur. | 1469134627
14+
Reset at Pallet Rival | 0:01:15 | Took too long to beat Bulbasaur. | 1469135585
15+
Reset at Pallet Town | 0:03:22 | Too many encounters. | 1469135697
16+
Reset at Pallet Rival | 0:02:05 | Bad Squirtle - 10 attack, 11 special. | 1469135732
17+
Reset at Nidoran grass | 0:06:34 | Took too long to catch Nidoran. | 1469135756
18+
Reset at Brock's Gym | 0:11:10 | Bad Nidoran - unrunnable speed, unrunnable special. | 1469135816
19+
Reset at Pallet Town | 0:04:00 | Too many encounters. | 1469135919
20+
Reset at Brock's Gym | 0:10:55 | Bad Nidoran - unrunnable speed. | 1469135958
21+
Reset at Pallet Rival | 0:01:41 | Growled to death. | 1469136910
22+
Reset at Pallet Rival | 0:02:14 | Took too long to beat Bulbasaur. | 1469136956
23+
Reset at Pallet Rival | 0:02:11 | Bad Squirtle - 10 attack, 11 special. | 1469137310
24+
Reset at Nidoran grass | 0:06:21 | Too many encounters. | 1469137477
25+
Reset at Pallet Rival | 0:02:14 | Took too long to beat Bulbasaur. | 1469137536
26+
Reset at Pallet Rival | 0:02:14 | Took too long to beat Bulbasaur. | 1469137561
27+
Reset at Nidoran grass | 0:06:31 | Death by Rattata. | 1469137586

0 commit comments

Comments
 (0)