Skip to content

Commit

Permalink
[fixed] Certain combat log messages not being sent when a target has …
Browse files Browse the repository at this point in the history
…100% resistance to a damage type

[changed] method to prevent player peacing out of combat at improper times

Change-Id: If23242126c9089b6afccd8debd0072586a44afa4
  • Loading branch information
Hakry committed Sep 7, 2021
1 parent 50b0cbe commit 99232cf
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions MMOCoreORB/src/server/zone/managers/combat/CombatManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
* Each Attacker has their Defender List stored on their Object.
* Peace will clear a Object's defender list, but they will not be able to exit Combat if checks are not passed.
*
*
*/

// Sets attackers mainDefender and puts both in combat
Expand Down Expand Up @@ -131,6 +130,11 @@ bool CombatManager::attemptPeace(CreatureObject* attacker) const {
ThreatMap* threatMap = attacker->getThreatMap();

if (threatMap != nullptr) {
if (threatMap->size() == 0) {
attacker->clearCombatState(false);
return true;
}

for (int i = 0; i < threatMap->size(); i++) {
TangibleObject* threatTano = threatMap->elementAt(i).getKey();

Expand All @@ -139,16 +143,11 @@ bool CombatManager::attemptPeace(CreatureObject* attacker) const {
}

if (attacker->isInRange(threatTano, 128.f) && threatTano->getMainDefender() == attacker) {
continue;
return true;
}

attacker->clearCombatState(false);
threatMap->removeAll();
}

if (threatMap->size() == 0) {
attacker->clearCombatState(false);
}
attacker->clearCombatState(false);
}
return true;
}
Expand Down Expand Up @@ -251,25 +250,23 @@ int CombatManager::doCombatAction(CreatureObject* attacker, WeaponObject* weapon
}
}

if (damage > 0 || data.isStateOnlyAttack()) {
if (damage > 0) {
attacker->updateLastSuccessfulCombatAction();

if (attacker->isPlayerCreature() && data.getCommandCRC() != STRING_HASHCODE("attack")) {
weapon->decay(attacker);
}
if (damage > 0) {
attacker->updateLastSuccessfulCombatAction();

// Decreases the powerup once per successful attack
if (!data.isForceAttack()) {
weapon->decreasePowerupUses(attacker);
}
if (attacker->isPlayerCreature() && data.getCommandCRC() != STRING_HASHCODE("attack")) {
weapon->decay(attacker);
}

// Broadcast CombatSpam and CombatAction packets now that the attack is complete
finalCombatSpam(attacker, weapon, targetDefenders, data);
broadcastCombatAction(attacker, weapon, targetDefenders, data);
// Decreases the powerup once per successful attack
if (!data.isForceAttack()) {
weapon->decreasePowerupUses(attacker);
}
}

// Broadcast CombatSpam and CombatAction packets now that the attack is complete
finalCombatSpam(attacker, weapon, targetDefenders, data);
broadcastCombatAction(attacker, weapon, targetDefenders, data);

// Update PvP TEF Duration
if (shouldGcwCrackdownTef || shouldGcwTef || shouldBhTef) {
ManagedReference<CreatureObject*> attackingCreature = nullptr;
Expand Down

0 comments on commit 99232cf

Please sign in to comment.