Skip to content

Commit

Permalink
Merge pull request #286 from Ido-Barnea/285-item-resources-are-added-…
Browse files Browse the repository at this point in the history
…to-inventory-despite-not-having-enough-money

Fixed item resource being added despite not having enough money
  • Loading branch information
Ido-Barnea authored Apr 20, 2024
2 parents e94280b + 34b69ec commit 491ae80
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion core/development/LogicAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { Square } from './logic/pieces/types/Square';
import { Unicorn } from './logic/pieces/Unicorn';
import { KillPieceByFallingOffTheBoardAction } from './logic/actions/KillPieceByFallingOffTheBoardAction';
import { KillPieceByPieceAction } from './logic/actions/KillPieceByPieceAction';
import { ShopActionResult } from './logic/shop/types/ShopActionResult';

export function renderScreen() {
renderPlayersInformation();
Expand Down Expand Up @@ -422,7 +423,7 @@ export function buyItem(itemId: string) {
const item = getShopItemById(itemId);
const currentPlayer = game.getPlayersTurnSwitcher().getCurrentPlayer();

if (shop.buyItem(item, currentPlayer)) {
if (shop.buyItem(item, currentPlayer) === ShopActionResult.SUCCESS) {
showItemOnInventory(item, currentPlayer.color);
}

Expand Down
4 changes: 2 additions & 2 deletions core/development/logic/actions/types/ActionResult.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum ActionResult {
SUCCESS,
FAILURE,
FAILURE = 0,
SUCCESS = 1,
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum InventoryActionResult {
SUCCESS,
FAILURE,
FAILURE = 0,
SUCCESS = 1,
}
4 changes: 2 additions & 2 deletions core/development/logic/items/types/ItemActionResult.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum ItemActionResult {
SUCCESS,
FAILURE,
FAILURE = 0,
SUCCESS = 1,
}
4 changes: 2 additions & 2 deletions core/development/logic/shop/types/ShopActionResult.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum ShopActionResult {
SUCCESS,
FAILURE,
FAILURE = 0,
SUCCESS = 1,
}

0 comments on commit 491ae80

Please sign in to comment.