mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
Merge pull request #1781 from danielyxie/dev
gang with 0 territory cannot fight
This commit is contained in:
commit
c2b58ffcce
24
dist/vendor.bundle.js
vendored
24
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -190,13 +190,15 @@ export class Gang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Then process territory
|
// Then process territory
|
||||||
for (let i = 0; i < GangConstants.Names.length; ++i) {
|
const gangs = GangConstants.Names.filter((g) => AllGangs[g].territory > 0);
|
||||||
const others = GangConstants.Names.filter((e) => {
|
if (gangs.length > 1) {
|
||||||
return e !== GangConstants.Names[i];
|
for (let i = 0; i < gangs.length; ++i) {
|
||||||
|
const others = gangs.filter((e) => {
|
||||||
|
return e !== gangs[i];
|
||||||
});
|
});
|
||||||
const other = getRandomInt(0, others.length - 1);
|
const other = getRandomInt(0, others.length - 1);
|
||||||
|
|
||||||
const thisGang = GangConstants.Names[i];
|
const thisGang = gangs[i];
|
||||||
const otherGang = others[other];
|
const otherGang = others[other];
|
||||||
|
|
||||||
// If either of the gangs involved in this clash is the player, determine
|
// If either of the gangs involved in this clash is the player, determine
|
||||||
@ -210,7 +212,10 @@ export class Gang {
|
|||||||
const thisChance = thisPwr / (thisPwr + otherPwr);
|
const thisChance = thisPwr / (thisPwr + otherPwr);
|
||||||
|
|
||||||
function calculateTerritoryGain(winGang: string, loseGang: string): number {
|
function calculateTerritoryGain(winGang: string, loseGang: string): number {
|
||||||
const powerBonus = Math.max(1, 1 + Math.log(AllGangs[winGang].power / AllGangs[loseGang].power) / Math.log(50));
|
const powerBonus = Math.max(
|
||||||
|
1,
|
||||||
|
1 + Math.log(AllGangs[winGang].power / AllGangs[loseGang].power) / Math.log(50),
|
||||||
|
);
|
||||||
const gains = Math.min(AllGangs[loseGang].territory, powerBonus * 0.0001 * (Math.random() + 0.5));
|
const gains = Math.min(AllGangs[loseGang].territory, powerBonus * 0.0001 * (Math.random() + 0.5));
|
||||||
return gains;
|
return gains;
|
||||||
}
|
}
|
||||||
@ -244,6 +249,7 @@ export class Gang {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processExperienceGains(numCycles = 1): void {
|
processExperienceGains(numCycles = 1): void {
|
||||||
for (let i = 0; i < this.members.length; ++i) {
|
for (let i = 0; i < this.members.length; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user