;
}
interface GameWrapperState {
@@ -134,6 +136,7 @@ export default class GameWrapper extends React.Component;
default:
return Unsupported player count ({playerCount}).
diff --git a/ts/components/game/Card.tsx b/ts/components/game/Card.tsx
index f974b7a1..227e1915 100644
--- a/ts/components/game/Card.tsx
+++ b/ts/components/game/Card.tsx
@@ -12,6 +12,7 @@ interface CardProps extends EntityProps, OptionProps, React.ClassAttributes {
@@ -75,6 +76,9 @@ export default class Card extends React.Component {
if (this.props.mulligan) {
classNames.push("mulligan");
}
+ if (this.props.discarded) {
+ classNames.push("discarded");
+ }
let title = entity.cardId;
let description = null;
diff --git a/ts/components/game/Player.tsx b/ts/components/game/Player.tsx
index 063bec0e..6e37e2de 100644
--- a/ts/components/game/Player.tsx
+++ b/ts/components/game/Player.tsx
@@ -20,7 +20,7 @@ import Minion from "./Minion";
import {Zone, CardType, GameTag, ChoiceType, Mulligan, PlayState, BlockType} from "../../enums"
import {
OptionCallbackProps, CardDataProps, CardOracleProps, AssetDirectoryProps, CardArtDirectory,
- GameStateDescriptorStackProps, HideCardsProps, MulliganOracleProps
+ GameStateDescriptorStackProps, HideCardsProps, MulliganOracleProps, GameStateDiff
} from "../../interfaces";
import GameStateDescriptor from "../../state/GameStateDescriptor";
@@ -32,6 +32,7 @@ interface PlayerProps extends OptionCallbackProps, CardDataProps, CardOracleProp
choices: ChoiceList;
isTop: boolean;
isCurrent: boolean;
+ diffs?: Immutable.Set;
}
export default class Player extends React.Component {
@@ -46,7 +47,30 @@ export default class Player extends React.Component {
let activatedHeroPower = false;
let action = null;
- if(this.props.descriptors.count() > 0 && !this.props.choices) {
+
+ if (this.props.diffs && this.props.diffs.count() > 0) {
+ this.props.diffs.forEach(diff => {
+ if (diff.tag === GameTag.ZONE && diff.current === Zone.GRAVEYARD && (diff.previous === Zone.DECK || diff.previous === Zone.HAND)) {
+ let entity = this.props.entities.get(Zone.GRAVEYARD).get(diff.entity);
+ if (entity) {
+ action =
;
+ return false;
+ }
+ }
+ });
+ }
+
+ if(!action && this.props.descriptors.count() > 0 && !this.props.choices) {
this.props.descriptors.forEach((descriptor: GameStateDescriptor, index: number) => {
let outer = this.props.descriptors.get(index + 1);
let type = descriptor.type;
diff --git a/ts/components/game/TwoPlayerGame.tsx b/ts/components/game/TwoPlayerGame.tsx
index 2ca6bff8..96b31a89 100644
--- a/ts/components/game/TwoPlayerGame.tsx
+++ b/ts/components/game/TwoPlayerGame.tsx
@@ -3,7 +3,7 @@ import * as Immutable from "immutable";
import {
EntityProps, OptionCallbackProps, CardDataProps, CardOracleProps, AssetDirectoryProps,
- GameStateDescriptorStackProps, HideCardsProps, MulliganOracleProps
+ GameStateDescriptorStackProps, HideCardsProps, MulliganOracleProps, GameStateDiff
} from "../../interfaces";
import Entity from "../../Entity";
import Player from "./Player";
@@ -22,6 +22,7 @@ interface TwoPlayerGameProps extends EntityProps, CardDataProps, CardOracleProps
options: Immutable.Map>>;
choices: Immutable.Map;
endTurnOption?: Option;
+ diffs?: Immutable.Set;
}
export default class TwoPlayerGame extends React.Component {
@@ -50,6 +51,7 @@ export default class TwoPlayerGame extends React.Component
{this.props.optionCallback &&
);
diff --git a/ts/state/GameStateTracker.ts b/ts/state/GameStateTracker.ts
index 02bc116b..1dca0cf3 100644
--- a/ts/state/GameStateTracker.ts
+++ b/ts/state/GameStateTracker.ts
@@ -3,12 +3,13 @@ import * as Stream from "stream";
import GameStateMutator from "./GameStateMutator";
import PushDescriptorMutator from "./mutators/PushDescriptorMutator";
import IncrementTimeMutator from "./mutators/IncrementTimeMutator";
-import {BlockType, GameTag, MetaDataType, Step} from "../enums";
+import {BlockType, GameTag, MetaDataType, Step, Zone} from "../enums";
import PopDescriptorMutator from "./mutators/PopDescriptorMutator";
import SetChoicesMutator from "./mutators/SetChoicesMutator";
import EnrichDescriptorMutator from "./mutators/EnrichDescriptorMutator";
import SetOptionsMutator from "./mutators/SetOptionsMutator";
import TagChangeMutator from "./mutators/TagChangeMutator";
+import ShowEntityMutator from "./mutators/ShowEntityMutator";
/**
* Follows the initial game state by applying incoming mutators to the game state.
@@ -177,6 +178,17 @@ export default class GameStateTracker extends Stream.Transform {
timeStep = 1;
}
}
+ if(mutator.tag === GameTag.ZONE && mutator.value === Zone.GRAVEYARD
+ && (mutator.getPrevious() === Zone.DECK || mutator.getPrevious() === Zone.HAND)) {
+ timeStep = 2;
+ }
+ }
+
+ //discards
+ if(mutator instanceof ShowEntityMutator) {
+ if(mutator.tags.get(''+GameTag.ZONE) === Zone.GRAVEYARD) {
+ timeStep = 2;
+ }
}
// step when playable options are available
diff --git a/ts/state/mutators/TagChangeMutator.ts b/ts/state/mutators/TagChangeMutator.ts
index 5c35b46e..054d962f 100644
--- a/ts/state/mutators/TagChangeMutator.ts
+++ b/ts/state/mutators/TagChangeMutator.ts
@@ -8,6 +8,7 @@ export default class TagChangeMutator implements GameStateMutator {
public id: number;
public tag: number;
public value: number;
+ private previous: number;
constructor(id: number, tag: number, value: number) {
this.id = +id;
@@ -22,6 +23,8 @@ export default class TagChangeMutator implements GameStateMutator {
return state;
}
+ this.previous = oldEntity.getTag(this.tag);
+
let newEntity = oldEntity.setTag(this.tag, this.value);
if (newEntity === oldEntity) {
@@ -32,7 +35,7 @@ export default class TagChangeMutator implements GameStateMutator {
let diff: GameStateDiff = {
entity: this.id,
tag: this.tag,
- previous: oldEntity.getTag(this.tag),
+ previous: this.previous,
current: this.value,
};
@@ -40,4 +43,8 @@ export default class TagChangeMutator implements GameStateMutator {
.apply(new ReplaceEntityMutator(newEntity))
.apply(new AddDiffsMutator([diff]));
}
+
+ public getPrevious(): number {
+ return this.previous;
+ }
}