Skip to content
Snippets Groups Projects
Commit a8276fd3 authored by echicken's avatar echicken
Browse files

Looting-related fixes.

parent b63bca4d
No related branches found
No related tags found
No related merge requests found
...@@ -416,7 +416,8 @@ var playTurn = function() { ...@@ -416,7 +416,8 @@ var playTurn = function() {
} }
} }
} }
var stockLosses = 0;
var lpi = 100 - demographics.vagrants.percentage; var lpi = 100 - demographics.vagrants.percentage;
if(Math.floor((Math.random() * 100) + 1) > lpi) { if(Math.floor((Math.random() * 100) + 1) > lpi) {
var losses = []; var losses = [];
...@@ -433,15 +434,19 @@ var playTurn = function() { ...@@ -433,15 +434,19 @@ var playTurn = function() {
var loss = Math.floor((Math.random() * (player.inventory[ingredient].quantity)) + 1); var loss = Math.floor((Math.random() * (player.inventory[ingredient].quantity)) + 1);
player.inventory[ingredient].quantity = player.inventory[ingredient].quantity - loss; player.inventory[ingredient].quantity = player.inventory[ingredient].quantity - loss;
losses.push(loss + " units of " + player.inventory[ingredient].name + " from storage"); losses.push(loss + " units of " + player.inventory[ingredient].name + " from storage");
stockLosses = stockLosses + (player.inventory[ingredient].quantity * player.inventory[ingredient].cost);
}
if(losses.length > 0) {
report.push(
[ format(
"Your shop was looted by vagrants! You lost %s.",
losses.join(", ")
),
LIGHTRED
]
);
makeStockList();
} }
report.push(
[ format(
"Your shop was looted by vagrants! You lost %s.",
losses.join(", ")
),
LIGHTRED
]
);
} }
var grossSales = 0; var grossSales = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment