AI: adjust balance + HUMAN: add time to show the pattern and fix a filename

This commit is contained in:
2026-10-09 11:01:50 -04:00
parent 66802216fd
commit 8d742b89cf
4 changed files with 64 additions and 7 deletions
+12 -6
View File
@@ -145,6 +145,7 @@ def onAppStart(app):
app.skillCheckSpeed = 1
app.skillCheckBars = [] # tuples of (position, length)
app.skillCheckFailed = False
app.showPatternTimer = 30
#FISHING
app.fishingTimer = 0
@@ -207,6 +208,7 @@ def resetFishingState(app):
app.skillCheckSpeed = 1
app.skillCheckBars = [] # list of tuples of form (position, length)
app.skillCheckFailed = False
app.showPatternTimer = 30
app.hookedFish = None
app.fishingTimer = 0
@@ -225,7 +227,7 @@ def pickRandomCreature(app):
print("max difficulty:", max_difficulty)
#here we take the root of the difficulty to represent the weight of that fish, this makes higher difficulty fish easier to catch once unlocked
k = 0.5
k = 0.75
#invert the difficulty and add one so it avoids zero
possibilities = [(creature["name"], (max_difficulty - creature["difficulty"] + 1) ** k) for creature in app.creatures if creature["difficulty"] <= max_difficulty]
print("possibilities:",possibilities)
@@ -262,14 +264,14 @@ def startSkillCheck(app, creature):
app.skillCheckSpeed = max(difficulty / fishingPower, 5) #this got INCREDIBLY slow with good upgrades
numBars = difficulty // 10 - sum([upgrade[2] for upgrade in AVAILABLE_UPGRADES if (upgrade[0] in app.save["owned_upgrades"] and upgrade[1] == "count")])
numBars = difficulty // 15 - sum([upgrade[2] for upgrade in AVAILABLE_UPGRADES if (upgrade[0] in app.save["owned_upgrades"] and upgrade[1] == "count")])
numBars = max(numBars, 1)
lastPos = 0
lastLen = 0
while len(app.skillCheckBars) < numBars:
#50 is default length, adjust it proportionally to difficulty, then add upgrade length multipliers. also set to int instead of float
newLen = random.randrange(int((1 - (difficulty / 100)) * 50 * math.prod([upgrade[2] for upgrade in AVAILABLE_UPGRADES if (upgrade[0] in app.save["owned_upgrades"] and upgrade[1] == "timing")])))
newLen = random.randrange(int((1 - (difficulty / 125)) * 60 * math.prod([upgrade[2] for upgrade in AVAILABLE_UPGRADES if (upgrade[0] in app.save["owned_upgrades"] and upgrade[1] == "timing")])))
#take the end of the last bar, and add a random amount between 5 degrees
#and the remaining amount to the end divided by the number of bars left
lastEndPos = (lastPos + lastLen)
@@ -316,9 +318,12 @@ def onStep(app):
app.hookedFish = selectedCreature
startSkillCheck(app, selectedCreature)
case "skill-check":
app.skillCheckAngle += app.skillCheckSpeed / 6 #this was far too fast
if (app.skillCheckAngle > 360):
finishSkillCheck(app)
if app.showPatternTimer < 1:
app.skillCheckAngle += app.skillCheckSpeed / 6 #this was far too fast
if (app.skillCheckAngle > 360):
finishSkillCheck(app)
else:
app.showPatternTimer -= 1
def onMousePress(app, mouseX, mouseY):
@@ -720,6 +725,7 @@ def drawDebug(app):
activeBait: {app.save["current_bait"]}
Angle: {rounded(app.skillCheckAngle)}
NextBar: {app.skillCheckBars[0] if len(app.skillCheckBars) > 0 else "N/A"}
showPatternTimer: {rounded(app.showPatternTimer)}
"""
debugLines = debugStr.splitlines()
size = 16