Quick fix for Fuse boss fight NPCEvent logic

Will be replaced with a proper rework immediately.
This commit is contained in:
dongresource 2023-09-10 19:24:19 +02:00 committed by gsemaj
parent eb88fa05cb
commit ba20f5a401
No known key found for this signature in database
GPG Key ID: 24B96BAA40497929
2 changed files with 20 additions and 18 deletions

View File

@ -307,19 +307,21 @@ void CombatNPC::step(time_t currTime) {
} }
void CombatNPC::transition(AIState newState, EntityRef src) { void CombatNPC::transition(AIState newState, EntityRef src) {
state = newState; state = newState;
if (transitionHandlers.find(newState) != transitionHandlers.end()) if (transitionHandlers.find(newState) != transitionHandlers.end())
transitionHandlers[newState](this, src); transitionHandlers[newState](this, src);
else { else {
std::cout << "[WARN] Transition to " << (int)state << " has no handler; going inactive" << std::endl; std::cout << "[WARN] Transition to " << (int)state << " has no handler; going inactive" << std::endl;
transition(AIState::INACTIVE, id); transition(AIState::INACTIVE, id);
} }
/* TODO: fire any triggered events
for (NPCEvent& event : NPCManager::NPCEvents) // TODO: Properly refactor this
if (event.trigger == ON_KILLED && event.npcType == type) if (newState == AIState::DEAD && src.kind == EntityKind::PLAYER) {
event.handler(src, this); for (NPCEvent& event : NPCManager::NPCEvents)
*/ if (event.trigger == ON_KILLED && event.npcType == type)
event.handler(src.sock, this);
}
} }
#pragma endregion #pragma endregion

View File

@ -306,18 +306,18 @@ static void lordFuseStageTwo(CNSocket *sock, BaseNPC *npc) {
// Fuse doesn't move // Fuse doesn't move
// Blastons, Heal // Blastons, Heal
Mob *newbody = (Mob*)NPCManager::summonNPC(oldbody->x, oldbody->y, oldbody->z, plr->instanceID, 2467); Mob *newbody = (Mob*)NPCManager::summonNPC(oldbody->x, oldbody->y, oldbody->z, oldbody->instanceID, 2467);
newbody->angle = oldbody->angle; newbody->angle = oldbody->angle;
NPCManager::updateNPCPosition(newbody->id, newbody->x, newbody->y, newbody->z, NPCManager::updateNPCPosition(newbody->id, newbody->spawnX, newbody->spawnY, newbody->spawnZ,
plr->instanceID, oldbody->angle); oldbody->instanceID, oldbody->angle);
// right arm, Adaptium, Stun // right arm, Adaptium, Stun
Mob *arm = (Mob*)NPCManager::summonNPC(oldbody->x - 600, oldbody->y, oldbody->z, plr->instanceID, 2469); Mob *arm = (Mob*)NPCManager::summonNPC(oldbody->x - 600, oldbody->y, oldbody->z, oldbody->instanceID, 2469);
arm->angle = oldbody->angle; arm->angle = oldbody->angle;
NPCManager::updateNPCPosition(arm->id, arm->x, arm->y, arm->z, NPCManager::updateNPCPosition(arm->id, arm->spawnX, arm->spawnY, arm->spawnZ,
plr->instanceID, oldbody->angle); oldbody->instanceID, oldbody->angle);
} }
// summon left arm and stage 3 body // summon left arm and stage 3 body
@ -328,18 +328,18 @@ static void lordFuseStageThree(CNSocket *sock, BaseNPC *npc) {
std::cout << "Lord Fuse stage three" << std::endl; std::cout << "Lord Fuse stage three" << std::endl;
// Cosmix, Damage Point // Cosmix, Damage Point
Mob *newbody = (Mob*)NPCManager::summonNPC(oldbody->x, oldbody->y, oldbody->z, plr->instanceID, 2468); Mob *newbody = (Mob*)NPCManager::summonNPC(oldbody->x, oldbody->y, oldbody->z, oldbody->instanceID, 2468);
newbody->angle = oldbody->angle; newbody->angle = oldbody->angle;
NPCManager::updateNPCPosition(newbody->id, newbody->x, newbody->y, newbody->z, NPCManager::updateNPCPosition(newbody->id, newbody->spawnX, newbody->spawnY, newbody->spawnZ,
plr->instanceID, oldbody->angle); newbody->instanceID, oldbody->angle);
// Blastons, Heal // Blastons, Heal
Mob *arm = (Mob*)NPCManager::summonNPC(oldbody->x + 600, oldbody->y, oldbody->z, plr->instanceID, 2470); Mob *arm = (Mob*)NPCManager::summonNPC(oldbody->x + 600, oldbody->y, oldbody->z, oldbody->instanceID, 2470);
arm->angle = oldbody->angle; arm->angle = oldbody->angle;
NPCManager::updateNPCPosition(arm->id, arm->x, arm->y, arm->z, NPCManager::updateNPCPosition(arm->id, arm->spawnX, arm->spawnY, arm->spawnZ,
plr->instanceID, oldbody->angle); arm->instanceID, oldbody->angle);
} }
std::vector<NPCEvent> NPCManager::NPCEvents = { std::vector<NPCEvent> NPCManager::NPCEvents = {