Gang bug fixes. Issues #574 and #575

This commit is contained in:
danielyxie 2019-04-13 00:26:49 -07:00
parent 221b81d802
commit 8d33c5b571
3 changed files with 27 additions and 19 deletions

@ -275,16 +275,9 @@ export let CONSTANTS: IMap<any> = {
LatestUpdate:
`
v0.46.1
* Added a very rudimentary directory system to the Terminal
** Details here: https://bitburner.readthedocs.io/en/latest/basicgameplay/terminal.html#filesystem-directories
* Added numHashes(), hashCost(), and spendHashes() functions to the Netscript Hacknet Node API
* 'Generate Coding Contract' hash upgrade is now more expensive
* 'Generate Coding Contract' hash upgrade now generates the contract randomly on the server, rather than on home computer
* The cost of selling hashes for money no longer increases each time
* Selling hashes for money now costs 4 hashes (in exchange for $1m)
* Bug Fix: Hacknet Node earnings should work properly when game is inactive/offline
* Bug Fix: Duplicate Sleeve augmentations are now properly reset when switching to a new BitNode
v0.46.2
* Gang changes:
** Bug Fix: Gangs can no longer clash with themselve
** Bug Fix: Winning against another gang should properly reduce their power
`
}

@ -74,8 +74,16 @@ $(document).mousedown(function(event) {
}
});
let GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
"NiteSec", "The Black Hand"];
const GangNames = [
"Slum Snakes",
"Tetrads",
"The Syndicate",
"The Dark Army",
"Speakers for the Dead",
"NiteSec",
"The Black Hand"
];
export let AllGangs = {
"Slum Snakes" : {
power: 1,
@ -299,9 +307,9 @@ Gang.prototype.processTerritoryAndPowerGains = function(numCycles=1) {
}
// Then process territory
for (var i = 0; i < GangNames.length; ++i) {
for (let i = 0; i < GangNames.length; ++i) {
const others = GangNames.filter((e) => {
return e !== i;
return e !== GangNames[i];
});
const other = getRandomInt(0, others.length - 1);
@ -326,6 +334,7 @@ Gang.prototype.processTerritoryAndPowerGains = function(numCycles=1) {
AllGangs[otherGang].territory -= 0.0001;
if (thisGang === gangName) {
this.clash(true); // Player won
AllGangs[otherGang].power *= (1 / 1.01);
} else if (otherGang === gangName) {
this.clash(false); // Player lost
} else {
@ -341,6 +350,7 @@ Gang.prototype.processTerritoryAndPowerGains = function(numCycles=1) {
this.clash(false); // Player lost
} else if (otherGang === gangName) {
this.clash(true); // Player won
AllGangs[thisGang].power *= (1 / 1.01);
} else {
AllGangs[thisGang].power *= (1 / 1.01);
}

@ -1,7 +1,11 @@
/* Pop up Dialog Box */
/**
* Create and display a pop-up dialog box.
* This dialog box does not allow for any interaction and should close when clicking
* outside of it
*/
let dialogBoxes = [];
//Close dialog box when clicking outside
// Close dialog box when clicking outside
$(document).click(function(event) {
if (dialogBoxOpened && dialogBoxes.length >= 1) {
if (!$(event.target).closest(dialogBoxes[0]).length){
@ -17,7 +21,7 @@ $(document).click(function(event) {
});
//Dialog box close buttons
// Dialog box close buttons
$(document).on('click', '.dialog-box-close-button', function( event ) {
if (dialogBoxOpened && dialogBoxes.length >= 1) {
dialogBoxes[0].remove();
@ -30,9 +34,10 @@ $(document).on('click', '.dialog-box-close-button', function( event ) {
}
});
var dialogBoxOpened = false;
let dialogBoxOpened = false;
function dialogBoxCreate(txt, preformatted=false) {
console.log(`dialogBoxCreate() called`)
var container = document.createElement("div");
container.setAttribute("class", "dialog-box-container");