Skip to content

Commit

Permalink
Misc text fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
zernie committed Jan 10, 2020
1 parent 7154a13 commit 23c8a62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ import * as ReactDOM from "react-dom";
import App from "./UI/App";
import { Provider } from "react-redux";
import configureStore from "./redux/configureStore";
// import { getPlayerHero } from "./Hero";
// import { gainMana, restoreMana } from './UI/Play/actions';
// import { Game, getBoard, getDeck, getHand } from '../Game';

const store = configureStore();
// TODO: refactor
// const playerID = getPlayerHero(store.getState() as Game);
// store.dispatch(gainMana({ id: playerID.id }));
// store.dispatch(restoreMana({ id: playerID.id }));

ReactDOM.render(
<Provider store={store}>
Expand Down
13 changes: 7 additions & 6 deletions src/redux/modules/gameStateReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import _ from "lodash/fp";
import { createAction, createReducer } from "@reduxjs/toolkit";
import {
AppThunk,
selectCards,
State,
Step,
MAX_CARDS_IN_HAND,
getActivePlayer,
getOpponent,
getPlayer,
hasLost,
MAX_CARDS_IN_HAND,
otherId,
selectCards,
State,
Step
} from "../../models";
import { burnCard, drawCard } from "./deckReducer";
import {
Expand Down Expand Up @@ -49,6 +49,7 @@ export const endTurn = (): AppThunk => (dispatch, getState) => {
dispatch(nextTurn());
const game = getState();
const player = getActivePlayer(game);
Toastr.info(`${player.name}'s turn!`);
const { id } = player;

dispatch(gainMana({ id }));
Expand All @@ -60,13 +61,13 @@ export const endTurn = (): AppThunk => (dispatch, getState) => {
if (deck.length > 0) {
const topCard = deck[0];
if (hand.length === MAX_CARDS_IN_HAND) {
Toastr.error(`Cant draw more cards from the deck for ${player.name}!`);
Toastr.error(`Cant draw more cards in the ${player.name}'s deck!`);
dispatch(burnCard({ id: topCard.id }));
} else {
dispatch(drawCard(topCard));
}
} else {
Toastr.error(`No more cards in the deck for ${player.name}!`);
Toastr.error(`No more cards in the ${player.name}'s deck!`);

dispatch(fatigueDamage({ id: player.id, heroId: player.heroID as number }));
}
Expand Down

0 comments on commit 23c8a62

Please sign in to comment.