Skip to content

Commit

Permalink
Fixed boat battle bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikketer committed Jul 17, 2024
1 parent e92b24a commit f641a15
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions boatBattle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace BoatBattle {
numberOfEnemies = 8
} else {
// A log curve to determine the number of enemies
numberOfEnemies = 4 + Math.max(Math.floor(boatTreasure / 1000 * 4), 4);
numberOfEnemies = 3 + Math.min(Math.floor(boatTreasure / 1000 * 4), 4);
}

Utils.getArrayOfLength(numberOfEnemies).forEach((index) => {
Expand All @@ -48,7 +48,7 @@ namespace BoatBattle {
// Had to do this to make it easy and running out of time!
const treasurePretendingToBePirate = { hit: () => {}, health: 1, sprite: treasure }

// At least 3 enemies go for the treasure
// At least 2 enemies go for the treasure
let target = Math.pickRandom([player1, player2, treasurePretendingToBePirate])
if (index <= 2) {
target = treasurePretendingToBePirate
Expand Down Expand Up @@ -124,9 +124,7 @@ namespace BoatBattle {

destroy()
_onLooseCallback()
}

if (allPlayersDead) {
} else if (allPlayersDead) {
_isDone = true
pause(1500)

Expand All @@ -141,9 +139,7 @@ namespace BoatBattle {

destroy()
_onLooseCallback()
}

if (!anyAlive) {
} else if (!anyAlive) {
_isDone = true
pause(1500)

Expand Down

0 comments on commit f641a15

Please sign in to comment.