Created a combat system to start with and also added a 'HEARING' mechanic where enemies can hear you from a certain distance before moving to you.
This commit is contained in:
parent
753bc70b77
commit
9102bdc8ad
9 changed files with 70 additions and 24 deletions
14
combat.cpp
Normal file
14
combat.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "combat.hpp"
|
||||
#include "rand.hpp"
|
||||
|
||||
int Combat::fight(Combat &target) {
|
||||
int attack = Random::uniform<int>(0,1);
|
||||
int my_dmg = 0;
|
||||
|
||||
if(attack) {
|
||||
my_dmg = Random::uniform<int>(1, damage);
|
||||
target.hp -= my_dmg;
|
||||
}
|
||||
|
||||
return my_dmg;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue