Improvements to calculateFenceStandingChangeFromKillsAsScav()
- should properly handle additional rep loss when over 6 fence rep
This commit is contained in:
parent
a1a68b4282
commit
da6244e1ac
@ -487,7 +487,7 @@ export class InraidController
|
|||||||
|
|
||||||
let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
|
let fenceStanding = Number(pmcData.TradersInfo[fenceId].standing);
|
||||||
this.logger.debug(`pre-raid fence standing: ${fenceStanding}`);
|
this.logger.debug(`pre-raid fence standing: ${fenceStanding}`);
|
||||||
fenceStanding = this.inRaidHelper.calculateFenceStandingChangeFromKills(
|
fenceStanding = this.inRaidHelper.calculateFenceStandingChangeFromKillsAsScav(
|
||||||
fenceStanding,
|
fenceStanding,
|
||||||
offraidData.profile.Stats.Eft.Victims,
|
offraidData.profile.Stats.Eft.Victims,
|
||||||
);
|
);
|
||||||
|
@ -88,45 +88,44 @@ export class InRaidHelper
|
|||||||
* @param victims Array of kills player performed
|
* @param victims Array of kills player performed
|
||||||
* @returns adjusted karma level after kills are taken into account
|
* @returns adjusted karma level after kills are taken into account
|
||||||
*/
|
*/
|
||||||
public calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number
|
public calculateFenceStandingChangeFromKillsAsScav(existingFenceStanding: number, victims: Victim[]): number
|
||||||
{
|
{
|
||||||
// Run callback on every victim, adding up the standings gained/lossed, starting value is existing fence standing
|
// Run callback on every victim, adding up the standings gained/lossed, starting value is existing fence standing
|
||||||
const newFenceStanding = victims.reduce((acc, victim) =>
|
let fenceStanding = existingFenceStanding;
|
||||||
|
for (const victim of victims)
|
||||||
{
|
{
|
||||||
const standingForKill = this.getFenceStandingChangeForKillAsScav(victim);
|
const standingChangeForKill = this.getFenceStandingChangeForKillAsScav(victim);
|
||||||
|
const additionalLossForKill = this.getAdditionalLossForKill(fenceStanding, standingChangeForKill);
|
||||||
|
|
||||||
let additionalReduction = 0;
|
this.logger.warning(`rep change: ${standingChangeForKill} - additional: ${additionalLossForKill}`);
|
||||||
|
fenceStanding += standingChangeForKill + additionalLossForKill;
|
||||||
|
}
|
||||||
|
|
||||||
// Only subtract (up to) 2 reputation on penalties, not on rewards
|
return fenceStanding;
|
||||||
if (standingForKill < 0)
|
}
|
||||||
{
|
|
||||||
if (acc >= 6 && acc <= 8)
|
|
||||||
{
|
|
||||||
// Reset fence rep to 6 before subtracting penalty
|
|
||||||
additionalReduction = acc - 6.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
additionalReduction = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (standingForKill)
|
protected getAdditionalLossForKill(fenceStanding: number, repChangeForKill: number): number
|
||||||
{
|
{
|
||||||
this.logger.warning(`Lost: ${standingForKill} - additional:${additionalReduction}`);
|
// No loss for kill, skip
|
||||||
return (acc + standingForKill) - additionalReduction;
|
if (repChangeForKill >= 0)
|
||||||
}
|
{
|
||||||
this.logger.warning(
|
return 0;
|
||||||
this.localisationService.getText("inraid-missing_standing_for_kill", {
|
}
|
||||||
victimSide: victim.Side,
|
|
||||||
victimRole: victim.Role,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
return acc;
|
// Over 8, big penalty
|
||||||
}, existingFenceStanding);
|
if (fenceStanding > 8)
|
||||||
|
{
|
||||||
|
return -2.0;
|
||||||
|
}
|
||||||
|
|
||||||
return newFenceStanding;
|
// Fence rep is between 6 and 8, appy additional penalty
|
||||||
|
if (fenceStanding >= 6)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No additional penalty
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user