game phase targeting tutorial, clear arrows on game finish

This commit is contained in:
Mashy 2019-10-28 08:44:37 +10:00
parent 200482dd79
commit 4cf378f644
4 changed files with 29 additions and 11 deletions

View File

@ -51,6 +51,7 @@ export const setTeamPage = value => ({ type: 'SET_TEAM_PAGE', value });
export const setTeamSelect = value => ({ type: 'SET_TEAM_SELECT', value: Array.from(value) }); export const setTeamSelect = value => ({ type: 'SET_TEAM_SELECT', value: Array.from(value) });
export const setTutorial = value => ({ type: 'SET_TUTORIAL', value }); export const setTutorial = value => ({ type: 'SET_TUTORIAL', value });
export const setTutorialGame = value => ({ type: 'SET_TUTORIAL_GAME', value });
export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value }); export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value });
export const setVboxSelected = value => ({ type: 'SET_VBOX_SELECTED', value }); export const setVboxSelected = value => ({ type: 'SET_VBOX_SELECTED', value });

View File

@ -24,6 +24,7 @@ const addState = connect(
animText, animText,
gameSkillInfo, gameSkillInfo,
itemInfo, itemInfo,
tutorialGame,
} = state; } = state;
function selectSkillTarget(targetConstructId) { function selectSkillTarget(targetConstructId) {
@ -33,10 +34,6 @@ const addState = connect(
return false; return false;
} }
// intercept self casting skills
if (activeSkill && activeSkill.skill.self_targeting) {
ws.sendGameSkill(game.id, activeSkill.constructId, null, activeSkill.skill.skill);
}
return { return {
game, game,
account, account,
@ -47,6 +44,7 @@ const addState = connect(
selectSkillTarget, selectSkillTarget,
gameSkillInfo, gameSkillInfo,
itemInfo, itemInfo,
tutorialGame,
}; };
}, },
@ -55,7 +53,11 @@ const addState = connect(
dispatch(actions.setGameEffectInfo(info)); dispatch(actions.setGameEffectInfo(info));
} }
return { setGameEffectInfo }; function setTutorialGameClear(activeSkill, tutorialGame) {
if (activeSkill && tutorialGame) dispatch(actions.setTutorialGame(null));
}
return { setGameEffectInfo, setTutorialGameClear };
} }
); );
@ -93,7 +95,8 @@ class GameConstruct extends Component {
selectSkillTarget, selectSkillTarget,
animFocus, animFocus,
animText, animText,
tutorialGame,
setTutorialGameClear,
setGameEffectInfo, setGameEffectInfo,
gameSkillInfo, gameSkillInfo,
itemInfo, itemInfo,
@ -146,7 +149,10 @@ class GameConstruct extends Component {
return ( return (
<div <div
onClick={() => selectSkillTarget(construct.id)} onClick={() => {
selectSkillTarget(construct.id);
setTutorialGameClear(activeSkill, tutorialGame);
}}
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
class={`game-construct ${ko} ${classes}`} > class={`game-construct ${ko} ${classes}`} >
<div class="left"> <div class="left">

View File

@ -9,8 +9,8 @@ const shapes = require('./shapes');
const { effectInfo, removeTier } = require('../utils'); const { effectInfo, removeTier } = require('../utils');
const addState = connect( const addState = connect(
({ game, account, animSkill, animating, itemInfo, gameEffectInfo }) => ({ game, account, animSkill, animating, itemInfo, gameEffectInfo, tutorialGame }) =>
({ game, account, animSkill, animating, itemInfo, gameEffectInfo }) ({ game, account, animSkill, animating, itemInfo, gameEffectInfo, tutorialGame })
); );
class TargetSvg extends Component { class TargetSvg extends Component {
@ -28,9 +28,19 @@ class TargetSvg extends Component {
} }
render(props, state) { render(props, state) {
const { game, account, animating, animSkill, itemInfo, gameEffectInfo } = props; const { game, account, animating, animSkill, itemInfo, gameEffectInfo, tutorialGame } = props;
const { width, height } = state; const { width, height } = state;
if (!game) return false; // game will be null when battle ends if (!game) return false; // game will be null when battle ends
if (game.phase === 'Finish') return false; // Clear everything if its over (in case of abandon)
// First time joining game phase
if (tutorialGame) {
return (
<div class="resolving-skill">
<p> Select your skills, click on targets and then hit <b>ready</b>.</p>
</div>
);
}
// Whenever someones looking at effects throw it up here // Whenever someones looking at effects throw it up here
if (gameEffectInfo) { if (gameEffectInfo) {

View File

@ -59,7 +59,8 @@ module.exports = {
teamPage: createReducer(0, 'SET_TEAM_PAGE'), teamPage: createReducer(0, 'SET_TEAM_PAGE'),
teamSelect: createReducer([null, null, null], 'SET_TEAM_SELECT'), teamSelect: createReducer([null, null, null], 'SET_TEAM_SELECT'),
tutorial: createReducer(1, 'SET_TUTORIAL'), tutorial: createReducer(1, 'SET_TUTORIAL'),
tutorialGame: createReducer(1, 'SET_TUTORIAL_GAME'),
vboxSelected: createReducer([], 'SET_VBOX_SELECTED'), vboxSelected: createReducer([], 'SET_VBOX_SELECTED'),