survivor

graphical action game for the linux terminal
git clone https://git.ce9e.org/survivor.git

commit
176d27d5370b6f57835bd2a1126f7b2fa62b64be
parent
d35eabf503c565a1af21151b5d1c82ffdfd1f1a7
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-03-29 06:28
increase amount of weapons as perks

Diffstat

M README.md 4 ++++
M src/game.rs 10 +++++++++-

2 files changed, 13 insertions, 1 deletions


diff --git a/README.md b/README.md

@@ -18,6 +18,10 @@ the player receives a random perk:
   18    18 -	Experience from diamonds is increased by 10%
   19    19 -	Full health is restored
   20    20 -	The player recovers +0.2HP per second
   -1    21 -	Get an additional axe
   -1    22 -	Get an additional knive
   -1    23 -	Get an additional shuriken
   -1    24 -	Get an additional whirlwind
   21    25 
   22    26 ## Installation
   23    27 

diff --git a/src/game.rs b/src/game.rs

@@ -14,6 +14,10 @@ const PERK_HEAL: usize = 4;
   14    14 const PERK_RECOVER: usize = 5;
   15    15 const PERK_ATTRACT: usize = 6;
   16    16 const PERK_XP: usize = 7;
   -1    17 const PERK_AXE: usize = 8;
   -1    18 const PERK_KNIFE: usize = 9;
   -1    19 const PERK_STAR: usize = 10;
   -1    20 const PERK_WIND: usize = 11;
   17    21 
   18    22 #[derive(PartialEq, Clone, Copy)]
   19    23 pub enum Dir {
@@ -89,7 +93,7 @@ impl Player {
   89    93             self.last_level = self.next_level;
   90    94             self.next_level *= 1.3;
   91    95 
   92    -1             match rng.gen_range(0, 8) {
   -1    96             match rng.gen_range(0, 12) {
   93    97                 PERK_POWER => self.power *= 1.1,
   94    98                 PERK_HEALTH => self.health_max *= 1.1,
   95    99                 PERK_SPEED => self.speed *= 1.1,
@@ -98,6 +102,10 @@ impl Player {
   98   102                 PERK_RECOVER => self.health_recover += 0.2,
   99   103                 PERK_ATTRACT => self.diamond_radius *= 1.1,
  100   104                 PERK_XP => self.xp_factor *= 1.1,
   -1   105                 PERK_AXE => self.weapons[0].amount += 1,
   -1   106                 PERK_KNIFE => self.weapons[1].amount += 1,
   -1   107                 PERK_STAR => self.weapons[2].amount += 1,
   -1   108                 PERK_WIND => self.weapons[3].amount += 1,
  101   109                 _ => unreachable!(),
  102   110             }
  103   111         }