mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-18 01:35:27 +00:00
fix(destroyable): damage reductions add up, as the client
The damage reduction behavior set the reduction to its amount and back to 0 when it ended, so a second reduction replaced the first and ending either removed both. The client's behavior sends AddDamageReduction (DamageReductionBehavior::Cast) and the destroyable adds it to the current reduction; removing takes off that amount, never below 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,8 @@ void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
return;
|
||||
}
|
||||
|
||||
destroyable->SetDamageReduction(m_ReductionAmount);
|
||||
// DamageReductionBehavior::Cast (0x004fdbb0) sends AddDamageReduction: it adds to any other reduction
|
||||
destroyable->AddDamageReduction(m_ReductionAmount);
|
||||
|
||||
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
|
||||
}
|
||||
@@ -46,7 +47,7 @@ void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchCont
|
||||
return;
|
||||
}
|
||||
|
||||
destroyable->SetDamageReduction(0);
|
||||
destroyable->RemoveDamageReduction(m_ReductionAmount);
|
||||
}
|
||||
|
||||
void DamageReductionBehavior::Load() {
|
||||
|
||||
Reference in New Issue
Block a user