Add vistor shot damage to those listed on flea/fence - 25% chance a damaged helmet can have a visor with bullet hits
Improved `FenceService.addModsToArmorModSlots()` to not break when it cant find a default plate tpl
This commit is contained in:
parent
8b355adfa6
commit
72fdada5d7
@ -589,13 +589,28 @@ export class RagfairOfferGenerator
|
||||
if (this.itemHelper.armorItemCanHoldMods(rootItem._tpl))
|
||||
{
|
||||
// Chance to not adjust armor
|
||||
if (!this.randomUtil.getChance100(this.ragfairConfig.dynamic.condition[BaseClasses.ARMORED_EQUIPMENT]))
|
||||
if (!this.randomUtil.getChance100(this.ragfairConfig.dynamic.condition[BaseClasses.ARMORED_EQUIPMENT].conditionChance * 100))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.randomiseArmorDurabilityValues(itemWithMods);
|
||||
|
||||
// Add hits to visor
|
||||
const visorMod = itemWithMods.find(item => item.parentId === BaseClasses.ARMORED_EQUIPMENT && item.slotId === "mod_equipment_000");
|
||||
if (this.randomUtil.getChance100(25)
|
||||
&& visorMod)
|
||||
{
|
||||
if (!visorMod.upd)
|
||||
{
|
||||
visorMod.upd = {};
|
||||
}
|
||||
|
||||
visorMod.upd.FaceShield = {
|
||||
Hits: this.randomUtil.getInt(1,3)
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -516,9 +516,16 @@ export class FenceService
|
||||
{
|
||||
const modItemDbDetails = this.itemHelper.getItem(requiredSlot._props.filters[0].Plate)[1];
|
||||
const durabilityValues = this.getRandomisedArmorDurabilityValues(modItemDbDetails, this.traderConfig.fence.armorMaxDurabilityPercentMinMax);
|
||||
armor.push({
|
||||
const plateTpl = requiredSlot._props.filters[0].Plate; // `Plate` property appears to be the 'default' item for slot
|
||||
if (plateTpl === "")
|
||||
{
|
||||
// Some bsg plate properties are empty, skip mod
|
||||
continue;
|
||||
}
|
||||
|
||||
const mod: Item = {
|
||||
_id: this.hashUtil.generate(),
|
||||
_tpl: requiredSlot._props.filters[0].Plate, // `Plate` property appears to be the 'default' item for slot
|
||||
_tpl: plateTpl,
|
||||
parentId: armor[0]._id,
|
||||
slotId: requiredSlot._name,
|
||||
upd: {
|
||||
@ -527,7 +534,19 @@ export class FenceService
|
||||
MaxDurability: durabilityValues.MaxDurability
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 25% chance to add shots to visor when its below max durability
|
||||
if (this.randomUtil.getChance100(25)
|
||||
&& mod.parentId === BaseClasses.ARMORED_EQUIPMENT && mod.slotId === "mod_equipment_000"
|
||||
&& mod.upd.Repairable.Durability < modItemDbDetails._props.MaxDurability)
|
||||
{
|
||||
mod.upd.FaceShield = {
|
||||
Hits: this.randomUtil.getInt(1,3)
|
||||
}
|
||||
}
|
||||
|
||||
armor.push(mod);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user