mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +08:00
Merge branch 'pr/193'
This commit is contained in:
+12
-8
@@ -142,7 +142,7 @@ var StateManager = {
|
|||||||
if($SM.get(parentName) == undefined) $SM.set(parentName, {}, true);
|
if($SM.get(parentName) == undefined) $SM.set(parentName, {}, true);
|
||||||
|
|
||||||
for(var k in list){
|
for(var k in list){
|
||||||
if(!$SM.add(parentName+'["'+k+'"]', list[k], true)) err++;
|
if($SM.add(parentName+'["'+k+'"]', list[k], true)) err++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!noEvent) {
|
if(!noEvent) {
|
||||||
@@ -346,12 +346,16 @@ var StateManager = {
|
|||||||
|
|
||||||
var cost = income.stores;
|
var cost = income.stores;
|
||||||
var ok = true;
|
var ok = true;
|
||||||
for(var k in cost) {
|
if (source != 'thieves') {
|
||||||
var have = $SM.get('stores["'+k+'"]', true);
|
for (var k in cost) {
|
||||||
if(have + cost[k] < 0) {
|
var have = $SM.get('stores["' + k + '"]', true);
|
||||||
if(source != 'thieves') ok = false;
|
if (have + cost[k] < 0) {
|
||||||
}
|
ok = false;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(ok){
|
if(ok){
|
||||||
$SM.addM('stores', income.stores, true);
|
$SM.addM('stores', income.stores, true);
|
||||||
}
|
}
|
||||||
@@ -372,7 +376,7 @@ var StateManager = {
|
|||||||
addStolen: function(stores) {
|
addStolen: function(stores) {
|
||||||
for(var k in stores) {
|
for(var k in stores) {
|
||||||
var old = $SM.get('stores["'+k+'"]', true);
|
var old = $SM.get('stores["'+k+'"]', true);
|
||||||
var short = old - stores[k];
|
var short = old + stores[k];
|
||||||
//if they would steal more than actually owned
|
//if they would steal more than actually owned
|
||||||
if(short < 0){
|
if(short < 0){
|
||||||
$SM.add('game.stolen["'+k+'"]', (stores[k] * -1) + short);
|
$SM.add('game.stolen["'+k+'"]', (stores[k] * -1) + short);
|
||||||
|
|||||||
Reference in New Issue
Block a user