mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-18 11:44:42 +02:00
Merge pull request #1494 from AverageConsumer/codex/gen2-catch-previews
feat(gen2): expose stock ball catch previews
This commit is contained in:
@@ -490,6 +490,11 @@ check("hurt is easier to catch", hurtRate > fullRate, true)
|
||||
local asleepRate = Catching.rate({
|
||||
maxHp = 60, hp = 1, catchRate = 45, ball = "POKE_BALL", status = "sleep" })
|
||||
check("sleep adds 10", asleepRate, math.min(255, hurtRate + 10))
|
||||
checkNear("preview converts the exact byte roll", Catching.chance({
|
||||
maxHp = 60, hp = 60, catchRate = 45, ball = "POKE_BALL" }),
|
||||
fullRate * 100 / 256, 0.000001)
|
||||
check("master ball preview is certain", Catching.chance({
|
||||
maxHp = 60, hp = 60, catchRate = 1, ball = "MASTER_BALL" }), 100)
|
||||
-- The cart's bug: burn/poison/paralysis add nothing.
|
||||
check("poison adds nothing (cart bug)", Catching.rate({
|
||||
maxHp = 60, hp = 1, catchRate = 45, ball = "POKE_BALL",
|
||||
|
||||
@@ -282,6 +282,16 @@ local function runToMenu(screen, cap)
|
||||
return false
|
||||
end
|
||||
|
||||
do
|
||||
local screen = newScreen({ inventory = {
|
||||
MASTER_BALL = 1, POKE_BALL = 1,
|
||||
} })
|
||||
eq(screen:catchChance("MASTER_BALL"), 100,
|
||||
"the battle screen exposes a certain Master Ball preview")
|
||||
check(type(screen:catchChance("POKE_BALL")) == "number",
|
||||
"the battle screen exposes the live wild catch preview")
|
||||
end
|
||||
|
||||
-- ---- BattleMenu empties the textbox ---------------------------------------
|
||||
do
|
||||
local screen = newScreen()
|
||||
|
||||
@@ -163,14 +163,23 @@ function screen2:chooseMove(slot)
|
||||
return true
|
||||
end
|
||||
function screen2:cancelMove() self.phase = "menu" return true end
|
||||
function screen2:catchChance(ball)
|
||||
return ball == "MASTER_BALL" and 100 or 37.5
|
||||
end
|
||||
local game2 = {
|
||||
data = {
|
||||
pokemon = { CHIKORITA = { name = "CHIKORITA" },
|
||||
RATTATA = { name = "RATTATA" } },
|
||||
moves = { TACKLE = { name = "TACKLE", type = "NORMAL",
|
||||
power = 35, accuracy = 95, pp = 35 } },
|
||||
items = {
|
||||
MASTER_BALL = { name = "MASTER BALL", pocket = "BALL" },
|
||||
POTION = { name = "POTION", pocket = "ITEM" },
|
||||
},
|
||||
},
|
||||
save = { party = { player2 } }, stack = { states = { screen2 } },
|
||||
save = { party = { player2 }, inventory = {
|
||||
MASTER_BALL = 1, POTION = 2,
|
||||
} }, stack = { states = { screen2 } },
|
||||
}
|
||||
|
||||
local api2 = require("src.battle.gen2.BattleAPI").new(game2)
|
||||
@@ -179,6 +188,9 @@ check(snapshot2 and snapshot2.kind == "wild" and snapshot2.prompt == "menu",
|
||||
"Gold battle is discovered through its screen id")
|
||||
eq(snapshot2.player.maxHp, 21, "Gold max HP uses the mon field")
|
||||
eq(snapshot2.moves[1].name, "TACKLE", "Gold moves are copied")
|
||||
eq(#snapshot2.items, 1, "Gold exposes balls without guessing targeted items")
|
||||
eq(snapshot2.items[1].catchChance, 100,
|
||||
"Gold ball records expose the exact catch preview")
|
||||
snapshot2.player.hp = 0
|
||||
snapshot2.moves[1].pp = 0
|
||||
eq(player2.hp, 20, "changing a snapshot cannot change a Gold Pokemon")
|
||||
|
||||
Reference in New Issue
Block a user