@cardcore/client
Advanced tools
Comparing version 0.0.1-3ec581c3 to 0.0.1-4a0572cd
@@ -95,3 +95,3 @@ "use strict"; | ||
var CLIENT_PLAY_CREATURE = exports.CLIENT_PLAY_CREATURE = "CLIENT_PLAY_CREATURE"; | ||
var clientPlayCreature = exports.clientPlayCreature = function clientPlayCreature(card) { | ||
var clientPlayCreature = exports.clientPlayCreature = function clientPlayCreature(boxId) { | ||
return function () { | ||
@@ -105,8 +105,8 @@ var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(dispatch, getState) { | ||
state = getState(); | ||
unitId = (0, _util.traverseSecret)(card, state.secret); | ||
unit = getState().game.units[unitId]; | ||
unitId = _util.Box.traverse(boxId, state.game.boxes, state.client.keys); | ||
unit = state.game.units[unitId]; | ||
_context.next = 5; | ||
return dispatch({ | ||
type: CLIENT_PLAY_CREATURE, | ||
card: card, | ||
boxId: boxId, | ||
unit: unit | ||
@@ -159,8 +159,4 @@ }); | ||
return function (dispatch, getState) { | ||
var _getState$client = getState().client, | ||
playingCard = _getState$client.playingCard, | ||
targets = _getState$client.targets; | ||
var privateKey = getState().secret[playingCard.id].private; | ||
dispatch((0, _game.playCreature)({ id: playingCard.id, privateKey: privateKey, targets: targets })); | ||
var boxId = getState().client.playingBoxId; | ||
dispatch((0, _game.playCard)({ boxId: boxId })); | ||
}; | ||
@@ -167,0 +163,0 @@ }; |
@@ -25,3 +25,3 @@ "use strict"; | ||
desyncStates: {}, | ||
playingCard: null, | ||
playingBoxId: null, | ||
targetQueue: [], | ||
@@ -52,3 +52,3 @@ targets: [], | ||
}), | ||
playingCard: action.card | ||
playingBoxId: action.boxId | ||
}); | ||
@@ -62,3 +62,3 @@ } | ||
availableTargets: null, | ||
playingCard: null | ||
playingBoxId: null | ||
}); | ||
@@ -65,0 +65,0 @@ } |
{ | ||
"name": "@cardcore/client", | ||
"version": "0.0.1-3ec581c3", | ||
"version": "0.0.1-4a0572cd", | ||
"description": "streamcards client", | ||
@@ -16,3 +16,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "3ec581c3f6f424e67d96dac06f7bcf5f3eb6f200" | ||
"gitHead": "4a0572cd286ae86d011a80c5b81ac8fcfe50072b" | ||
} |
@@ -1,3 +0,3 @@ | ||
import { playCreature } from "@cardcore/game"; | ||
import { traverseSecret, target as targetHelper } from "@cardcore/util"; | ||
import { playCard } from "@cardcore/game"; | ||
import { Box, target as targetHelper } from "@cardcore/util"; | ||
import ssbKeys from "@streamplace/ssb-keys"; | ||
@@ -60,9 +60,9 @@ | ||
export const CLIENT_PLAY_CREATURE = "CLIENT_PLAY_CREATURE"; | ||
export const clientPlayCreature = card => async (dispatch, getState) => { | ||
export const clientPlayCreature = boxId => async (dispatch, getState) => { | ||
const state = getState(); | ||
const unitId = traverseSecret(card, state.secret); | ||
const unit = getState().game.units[unitId]; | ||
const unitId = Box.traverse(boxId, state.game.boxes, state.client.keys); | ||
const unit = state.game.units[unitId]; | ||
await dispatch({ | ||
type: CLIENT_PLAY_CREATURE, | ||
card, | ||
boxId, | ||
unit | ||
@@ -79,5 +79,4 @@ }); | ||
export const clientPlayCreatureDone = () => (dispatch, getState) => { | ||
const { playingCard, targets } = getState().client; | ||
const privateKey = getState().secret[playingCard.id].private; | ||
dispatch(playCreature({ id: playingCard.id, privateKey, targets })); | ||
const boxId = getState().client.playingBoxId; | ||
dispatch(playCard({ boxId })); | ||
}; | ||
@@ -84,0 +83,0 @@ |
@@ -7,3 +7,3 @@ import * as actions from "@cardcore/game"; | ||
desyncStates: {}, | ||
playingCard: null, | ||
playingBoxId: null, | ||
targetQueue: [], | ||
@@ -31,3 +31,3 @@ targets: [], | ||
targetQueue: action.unit.onSummon.map(onSummon => onSummon.target), | ||
playingCard: action.card | ||
playingBoxId: action.boxId | ||
}; | ||
@@ -42,3 +42,3 @@ } | ||
availableTargets: null, | ||
playingCard: null | ||
playingBoxId: null | ||
}; | ||
@@ -45,0 +45,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51640
860