Compare commits

..

1 Commits

Author SHA1 Message Date
Gent Semaj
22345f2fec
Merge 9affe76587 into b12aecad63 2023-08-13 20:59:34 +00:00
2 changed files with 16 additions and 35 deletions

View File

@ -85,26 +85,8 @@ static SkillResult handleSkillDamageNDebuff(SkillData* skill, int power, ICombat
}
static SkillResult handleSkillLeech(SkillData* skill, int power, ICombatant* source, ICombatant* target) {
EntityRef sourceRef = source->getRef();
int heal = skill->values[0][power];
int healed = source->heal(sourceRef, heal);
int damage = heal * 2;
int dealt = target->takeDamage(sourceRef, damage);
sSkillResult_Leech result{};
result.Damage.eCT = target->getCharType();
result.Damage.iID = target->getID();
result.Damage.bProtected = dealt <= 0;
result.Damage.iDamage = dealt;
result.Damage.iHP = target->getCurrentHP();
result.Heal.eCT = result.Damage.eCT;
result.Heal.iID = result.Damage.iID;
result.Heal.iHealHP = healed;
result.Heal.iHP = source->getCurrentHP();
return SkillResult(sizeof(sSkillResult_Leech), &result);
// TODO abilities
return SkillResult();
}
static SkillResult handleSkillBuff(SkillData* skill, int power, ICombatant* source, ICombatant* target) {

View File

@ -61,13 +61,14 @@ void Player::removeBuff(int buffId, BuffClass buffClass) {
}
void Player::clearBuffs(bool force) {
auto it = buffs.begin();
while(it != buffs.end()) {
Buff* buff = (*it).second;
if(!force) buff->clear();
delete buff;
it = buffs.erase(it);
for(auto buff : buffs) {
if(!force) {
removeBuff(buff.first);
} else {
delete buff.second;
}
}
buffs.clear();
}
bool Player::hasBuff(int buffId) {
@ -168,8 +169,6 @@ void Player::step(time_t currTime) {
// buffs
for(auto buffEntry : buffs) {
buffEntry.second->combatTick(currTime);
if(!isAlive())
break; // unsafe to keep ticking if we're dead
}
}
#pragma endregion
@ -216,13 +215,14 @@ void CombatNPC::removeBuff(int buffId, BuffClass buffClass) {
}
void CombatNPC::clearBuffs(bool force) {
auto it = buffs.begin();
while(it != buffs.end()) {
Buff* buff = (*it).second;
if(!force) buff->clear();
delete buff;
it = buffs.erase(it);
for(auto buff : buffs) {
if(!force) {
removeBuff(buff.first);
} else {
delete buff.second;
}
}
buffs.clear();
}
bool CombatNPC::hasBuff(int buffId) {
@ -957,7 +957,6 @@ static void playerTick(CNServer *serv, time_t currTime) {
auto it = plr->buffs.begin();
while(it != plr->buffs.end()) {
Buff* buff = (*it).second;
//buff->combatTick() gets called in Player::step
buff->tick(currTime);
if(buff->isStale()) {
// garbage collect