mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-16 19:20:05 +00:00
Implement buffs for mobs
This commit is contained in:
parent
8062e52c55
commit
c70205a15b
@ -441,6 +441,7 @@ static void useAbilities(Mob *mob, time_t currTime) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO abiilities
|
||||||
static void drainMobHP(Mob *mob, int amount) {
|
static void drainMobHP(Mob *mob, int amount) {
|
||||||
size_t resplen = sizeof(sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK) + sizeof(sSkillResult_Damage);
|
size_t resplen = sizeof(sP_FE2CL_CHAR_TIME_BUFF_TIME_TICK) + sizeof(sSkillResult_Damage);
|
||||||
assert(resplen < CN_PACKET_BUFFER_SIZE - 8);
|
assert(resplen < CN_PACKET_BUFFER_SIZE - 8);
|
||||||
@ -552,7 +553,7 @@ void MobAI::combatStep(CombatNPC* npc, time_t currTime) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// drain
|
// drain TODO abilities
|
||||||
if (self->skillStyle < 0 && (self->lastDrainTime == 0 || currTime - self->lastDrainTime >= 1000)
|
if (self->skillStyle < 0 && (self->lastDrainTime == 0 || currTime - self->lastDrainTime >= 1000)
|
||||||
&& self->hasBuff(ECSB_BOUNDINGBALL)) {
|
&& self->hasBuff(ECSB_BOUNDINGBALL)) {
|
||||||
drainMobHP(self, self->maxHealth / 20); // lose 5% every second
|
drainMobHP(self, self->maxHealth / 20); // lose 5% every second
|
||||||
@ -563,10 +564,10 @@ void MobAI::combatStep(CombatNPC* npc, time_t currTime) {
|
|||||||
if (self->hp <= 0)
|
if (self->hp <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// tick buffs TODO abilities
|
// tick buffs
|
||||||
//for(auto buffEntry : self->buffs) {
|
for(auto buffEntry : self->buffs) {
|
||||||
// buffEntry.second->combatTick(currTime);
|
buffEntry.second->combatTick(currTime);
|
||||||
//}
|
}
|
||||||
|
|
||||||
// skip attack if stunned or asleep
|
// skip attack if stunned or asleep
|
||||||
if (self->hasBuff(ECSB_STUN) || self->hasBuff(ECSB_MEZ)) {
|
if (self->hasBuff(ECSB_STUN) || self->hasBuff(ECSB_MEZ)) {
|
||||||
|
@ -41,6 +41,7 @@ struct Mob : public CombatNPC {
|
|||||||
time_t lastDrainTime = 0;
|
time_t lastDrainTime = 0;
|
||||||
int skillStyle = -1; // -1 for nothing, 0-2 for corruption, -2 for eruption
|
int skillStyle = -1; // -1 for nothing, 0-2 for corruption, -2 for eruption
|
||||||
int hitX = 0, hitY = 0, hitZ = 0; // for use in ability targeting
|
int hitX = 0, hitY = 0, hitZ = 0; // for use in ability targeting
|
||||||
|
std::unordered_map<int, Buff*> buffs = {};
|
||||||
|
|
||||||
// group
|
// group
|
||||||
int groupLeader = 0;
|
int groupLeader = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user