🐞 fix(通用丹): 修改通用丹消耗

This commit is contained in:
luying
2022-10-25 19:07:44 +08:00
parent 679aef6fae
commit 16831516bd

View File

@@ -86,11 +86,13 @@ export class CheckMeterial {
this.pushToNotEnoughItems(id, count - this.itemsIndb.get(id));
this.consumes.push({ id, count: this.itemsIndb.get(id) });
this.itemsIndb.set(id, 0);
return count - this.itemsIndb.get(id);
} else {
this.itemsIndb.set(id, this.itemsIndb.get(id) - count);
this.consumes.push({ id, count });
return 0
}
this.itemsIndb.set(id, this.itemsIndb.get(id) - count);
this.consumes.push({ id, count });
return 0
}
private async checkReplaceItem(id: number, count: number) {
@@ -120,6 +122,7 @@ export class CheckMeterial {
if(this.itemsIndb.get(this.goldId) < goldCost) {
this.pushToNotEnoughItems(this.goldId, goldCost - this.itemsIndb.get(this.goldId));
this.consumes.push({ id: this.goldId, count: this.itemsIndb.get(this.goldId) });
this.itemsIndb.set(this.goldId, 0);
return false;
}
this.itemsIndb.set(this.goldId, this.itemsIndb.get(this.goldId) - goldCost);
@@ -138,6 +141,7 @@ export class CheckMeterial {
if(this.itemsIndb.get(this.coinId) < coinCost) {
this.pushToNotEnoughItems(this.coinId, coinCost - this.itemsIndb.get(this.coinId));
this.consumes.push({ id: this.coinId, count: this.itemsIndb.get(this.coinId) });
this.itemsIndb.set(this.coinId, 0);
return false;
}
this.itemsIndb.set(this.coinId, this.itemsIndb.get(this.coinId) - coinCost);