This commit is contained in:
Kyle Coburn 2015-04-24 21:34:49 -07:00
parent 06bd4965a1
commit cf356f5a88
5 changed files with 17 additions and 17 deletions

View File

@ -4,13 +4,14 @@ local Battle
local Combat = require "ai.combat"
local Strategies
local Data = require "data.data"
local Bridge = require "util.bridge"
local Memory = require "util.memory"
local Menu = require "util.menu"
local Paint = require "util.paint"
local Utils = require "util.utils"
local Data = require "data.data"
local Inventory = require "storage.inventory"
local Pokemon = require "storage.pokemon"
@ -23,8 +24,6 @@ local extraEncounter, maxEncounters
local battleYolo
local encountersSection
local yellow = YELLOW
Control.areaName = "Unknown"
Control.getMoonExp = true
Control.yolo = false
@ -96,7 +95,7 @@ local controlFunctions = {
startMtMoon = function()
Control.canDie(false)
Control.getMoonExp = not yellow
Control.getMoonExp = not Data.yellow
end,
moon1Exp = function()
@ -208,9 +207,9 @@ function Control.canCatch(partySize)
partySize = Memory.value("player", "party_size")
end
local pokeballs = Inventory.count("pokeball")
local minimumCount = (yellow and 3 or 4) - partySize
local minimumCount = (Data.yellow and 3 or 4) - partySize
if pokeballs < minimumCount then
if yellow and Pokemon.inParty("nidoran", "nidorino", "nidoking") and Pokemon.inParty("pidgey", "spearow") then
if Data.yellow and Pokemon.inParty("nidoran", "nidorino", "nidoking") and Pokemon.inParty("pidgey", "spearow") then
return false
end
Strategies.reset("pokeballs", "Not enough PokeBalls", pokeballs)
@ -230,7 +229,7 @@ function Control.shouldCatch(partySize)
if not shouldCatch then
return false
end
if yellow and not Inventory.contains("pokeball") then
if Data.yellow and not Inventory.contains("pokeball") then
return false
end
if not partySize then
@ -274,7 +273,7 @@ function Control.set(data)
if controlFunction then
controlFunction(data)
else
p("INVALID CONTROL", data.c, GAME_NAME)
p("INVALID CONTROL", data.c, Data.gameName)
end
end
@ -384,7 +383,7 @@ end
function Control.init()
Battle = require("action.battle")
Strategies = require("ai."..GAME_NAME..".strategies")
Strategies = require("ai."..Data.gameName..".strategies")
end
return Control

View File

@ -8,6 +8,8 @@ local Shop = require "action.shop"
local Textbox = require "action.textbox"
local Walk = require "action.walk"
local Data = require "data.data"
local Bridge = require "util.bridge"
local Input = require "util.input"
local Memory = require "util.memory"
@ -15,7 +17,6 @@ local Menu = require "util.menu"
local Player = require "util.player"
local Utils = require "util.utils"
local Data = require "data.data"
local Inventory = require "storage.inventory"
local Pokemon = require "storage.pokemon"
@ -338,7 +339,7 @@ strategyFunctions.fightBulbasaur = function()
end
if Battle.isActive() and Battle.opponentAlive() then
local resetMessage, customReason
if Memory.double("battle", "our_attack") < 2 then
if Memory.double("battle", "our_attack") <= 2 then
resetMessage = "Growled to death."
customReason = true
else
@ -368,7 +369,8 @@ strategyFunctions.catchNidoran = function()
if not Control.canCatch() then
return true
end
local catchableNidoran = Pokemon.isOpponent("nidoran") and Memory.value("battle", "opponent_level") > 2
local opponent = Battle.opponent()
local catchableNidoran = opponent == "nidoran" and Memory.value("battle", "opponent_level") > 2
local pokeballs = Inventory.count("pokeball")
local caught = Memory.value("player", "party_size") - 1
if pokeballs < (catchableNidoran and 5 or 6) - caught * 2 then
@ -2028,7 +2030,7 @@ end
function Strategies.initGame(midGame)
if midGame then
Strategies.setYolo("bulbasaur")
Strategies.setYolo("bulbasaur", true)
stats.squirtle = {
attack = 11,
defense = 11,

View File

@ -122,8 +122,8 @@ function Strategies.resetTime(timeLimit, explanation, custom)
end
end
function Strategies.setYolo(name)
if not RESET_FOR_TIME then
function Strategies.setYolo(name, forced)
if not forced and not RESET_FOR_TIME then
return false
end
local minimumTime = Strategies.getTimeRequirement(name)

View File

@ -923,7 +923,7 @@ end
function Strategies.initGame(midGame)
if midGame then
-- Strategies.setYolo("")
-- Strategies.setYolo("", true)
if Pokemon.inParty("nidoking") then
local attDV, defDV, spdDV, sclDV = Pokemon.getDVs("nidoking")
p(attDV, defDV, spdDV, sclDV)

1
external/json.lua vendored
View File

@ -108,7 +108,6 @@ function json.encode (v)
assert(false,'encode attempt to encode unsupported type ' .. vtype .. ':' .. tostring(v))
end
--- Decodes a JSON string and returns the decoded value as a Lua data structure / value.
-- @param s The string to scan.
-- @param [startPos] Optional starting position where the JSON string is located. Defaults to 1.