Added ON_COMBAT trigger

This commit is contained in:
Jade 2021-01-09 13:17:28 +00:00 committed by dongresource
parent 81c2a2a8b3
commit dc6de46a1f
2 changed files with 6 additions and 2 deletions

View File

@ -1731,6 +1731,10 @@ void MobManager::enterCombat(CNSocket *sock, Mob *mob) {
for (auto& pwr : MobPowers) for (auto& pwr : MobPowers)
if (pwr.skillType == NanoManager::SkillTable[skillID].skillType) if (pwr.skillType == NanoManager::SkillTable[skillID].skillType)
pwr.handle(mob, targetData, skillID, NanoManager::SkillTable[skillID].durationTime[0], NanoManager::SkillTable[skillID].powerIntensity[0]); pwr.handle(mob, targetData, skillID, NanoManager::SkillTable[skillID].durationTime[0], NanoManager::SkillTable[skillID].powerIntensity[0]);
for (NPCEvent& event : NPCManager::NPCEvents) // trigger an ON_COMBAT
if (event.trigger == ON_COMBAT && event.npcType == mob->appearanceData.iNPCType)
event.handler(sock, mob);
} }
#pragma region Mob Powers #pragma region Mob Powers

View File

@ -12,9 +12,9 @@
#define RESURRECT_HEIGHT 400 #define RESURRECT_HEIGHT 400
// placeholder; there's only one trigger type right now
enum Trigger { enum Trigger {
ON_KILLED ON_KILLED,
ON_COMBAT
}; };
typedef void (*NPCEventHandler)(CNSocket*, BaseNPC*); typedef void (*NPCEventHandler)(CNSocket*, BaseNPC*);