Skip to content

Commit e64fb05

Browse files
committed
move the no battle at home check out of enemy mod
1 parent 6a31a6b commit e64fb05

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/character/enemy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rand::Rng;
1111
/// The distance from home will influence the enemy frequency and level.
1212
/// Under certain conditions, special (quest-related) enemies may be spawned.
1313
pub fn spawn(location: &location::Location, player: &Character) -> Option<Character> {
14-
if location.is_home() || player.enemies_evaded() {
14+
if player.enemies_evaded() {
1515
return None;
1616
}
1717

src/game.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ impl Game {
9696
while self.location != *dest {
9797
self.visit(self.location.go_to(dest))?;
9898

99-
if let Some(mut enemy) = enemy::spawn(&self.location, &self.player) {
100-
return self.battle(&mut enemy, run, bribe);
99+
if !self.location.is_home() {
100+
if let Some(mut enemy) = enemy::spawn(&self.location, &self.player) {
101+
return self.battle(&mut enemy, run, bribe);
102+
}
101103
}
102104
}
103105
Ok(())

src/item/chest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ impl Chest {
5353
if gold_chest {
5454
chest.gold = game.player.gold_gained(game.player.level + distance.len());
5555
}
56-
5756
if equipment_chest {
5857
let (sword, shield) = random_equipment(game.player.rounded_level());
5958
chest.sword = sword;

0 commit comments

Comments
 (0)