Skip to content

Commit 1c95a42

Browse files
committed
Thumgeon: Tweak monster and chest spawning
- 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). Hordes cannot occur in the first dungeon room. - 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.
1 parent db521e3 commit 1c95a42

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

Thumgeon/Thumgeon.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,8 +1099,8 @@ def generateRoom(room):
10991099
room.getTile(4, 2).tiletype = 4
11001100
room.getTile(4, 2).tiledata = signMessages[randint(0, len(signMessages) - 1)]
11011101

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

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

1157-
# Each room has a 40% chance of having a monster in it
1158-
if(randint(0, 4) < 2):
1159-
pos = getRandomFreePosition(room)
1160-
room.getTile(pos[0], pos[1]).tiletype = 8
1161-
room.getTile(pos[0], pos[1]).tiledata.append(randint(0, len(monsterSprites) - 1))
1162-
room.getTile(pos[0], pos[1]).tiledata.append(randint(10, 15) + 2 * floorNo)
1163-
room.getTile(pos[0], pos[1]).tiledata.append(1)
1164-
1165-
# Each room has a 20% chance of having another monster in it
1166-
if(randint(0, 4) == 0):
1167-
pos = getRandomFreePosition(room)
1168-
room.getTile(pos[0], pos[1]).tiletype = 8
1169-
room.getTile(pos[0], pos[1]).tiledata.append(randint(0, len(monsterSprites) - 1))
1170-
room.getTile(pos[0], pos[1]).tiledata.append(randint(10, 15) + 2 * floorNo)
1171-
room.getTile(pos[0], pos[1]).tiledata.append(1)
1157+
# Each room has a 50% chance of one or more monsters
1158+
if(randint(0, 1) == 0):
1159+
monsters = 1
1160+
# 10% chance the room contains a horde of monsters (except first room)
1161+
if(room != currentRoom and randint(0, 9) == 0):
1162+
if(floorNo < 4):
1163+
monsters = 2
1164+
else:
1165+
monsters = 3
1166+
for i in range(monsters):
1167+
pos = getRandomFreePosition(room)
1168+
room.getTile(pos[0], pos[1]).tiletype = 8
1169+
room.getTile(pos[0], pos[1]).tiledata.append(randint(0, len(monsterSprites) - 1))
1170+
room.getTile(pos[0], pos[1]).tiledata.append(randint(10, 15) + 2 * floorNo)
1171+
room.getTile(pos[0], pos[1]).tiledata.append(1)
11721172

11731173

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

0 commit comments

Comments
 (0)