Almost working save sytem but the data I store is totally wrong. I need to also save the entity IDs being used and map them to the components.

This commit is contained in:
Zed A. Shaw 2024-11-05 02:38:36 -05:00
parent babc190525
commit d113dba42f
15 changed files with 213 additions and 64 deletions

View file

@ -1,14 +1,16 @@
#include "combat.hpp"
#include "rand.hpp"
int Combat::attack(Combat &target) {
int attack = Random::uniform<int>(0,1);
int my_dmg = 0;
namespace components {
int Combat::attack(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;
if(attack) {
my_dmg = Random::uniform<int>(1, damage);
target.hp -= my_dmg;
}
return my_dmg;
}
return my_dmg;
}