Skip to content

Commit

Permalink
Thumgeon: Tweak monster and chest spawning
Browse files Browse the repository at this point in the history
- Difficulty tuning for monsters: Now 50% chance of a monster, and 1 in 10 monster rooms can have a ‘horde’ (1-2 extra monsters based on Floor).
- Combined `a` and `b` monster spawning code, to give better control over statistics.
- Increase chance of a Chest from 10 > 15%. The gold yield was decreased in an earlier commit to keep balance.
  • Loading branch information
ace-dent committed Jul 7, 2024
1 parent db521e3 commit 8f95005
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Thumgeon/Thumgeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,8 @@ def generateRoom(room):
room.getTile(4, 2).tiletype = 4
room.getTile(4, 2).tiledata = signMessages[randint(0, len(signMessages) - 1)]

# Each room has a 10% chance of having a chest in it
if(randint(0, 9) == 0):
# Each room has a 15% chance of having a chest in it
if(randint(0, 19) < 3):
pos = getRandomFreePosition(room)
room.getTile(pos[0], pos[1]).tiletype = 6

Expand Down Expand Up @@ -1154,21 +1154,21 @@ def generateRoom(room):
room.getTile(pos[0], pos[1]).tiletype = item.tiletype
room.getTile(pos[0], pos[1]).tiledata = item.tiledata.copy()

# Each room has a 40% chance of having a monster in it
if(randint(0, 4) < 2):
pos = getRandomFreePosition(room)
room.getTile(pos[0], pos[1]).tiletype = 8
room.getTile(pos[0], pos[1]).tiledata.append(randint(0, len(monsterSprites) - 1))
room.getTile(pos[0], pos[1]).tiledata.append(randint(10, 15) + 2 * floorNo)
room.getTile(pos[0], pos[1]).tiledata.append(1)

# Each room has a 20% chance of having another monster in it
if(randint(0, 4) == 0):
pos = getRandomFreePosition(room)
room.getTile(pos[0], pos[1]).tiletype = 8
room.getTile(pos[0], pos[1]).tiledata.append(randint(0, len(monsterSprites) - 1))
room.getTile(pos[0], pos[1]).tiledata.append(randint(10, 15) + 2 * floorNo)
room.getTile(pos[0], pos[1]).tiledata.append(1)
# Each room has a 50% chance of one or more monsters
if(randint(0, 1) == 0):
monsters = 1
# 10% chance the room contains a horde of monsters
if(randint(0, 9) == 0):
if(floorNo < 4):
monsters = 2
else:
monsters = 3
for i in range(monsters):
pos = getRandomFreePosition(room)
room.getTile(pos[0], pos[1]).tiletype = 8
room.getTile(pos[0], pos[1]).tiledata.append(randint(0, len(monsterSprites) - 1))
room.getTile(pos[0], pos[1]).tiledata.append(randint(10, 15) + 2 * floorNo)
room.getTile(pos[0], pos[1]).tiledata.append(1)


# Draw the entire gamestate, including Heads-Up-Display (HUD)
Expand Down

0 comments on commit 8f95005

Please sign in to comment.