(WIP) Start implementing ICombatant

Start by replacing `hitMob` with `takeDamage` interface function.
Simplify `pcAttackChars` a little by utilizing the new interface, then add more interface functions as needed.

A lot of the combat logic is tied to the `Mob` class. Need to start moving stuff over to CombatNPC.
This commit is contained in:
gsemaj
2022-04-11 23:14:03 -04:00
parent ed866fbee4
commit 0c4cdaeabf
6 changed files with 106 additions and 99 deletions

View File

@@ -78,9 +78,11 @@ public:
ICombatant() {}
virtual ~ICombatant() {}
virtual void takeDamage(EntityRef, int) = 0;
virtual int takeDamage(EntityRef, int) = 0;
virtual void heal(EntityRef, int) = 0;
virtual bool isAlive() = 0;
virtual int getCurrentHP() = 0;
virtual int32_t getID() = 0;
};
/*
@@ -136,9 +138,11 @@ struct CombatNPC : public BaseNPC, public ICombatant {
virtual bool isExtant() override { return hp > 0; }
virtual void takeDamage(EntityRef src, int amt) override;
virtual int takeDamage(EntityRef src, int amt) override;
virtual void heal(EntityRef src, int amt) override;
virtual bool isAlive() override;
virtual int getCurrentHP() override;
virtual int32_t getID() override;
};
// Mob is in MobAI.hpp, Player is in Player.hpp