mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-11-30 04:20:06 +00:00
More skill handlers
Note: need to revisit these when active powers are implemented to make sure they are correct. DamageNDebuff isn't even implemented yet.
This commit is contained in:
@@ -63,12 +63,19 @@ int Player::getCompositeCondition() {
|
||||
}
|
||||
|
||||
int Player::takeDamage(EntityRef src, int amt) {
|
||||
HP -= amt;
|
||||
return amt;
|
||||
int dmg = amt;
|
||||
if(HP - dmg < 0) dmg = HP;
|
||||
HP -= dmg;
|
||||
|
||||
return dmg;
|
||||
}
|
||||
|
||||
void Player::heal(EntityRef src, int amt) {
|
||||
// stubbed
|
||||
int Player::heal(EntityRef src, int amt) {
|
||||
int heal = amt;
|
||||
if(HP + heal > getMaxHP()) heal = getMaxHP() - HP;
|
||||
HP += heal;
|
||||
|
||||
return heal;
|
||||
}
|
||||
|
||||
bool Player::isAlive() {
|
||||
@@ -79,6 +86,14 @@ int Player::getCurrentHP() {
|
||||
return HP;
|
||||
}
|
||||
|
||||
int Player::getMaxHP() {
|
||||
return PC_MAXHEALTH(level);
|
||||
}
|
||||
|
||||
int Player::getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
std::vector<EntityRef> Player::getGroupMembers() {
|
||||
std::vector<EntityRef> members;
|
||||
if(group != nullptr)
|
||||
@@ -96,6 +111,10 @@ int32_t Player::getID() {
|
||||
return iID;
|
||||
}
|
||||
|
||||
EntityRef Player::getRef() {
|
||||
return EntityRef(PlayerManager::getSockFromID(iID));
|
||||
}
|
||||
|
||||
void Player::step(time_t currTime) {
|
||||
// no-op
|
||||
}
|
||||
@@ -121,16 +140,21 @@ int CombatNPC::getCompositeCondition() { /* stubbed */
|
||||
}
|
||||
|
||||
int CombatNPC::takeDamage(EntityRef src, int amt) {
|
||||
int dmg = amt;
|
||||
if(hp - dmg < 0) dmg = hp;
|
||||
hp -= dmg;
|
||||
|
||||
hp -= amt;
|
||||
if (hp <= 0)
|
||||
transition(AIState::DEAD, src);
|
||||
if(hp <= 0) transition(AIState::DEAD, src);
|
||||
|
||||
return amt;
|
||||
return dmg;
|
||||
}
|
||||
|
||||
void CombatNPC::heal(EntityRef src, int amt) {
|
||||
// stubbed
|
||||
int CombatNPC::heal(EntityRef src, int amt) {
|
||||
int heal = amt;
|
||||
if(hp + heal > getMaxHP()) heal = getMaxHP() - hp;
|
||||
hp += heal;
|
||||
|
||||
return heal;
|
||||
}
|
||||
|
||||
bool CombatNPC::isAlive() {
|
||||
@@ -141,6 +165,14 @@ int CombatNPC::getCurrentHP() {
|
||||
return hp;
|
||||
}
|
||||
|
||||
int CombatNPC::getMaxHP() {
|
||||
return maxHealth;
|
||||
}
|
||||
|
||||
int CombatNPC::getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
std::vector<EntityRef> CombatNPC::getGroupMembers() {
|
||||
std::vector<EntityRef> members;
|
||||
if(group != nullptr)
|
||||
@@ -160,6 +192,10 @@ int32_t CombatNPC::getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
EntityRef CombatNPC::getRef() {
|
||||
return EntityRef(id);
|
||||
}
|
||||
|
||||
void CombatNPC::step(time_t currTime) {
|
||||
|
||||
if(stateHandlers.find(state) != stateHandlers.end())
|
||||
|
||||
Reference in New Issue
Block a user