(WIP) Move ICombatant functions around a bit

This commit is contained in:
gsemaj 2022-04-11 16:52:35 -04:00
parent 14b02ec5d2
commit 166e148878
3 changed files with 28 additions and 21 deletions

View File

@ -17,6 +17,30 @@ using namespace Combat;
/// Player Id -> Bullet Id -> Bullet /// Player Id -> Bullet Id -> Bullet
std::map<int32_t, std::map<int8_t, Bullet>> Combat::Bullets; std::map<int32_t, std::map<int8_t, Bullet>> Combat::Bullets;
void Player::takeDamage(EntityRef src, int amt) {
// stubbed
}
void Player::heal(EntityRef src, int amt) {
// stubbed
}
bool Player::isAlive() {
return HP > 0;
}
void CombatNPC::takeDamage(EntityRef src, int amt) {
// stubbed
}
void CombatNPC::heal(EntityRef src, int amt) {
// stubbed
}
bool CombatNPC::isAlive() {
return hp > 0;
}
static std::pair<int,int> getDamage(int attackPower, int defensePower, bool shouldCrit, static std::pair<int,int> getDamage(int attackPower, int defensePower, bool shouldCrit,
bool batteryBoost, int attackerStyle, bool batteryBoost, int attackerStyle,
int defenderStyle, int difficulty) { int defenderStyle, int difficulty) {

View File

@ -103,19 +103,6 @@ sPCAppearanceData Player::getAppearanceData() {
return data; return data;
} }
// player combat methods; not sure if this is the right place to put them
void Player::takeDamage(EntityRef src, int amt) {
// stubbed
}
void Player::heal(EntityRef src, int amt) {
// stubbed
}
bool Player::isAlive() {
return HP > 0;
}
// TODO: this is less effiecient than it was, because of memset() // TODO: this is less effiecient than it was, because of memset()
void Player::enterIntoViewOf(CNSocket *sock) { void Player::enterIntoViewOf(CNSocket *sock) {
INITSTRUCT(sP_FE2CL_PC_NEW, pkt); INITSTRUCT(sP_FE2CL_PC_NEW, pkt);

View File

@ -134,15 +134,11 @@ struct CombatNPC : public BaseNPC, public ICombatant {
_stepAI(this, currTime); _stepAI(this, currTime);
} }
virtual void takeDamage(EntityRef src, int amt) override { virtual bool isExtant() override { return hp > 0; }
// stubbed
}
virtual void heal(EntityRef src, int amt) override { virtual void takeDamage(EntityRef src, int amt) override;
// stubbed virtual void heal(EntityRef src, int amt) override;
} virtual bool isAlive() override;
virtual bool isAlive() override { return hp > 0; }
}; };
// Mob is in MobAI.hpp, Player is in Player.hpp // Mob is in MobAI.hpp, Player is in Player.hpp