mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-12-23 04:10:06 +00:00
Add clearBuffs
This commit is contained in:
@@ -54,6 +54,7 @@ void Player::removeBuff(int buffId) {
|
||||
void Player::removeBuff(int buffId, int buffClass) {
|
||||
if(hasBuff(buffId)) {
|
||||
buffs[buffId]->clear((BuffClass)buffClass);
|
||||
// buff might not be stale since another buff class might remain
|
||||
if(buffs[buffId]->isStale()) {
|
||||
delete buffs[buffId];
|
||||
buffs.erase(buffId);
|
||||
@@ -61,6 +62,17 @@ void Player::removeBuff(int buffId, int buffClass) {
|
||||
}
|
||||
}
|
||||
|
||||
void Player::clearBuffs(bool force) {
|
||||
for(auto buff : buffs) {
|
||||
if(!force) {
|
||||
removeBuff(buff.first);
|
||||
} else {
|
||||
delete buff.second;
|
||||
}
|
||||
}
|
||||
buffs.clear();
|
||||
}
|
||||
|
||||
bool Player::hasBuff(int buffId) {
|
||||
auto buff = buffs.find(buffId);
|
||||
return buff != buffs.end() && !buff->second->isStale();
|
||||
@@ -176,6 +188,8 @@ void CombatNPC::removeBuff(int buffId) { /* stubbed */ }
|
||||
|
||||
void CombatNPC::removeBuff(int buffId, int buffClass) { /* stubbed */ }
|
||||
|
||||
void CombatNPC::clearBuffs(bool force) { /* stubbed */ }
|
||||
|
||||
bool CombatNPC::hasBuff(int buffId) { /* stubbed */
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user