https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/284 Probably needs some balancing since some armors are very random, some are not at all. It feels pretty realistic I think. Any feedback is appriciated. Co-authored-by: r2go-beep <hans@hummelusa.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/193 Co-authored-by: r2go <r2go@noreply.dev.sp-tarkov.com> Co-committed-by: r2go <r2go@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
22ad266b27
commit
a87129c541
@ -672,36 +672,38 @@ export class RagfairOfferGenerator
|
|||||||
|
|
||||||
protected randomiseArmorDurabilityValues(armorWithMods: Item[]): void
|
protected randomiseArmorDurabilityValues(armorWithMods: Item[]): void
|
||||||
{
|
{
|
||||||
const childMultiplerValues = {};
|
let childMultiplerValues = {};
|
||||||
|
if (this.randomUtil.getChance100(25)) { // chance the armor is damaged
|
||||||
for (const item of armorWithMods)
|
for (const item of armorWithMods)
|
||||||
{
|
|
||||||
const itemDbDetails = this.itemHelper.getItem(item._tpl)[1];
|
|
||||||
if ((parseInt(<string>itemDbDetails._props.armorClass)) > 0)
|
|
||||||
{
|
{
|
||||||
if (!item.upd)
|
const itemDbDetails = this.itemHelper.getItem(item._tpl)[1];
|
||||||
|
if ((parseInt(<string>itemDbDetails._props.armorClass)) > 0)
|
||||||
{
|
{
|
||||||
item.upd = {};
|
if (!item.upd)
|
||||||
|
{
|
||||||
|
item.upd = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store mod types durabiltiy multiplier for later use in current/max durability value calculation
|
||||||
|
if (!childMultiplerValues[itemDbDetails._parent])
|
||||||
|
{
|
||||||
|
childMultiplerValues[itemDbDetails._parent] = this.randomUtil.getFloat(
|
||||||
|
this.ragfairConfig.dynamic.condition[itemDbDetails._parent].min,
|
||||||
|
this.ragfairConfig.dynamic.condition[itemDbDetails._parent].max,
|
||||||
|
)/this.ragfairConfig.dynamic.condition[itemDbDetails._parent].max;
|
||||||
|
}
|
||||||
|
|
||||||
|
let maxDurability = Math.round(
|
||||||
|
this.randomUtil.getFloat(itemDbDetails._props.MaxDurability * this.randomUtil.getFloat(childMultiplerValues[itemDbDetails._parent], 1), itemDbDetails._props.MaxDurability),
|
||||||
|
);
|
||||||
|
let durability = Math.round(
|
||||||
|
this.randomUtil.getFloat(maxDurability * this.randomUtil.getFloat(childMultiplerValues[itemDbDetails._parent], 1), maxDurability),
|
||||||
|
);
|
||||||
|
item.upd.Repairable = {
|
||||||
|
Durability: durability || 1,
|
||||||
|
MaxDurability: maxDurability
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store mod types durabiltiy multiplier for later use in current/max durability value calculation
|
|
||||||
if (!childMultiplerValues[itemDbDetails._parent])
|
|
||||||
{
|
|
||||||
childMultiplerValues[itemDbDetails._parent] = Math.round(this.randomUtil.getFloat(
|
|
||||||
this.ragfairConfig.dynamic.condition[itemDbDetails._parent].min,
|
|
||||||
this.ragfairConfig.dynamic.condition[itemDbDetails._parent].max,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
const maxDurability = Math.round(
|
|
||||||
this.randomUtil.getFloat(itemDbDetails._props.MaxDurability * this.randomUtil.getFloat(childMultiplerValues[itemDbDetails._parent], 1), itemDbDetails._props.MaxDurability),
|
|
||||||
);
|
|
||||||
item.upd.Repairable = {
|
|
||||||
Durability: Math.round(itemDbDetails._props.MaxDurability * childMultiplerValues[itemDbDetails._parent]) || 1,
|
|
||||||
MaxDurability: maxDurability
|
|
||||||
};
|
|
||||||
|
|
||||||
const x = 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user