Fix fuel ticks returning fuel to the player instead of removing it (!397)
Resolves the issue of incorrect fuel usage by using relative percentages for both the profile bonus and hideout management bonus Add a sanity check to make sure we never return fuel to the player (No negative fuel consumption)
This commit is contained in:
parent
79f0949610
commit
bd5d4bfb66
@ -425,13 +425,19 @@ export class HideoutHelper {
|
|||||||
BonusType.FUEL_CONSUMPTION,
|
BonusType.FUEL_CONSUMPTION,
|
||||||
);
|
);
|
||||||
|
|
||||||
// 0 to 1
|
// An increase in "bonus" consumption is actually an increase in consumption, so invert this for later use
|
||||||
const fuelConsumptionBonusMultipler = (profileFuelConsomptionBonusSum + 100) / 100;
|
const fuelConsumptionBonusRate = -(profileFuelConsomptionBonusSum / 100);
|
||||||
|
|
||||||
// 0 to 1
|
// An increase in hideout management bonus is a decrease in consumption
|
||||||
const hideoutManagementConsumptionBonusMultipler = this.getHideoutManagementConsumptionBonus(pmcData);
|
const hideoutManagementConsumptionBonusRate = this.getHideoutManagementConsumptionBonus(pmcData);
|
||||||
|
|
||||||
|
let combinedBonus = 1.0 - (fuelConsumptionBonusRate + hideoutManagementConsumptionBonusRate);
|
||||||
|
|
||||||
|
// Sanity check, never let fuel consumption go negative, otherwise it returns fuel to the player
|
||||||
|
if (combinedBonus < 0) {
|
||||||
|
combinedBonus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
const combinedBonus = 1.0 - (fuelConsumptionBonusMultipler + hideoutManagementConsumptionBonusMultipler);
|
|
||||||
fuelUsedSinceLastTick *= combinedBonus;
|
fuelUsedSinceLastTick *= combinedBonus;
|
||||||
|
|
||||||
let hasFuelRemaining = false;
|
let hasFuelRemaining = false;
|
||||||
|
@ -144,7 +144,9 @@ export class InsuranceService {
|
|||||||
pmcData,
|
pmcData,
|
||||||
BonusType.INSURANCE_RETURN_TIME,
|
BonusType.INSURANCE_RETURN_TIME,
|
||||||
);
|
);
|
||||||
const insuranceReturnTimeBonusPercent = 1.0 - (insuranceReturnTimeBonusSum + 100) / 100;
|
|
||||||
|
// A negative bonus implies a faster return, since we subtract later, invert the value here
|
||||||
|
const insuranceReturnTimeBonusPercent = -(insuranceReturnTimeBonusSum / 100);
|
||||||
|
|
||||||
const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS;
|
const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS;
|
||||||
const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS;
|
const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS;
|
||||||
@ -168,8 +170,9 @@ export class InsuranceService {
|
|||||||
randomisedReturnTimeSeconds *= editionModifier.multiplier;
|
randomisedReturnTimeSeconds *= editionModifier.multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current time + randomised time calculated above
|
// Calculate the final return time based on our bonus percent
|
||||||
return this.timeUtil.getTimestamp() + randomisedReturnTimeSeconds * insuranceReturnTimeBonusPercent;
|
const finalReturnTimeSeconds = randomisedReturnTimeSeconds * (1.0 - insuranceReturnTimeBonusPercent);
|
||||||
|
return this.timeUtil.getTimestamp() + finalReturnTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,8 @@ export class RagfairTaxService {
|
|||||||
pmcData,
|
pmcData,
|
||||||
BonusType.RAGFAIR_COMMISSION,
|
BonusType.RAGFAIR_COMMISSION,
|
||||||
);
|
);
|
||||||
const taxDiscountPercent = (hideoutFleaTaxDiscountBonusSum + 100) / 100.0;
|
// A negative bonus implies a lower discount, since we subtract later, invert the value here
|
||||||
|
const taxDiscountPercent = -(hideoutFleaTaxDiscountBonusSum / 100.0);
|
||||||
|
|
||||||
const tax =
|
const tax =
|
||||||
itemWorth * itemTaxMult * itemPriceMult + requirementsPrice * requirementTaxMult * requirementPriceMult;
|
itemWorth * itemTaxMult * itemPriceMult + requirementsPrice * requirementTaxMult * requirementPriceMult;
|
||||||
|
Loading…
Reference in New Issue
Block a user