Track Nido DVs, standardize Horn Drill speed check
This commit is contained in:
parent
cb1163daf9
commit
8ab022e682
|
@ -60,11 +60,8 @@ local function calcDamage(move, attacker, defender, rng)
|
||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
end
|
||||||
if move.power > 9000 then
|
if move.power > 9000 then
|
||||||
local oid = defender.id
|
if Memory.value("battle", "x_accuracy") == 1 and defender.speed < attacker.speed then
|
||||||
if oid ~= 14 and oid ~= 147 and oid ~= 171 and (oidd ~= 151 or Memory.value("game", "map") == 120) then -- ???
|
return 9001, 9001
|
||||||
if Memory.value("battle", "x_accuracy") == 1 and defender.speed < attacker.speed then
|
|
||||||
return 9001, 9001
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -540,12 +540,10 @@ strategyFunctions.fightBrock = function()
|
||||||
defense = def,
|
defense = def,
|
||||||
speed = spd,
|
speed = spd,
|
||||||
special = scl,
|
special = scl,
|
||||||
level4 = stats.nidoran.level4
|
level4 = stats.nidoran.level4,
|
||||||
|
rating = 0,
|
||||||
}
|
}
|
||||||
local statDiff = (16 - att) + (15 - spd) + (13 - scl)
|
p(Pokemon.getDVs("nidoran"))
|
||||||
if not stats.nidoran.level4 then
|
|
||||||
statDiff = statDiff + 1
|
|
||||||
end
|
|
||||||
local resets = att < 15 or spd < 14 or scl < 12 or (att == 15 and spd == 14)
|
local resets = att < 15 or spd < 14 or scl < 12 or (att == 15 and spd == 14)
|
||||||
local nStatus = "Att: "..att..", Def: "..def..", Speed: "..spd..", Special: "..scl
|
local nStatus = "Att: "..att..", Def: "..def..", Speed: "..spd..", Special: "..scl
|
||||||
if resets then
|
if resets then
|
||||||
|
@ -553,9 +551,15 @@ strategyFunctions.fightBrock = function()
|
||||||
end
|
end
|
||||||
status.tries = 9001
|
status.tries = 9001
|
||||||
|
|
||||||
|
local statDiff = (16 - att) + (15 - spd) + (13 - scl)
|
||||||
if def < 12 then
|
if def < 12 then
|
||||||
statDiff = statDiff + 1
|
statDiff = statDiff + 1
|
||||||
end
|
end
|
||||||
|
if not stats.nidoran.level4 then
|
||||||
|
statDiff = statDiff + 1
|
||||||
|
end
|
||||||
|
stats.nidoran.rating = statDiff
|
||||||
|
|
||||||
local superlative
|
local superlative
|
||||||
local exclaim = "!"
|
local exclaim = "!"
|
||||||
if statDiff == 0 then
|
if statDiff == 0 then
|
||||||
|
@ -583,7 +587,6 @@ strategyFunctions.fightBrock = function()
|
||||||
exclaim = "."
|
exclaim = "."
|
||||||
end
|
end
|
||||||
Bridge.chat("Beat Brock with a"..superlative.." Nidoran"..exclaim.." "..nStatus..", caught at level "..(stats.nidoran.level4 and "4" or "3")..".")
|
Bridge.chat("Beat Brock with a"..superlative.." Nidoran"..exclaim.." "..nStatus..", caught at level "..(stats.nidoran.level4 and "4" or "3")..".")
|
||||||
tweetBrock(statDiff)
|
|
||||||
else
|
else
|
||||||
status.tries = status.tries + 1
|
status.tries = status.tries + 1
|
||||||
end
|
end
|
||||||
|
@ -772,13 +775,20 @@ strategyFunctions.teachThrash = function()
|
||||||
local spd = Pokemon.index(0, "speed")
|
local spd = Pokemon.index(0, "speed")
|
||||||
local scl = Pokemon.index(0, "special")
|
local scl = Pokemon.index(0, "special")
|
||||||
local statDesc = att.." "..def.." "..spd.." "..scl
|
local statDesc = att.." "..def.." "..spd.." "..scl
|
||||||
|
local attDv, defDV, spdDv, sclDV = Pokemon.getDVs("nidoking")
|
||||||
stats.nidoran = {
|
stats.nidoran = {
|
||||||
attack = att,
|
attack = att,
|
||||||
defense = def,
|
defense = def,
|
||||||
speed = spd,
|
speed = spd,
|
||||||
special = scl,
|
special = scl,
|
||||||
level4 = stats.nidoran.level4
|
level4 = stats.nidoran.level4,
|
||||||
|
rating = stats.nidoran.rating,
|
||||||
|
attackDV = attDv,
|
||||||
|
defenseDV = defDV,
|
||||||
|
speedDV = spdDv,
|
||||||
|
specialDV = sclDV,
|
||||||
}
|
}
|
||||||
|
p(Pokemon.getDVs(name))
|
||||||
Bridge.stats(statDesc)
|
Bridge.stats(statDesc)
|
||||||
print(statDesc)
|
print(statDesc)
|
||||||
return true
|
return true
|
||||||
|
@ -893,7 +903,7 @@ end
|
||||||
strategyFunctions.potionBeforeMisty = function()
|
strategyFunctions.potionBeforeMisty = function()
|
||||||
local healAmount = 70
|
local healAmount = 70
|
||||||
local hasEnoughAttack = stats.nidoran.attack >= (yolo and 53 or 54)
|
local hasEnoughAttack = stats.nidoran.attack >= (yolo and 53 or 54)
|
||||||
local canSpeedTie = stats.nidoran.speed > 50
|
local canSpeedTie = stats.nidoran.speedDV >= 11
|
||||||
if Control.yolo then
|
if Control.yolo then
|
||||||
if hasEnoughAttack and hasEnoughSpeed then
|
if hasEnoughAttack and hasEnoughSpeed then
|
||||||
healAmount = 45
|
healAmount = 45
|
||||||
|
@ -901,7 +911,7 @@ strategyFunctions.potionBeforeMisty = function()
|
||||||
healAmount = 65
|
healAmount = 65
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if hasEnoughAttack and stats.nidoran.speed > 51 then
|
if hasEnoughAttack and stats.nidoran.speedDV >= 13 then
|
||||||
healAmount = 45
|
healAmount = 45
|
||||||
elseif hasEnoughAttack and canSpeedTie then
|
elseif hasEnoughAttack and canSpeedTie then
|
||||||
healAmount = 65
|
healAmount = 65
|
||||||
|
@ -952,14 +962,10 @@ end
|
||||||
-- 6: MISTY
|
-- 6: MISTY
|
||||||
|
|
||||||
strategyFunctions.potionBeforeRocket = function()
|
strategyFunctions.potionBeforeRocket = function()
|
||||||
local minAttack = 55 -- RISK
|
if stats.nidoran.attackDV >= 12 then
|
||||||
if Control.yolo then
|
|
||||||
minAttack = minAttack - 1
|
|
||||||
end
|
|
||||||
if stats.nidoran.attack >= minAttack then
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return Strategies.functions.potion({hp=10})
|
return Strategies.functions.potion({hp=13, yolo=11})
|
||||||
end
|
end
|
||||||
|
|
||||||
strategyFunctions.jingleSkip = function()
|
strategyFunctions.jingleSkip = function()
|
||||||
|
@ -1459,8 +1465,7 @@ strategyFunctions.safariCarbos = function()
|
||||||
if Strategies.initialize() then
|
if Strategies.initialize() then
|
||||||
Strategies.setYolo("safari_carbos")
|
Strategies.setYolo("safari_carbos")
|
||||||
end
|
end
|
||||||
local minSpeed = 50
|
if stats.nidoran.speedDV >= 7 then
|
||||||
if stats.nidoran.speed >= minSpeed then
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if Inventory.contains("carbos") then
|
if Inventory.contains("carbos") then
|
||||||
|
@ -1524,7 +1529,7 @@ strategyFunctions.fightSilphMachoke = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
strategyFunctions.silphCarbos = function()
|
strategyFunctions.silphCarbos = function()
|
||||||
if stats.nidoran.speed >= 51 then
|
if stats.nidoran.speedDV >= 8 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return Strategies.functions.interact({dir="Left"})
|
return Strategies.functions.interact({dir="Left"})
|
||||||
|
@ -1764,11 +1769,7 @@ strategyFunctions.cinnabarCarbos = function()
|
||||||
if px == 21 then
|
if px == 21 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local minSpeed = 52
|
if stats.nidoran.speedDV >= 10 then
|
||||||
if Control.yolo then
|
|
||||||
minSpeed = minSpeed - 1
|
|
||||||
end
|
|
||||||
if stats.nidoran.speed >= minSpeed then
|
|
||||||
Walk.step(21, 20)
|
Walk.step(21, 20)
|
||||||
else
|
else
|
||||||
if py == 20 then
|
if py == 20 then
|
||||||
|
@ -1841,8 +1842,8 @@ end
|
||||||
|
|
||||||
strategyFunctions.fightGiovanniMachoke = function()
|
strategyFunctions.fightGiovanniMachoke = function()
|
||||||
if Strategies.initialize() then
|
if Strategies.initialize() then
|
||||||
if stats.nidoran.attack >= 56 then
|
if stats.nidoran.attackDV >= 13 then
|
||||||
local eqPpRequired = stats.nidoran.special >= 47 and 7 or 8
|
local eqPpRequired = stats.nidoran.specialDV >= 11 and 7 or 8
|
||||||
if Battle.pp("earthquake") >= eqPpRequired then
|
if Battle.pp("earthquake") >= eqPpRequired then
|
||||||
status.skipSpecial = true
|
status.skipSpecial = true
|
||||||
end
|
end
|
||||||
|
@ -1966,7 +1967,7 @@ strategyFunctions.checkEther = function()
|
||||||
if hornPP >= 5 then
|
if hornPP >= 5 then
|
||||||
maxEtherSkip = true
|
maxEtherSkip = true
|
||||||
elseif hornPP >= 4 then
|
elseif hornPP >= 4 then
|
||||||
maxEtherSkip = stats.nidoran.attack > 53 and Battle.pp("earthquake") > 0
|
maxEtherSkip = stats.nidoran.attackDV >= 11 and Battle.pp("earthquake") > 0
|
||||||
end
|
end
|
||||||
if not maxEtherSkip then
|
if not maxEtherSkip then
|
||||||
Bridge.chat("Grabbing the Max Ether to skip the Elite 4 Center.")
|
Bridge.chat("Grabbing the Max Ether to skip the Elite 4 Center.")
|
||||||
|
@ -2244,7 +2245,7 @@ strategyFunctions.blue = function()
|
||||||
if Battle.isActive() then
|
if Battle.isActive() then
|
||||||
if not status.canProgress then
|
if not status.canProgress then
|
||||||
status.canProgress = true
|
status.canProgress = true
|
||||||
if stats.nidoran.special >= 45 and stats.nidoran.speed >= 52 and Inventory.contains("x_special") then
|
if stats.nidoran.specialDV >= 8 and stats.nidoran.speedDV >= 12 and Inventory.contains("x_special") then
|
||||||
status.xItem = "x_special"
|
status.xItem = "x_special"
|
||||||
else
|
else
|
||||||
status.xItem = "x_speed"
|
status.xItem = "x_speed"
|
||||||
|
@ -2360,11 +2361,18 @@ function Strategies.initGame(midGame)
|
||||||
special = 11,
|
special = 11,
|
||||||
}
|
}
|
||||||
if Pokemon.inParty("nidoking") then
|
if Pokemon.inParty("nidoking") then
|
||||||
|
local attDv, defDV, spdDv, sclDV = Pokemon.getDVs("nidoking")
|
||||||
|
p(Pokemon.getDVs("nidoking"))
|
||||||
stats.nidoran = {
|
stats.nidoran = {
|
||||||
attack = 55,
|
attack = 55,
|
||||||
defense = 45,
|
defense = 45,
|
||||||
speed = 50,
|
speed = 50,
|
||||||
special = 45,
|
special = 45,
|
||||||
|
rating = 1,
|
||||||
|
attackDV = attDv,
|
||||||
|
defenseDV = defDV,
|
||||||
|
speedDV = spdDv,
|
||||||
|
specialDV = sclDV,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stats.nidoran = {
|
stats.nidoran = {
|
||||||
|
@ -2373,10 +2381,11 @@ function Strategies.initGame(midGame)
|
||||||
speed = 15,
|
speed = 15,
|
||||||
special = 13,
|
special = 13,
|
||||||
level4 = true,
|
level4 = true,
|
||||||
|
rating = 1,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
riskGiovanni = true
|
riskGiovanni = true
|
||||||
print(stats.nidoran.attack.." x "..stats.nidoran.speed.." "..stats.nidoran.special)
|
p(stats.nidoran.attack, "x", stats.nidoran.speed, stats.nidoran.special)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -291,4 +291,12 @@ function Pokemon.use(move)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Pokemon.getDVs(name)
|
||||||
|
local index = Pokemon.indexOf(name)
|
||||||
|
local baseAddress = getAddress(index)
|
||||||
|
local attackDefense = Memory.raw(baseAddress + 0x1B)
|
||||||
|
local speedSpecial = Memory.raw(baseAddress + 0x1C)
|
||||||
|
return bit.rshift(attackDefense, 4), bit.band(attackDefense, 15), bit.rshift(speedSpecial, 4), bit.band(speedSpecial, 15)
|
||||||
|
end
|
||||||
|
|
||||||
return Pokemon
|
return Pokemon
|
||||||
|
|
Loading…
Reference in New Issue