Improved accuracy of off raid heal, take into account effect removal into requests count
value
This commit is contained in:
parent
3fa4c2f4c5
commit
da9cd7f7b7
@ -67,6 +67,8 @@ export class HealthController {
|
|||||||
// Get max healing from db
|
// Get max healing from db
|
||||||
const maxhp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource;
|
const maxhp = this.itemHelper.getItem(healingItemToUse._tpl)[1]._props.MaxHpResource;
|
||||||
healingItemToUse.upd.MedKit = { HpResource: maxhp - request.count }; // Subtract amout used from max
|
healingItemToUse.upd.MedKit = { HpResource: maxhp - request.count }; // Subtract amout used from max
|
||||||
|
// request.count appears to take into account healing effects removed, e.g. bleeds
|
||||||
|
// Salewa heals limb for 20 and fixes light bleed = (20+45 = 65)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resource in medkit is spent, delete it
|
// Resource in medkit is spent, delete it
|
||||||
@ -84,13 +86,8 @@ export class HealthController {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust body part hp value
|
// Get inital heal amount
|
||||||
bodyPartToHeal.Health.Current += request.count;
|
let amountToHealLimb = request.count;
|
||||||
|
|
||||||
// Ensure we've not healed beyond the limbs max hp
|
|
||||||
if (bodyPartToHeal.Health.Current > bodyPartToHeal.Health.Maximum) {
|
|
||||||
bodyPartToHeal.Health.Current = bodyPartToHeal.Health.Maximum;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if healing item removes negative effects
|
// Check if healing item removes negative effects
|
||||||
const itemRemovesEffects = Object.keys(healingItemDbDetails[1]._props.effects_damage).length > 0;
|
const itemRemovesEffects = Object.keys(healingItemDbDetails[1]._props.effects_damage).length > 0;
|
||||||
@ -110,10 +107,20 @@ export class HealthController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust limb heal amount based on if its fixing an effect (request.count is TOTAL cost of hp resource on heal item, NOT amount to heal limb)
|
||||||
|
amountToHealLimb -= matchingEffectFromHealingItem.cost ?? 0;
|
||||||
delete bodyPartToHeal.Effects[effectKey];
|
delete bodyPartToHeal.Effects[effectKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust body part hp value
|
||||||
|
bodyPartToHeal.Health.Current += amountToHealLimb;
|
||||||
|
|
||||||
|
// Ensure we've not healed beyond the limbs max hp
|
||||||
|
if (bodyPartToHeal.Health.Current > bodyPartToHeal.Health.Maximum) {
|
||||||
|
bodyPartToHeal.Health.Current = bodyPartToHeal.Health.Maximum;
|
||||||
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user