Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day 7 tweaking wip #1

Merged
merged 3 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/7drl-2021.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion engine/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class HeatBoltEnemy(Actor):
ch = "H"

def default_ai(self) -> engine.actions.Action:
return engine.actions.RangedIdle(self, effect=engine.effects.Heat(power=2), range=2)
return engine.actions.RangedIdle(self, effect=engine.effects.Heat(power=2), range=3)


class ColdBoltEnemy(Actor):
Expand All @@ -237,3 +237,12 @@ class ColdBoltEnemy(Actor):

def default_ai(self) -> engine.actions.Action:
return engine.actions.RangedIdle(self, effect=engine.effects.Cold(power=1), range=2)


class AcidBoltEnemy(Actor):
name = "acid caster"
faction = "hostile"
ch = "A"

def default_ai(self) -> engine.actions.Action:
return engine.actions.RangedIdle(self, effect=engine.effects.PlaceAcid(power=1), range=1)
19 changes: 15 additions & 4 deletions procgen/dungeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def generate(

if level == 2:
wallType = engine.tiles.ICE_WALL
waterType = engine.tiles.ICE_FLOOR
if level == 3:
waterType = engine.tiles.ACID

Expand Down Expand Up @@ -146,16 +147,20 @@ def generate(
tunnel_indices = np.r_[
tcod.los.bresenham(t_start, t_middle), tcod.los.bresenham(t_middle, t_end) # Concatenate lines.
].transpose() # tunnel_indices[axis, index]
tunnel_indices = np.append(tunnel_indices, tunnel_indices - 1, axis=1) # Make tunnels 2 wide.
if level != 2: # makes Ice level have 1 wide walls.
tunnel_indices = np.append(tunnel_indices, tunnel_indices - 1, axis=1) # Make tunnels 2 wide.
gm.tiles[tuple(tunnel_indices)] = engine.tiles.FLOOR
engine.rendering.debug_map(gm)
rooms.append(new_room)

# Start of Water generation:
# step 1 make random map noise:
randomMap = create_noise_map(width, height, 80)
if level != 3:
randomMap = create_noise_map(width, height, 80)
else:
randomMap = create_noise_map(width, height, 70)

# step 2: feed to cellular automata sevewral times (number of times based on tweaking.
# step 2: feed to cellular automata several times (number of times based on tweaking.
automataMap1 = convolve(randomMap, 10) # second value is the number of nearby tiles needed to be water.

# step 3: Use map to replace wall and floor tiles with water.
Expand All @@ -166,7 +171,13 @@ def generate(
for room in rooms[1:-1]:
if random.randint(0, 1):
# gm.add_actor(engine.actor.Actor(*room.center)) #placeholder enemies.
gm.add_actor(engine.actor.ColdBoltEnemy(*room.center))
if level == 1: # Acid level
if random.randint(0, 1):
gm.add_actor(engine.actor.AcidBoltEnemy(*room.center))
else:
gm.add_actor(engine.actor.HeatBoltEnemy(*room.center))
else:
gm.add_actor(engine.actor.ColdBoltEnemy(*room.center))
else:
gm.add_actor(engine.actor.HunterEnemy(*room.center))
engine.rendering.debug_map(gm)
Expand Down