mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 21:47:24 +00:00
Added check to prevent accidental sentinel passive proc (#396)
* Added check to prevent accidental sentinel passive proc Added a boolean to check if the player is at zero armor already and if so, do not trigger the passive ability. * Renamed variable and condensed armor check
This commit is contained in:
parent
fe178bf745
commit
6ba9eea993
@ -245,6 +245,9 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
|
||||
void DestroyableComponent::SetArmor(int32_t value) {
|
||||
m_DirtyHealth = true;
|
||||
|
||||
// If Destroyable Component already has zero armor do not trigger the passive ability again.
|
||||
bool hadArmor = m_iArmor > 0;
|
||||
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackArmorDelta(value - m_iArmor);
|
||||
@ -253,7 +256,7 @@ void DestroyableComponent::SetArmor(int32_t value) {
|
||||
m_iArmor = value;
|
||||
|
||||
auto* inventroyComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
if (m_iArmor == 0 && inventroyComponent != nullptr) {
|
||||
if (m_iArmor == 0 && inventroyComponent != nullptr && hadArmor) {
|
||||
inventroyComponent->TriggerPassiveAbility(PassiveAbilityTrigger::SentinelArmor);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user