Merge branch 'master' of ssh://cryps.gg:40022/~/cryps

This commit is contained in:
Mashy 2019-04-08 14:19:22 +10:00
commit 549fca03bd
6 changed files with 45 additions and 21 deletions

View File

@ -457,7 +457,7 @@ header {
.cryp-box-top { .cryp-box-top {
display: flex; display: flex;
flex: 1 1 80%; flex: 1 1 75%;
width: 100%; width: 100%;
justify-content: center; justify-content: center;
align-items: stretch; align-items: stretch;

View File

@ -137,7 +137,7 @@ function GamePanel(props) {
function Cryp(cryp) { function Cryp(cryp) {
const ko = cryp.hp.value === 0 ? 'ko' : ''; const ko = cryp.hp.value === 0 ? 'ko' : '';
const skills = range(0, 4).map(i => Skill(cryp, i)); const skills = range(0, 3).map(i => Skill(cryp, i));
const stats = [STATS.hp, STATS.redShield, STATS.blueShield].map((s, j) => ( const stats = [STATS.hp, STATS.redShield, STATS.blueShield].map((s, j) => (
<figure key={j} alt={s.stat}> <figure key={j} alt={s.stat}>
@ -226,7 +226,7 @@ function GamePanel(props) {
const selectedSkills = playerTeam.cryps.map((c, i) => stackElement(c, i)); const selectedSkills = playerTeam.cryps.map((c, i) => stackElement(c, i));
const mobileSkills = activeCryp const mobileSkills = activeCryp
? range(0, 4).map(i => Skill(activeCryp, i, true)) ? range(0, 3).map(i => Skill(activeCryp, i, true))
: (<div/>); : (<div/>);
return ( return (

View File

@ -10,6 +10,7 @@ function Info(args) {
info, info,
sendUnequip, sendUnequip,
instance, instance,
setInfo,
} = args; } = args;
function infoVar([type, value]) { function infoVar([type, value]) {
@ -86,11 +87,18 @@ function Info(args) {
function infoCrypElement(cryp) { function infoCrypElement(cryp) {
// onClick={() => setInfo('skill', { skill: s, cryp })} // onClick={() => setInfo('skill', { skill: s, cryp })}
const skills = range(0, 4).map(i => { const skills = range(0, 3).map(i => {
const skill = cryp.skills[i];
function skillClick() {
if (!skill) return false;
return setInfo('skill', { skill: skill.skill, cryp });
}
const s = cryp.skills[i] const s = cryp.skills[i]
? cryp.skills[i].skill ? cryp.skills[i].skill
: (<span>&nbsp;</span>); : (<span>&nbsp;</span>);
return <button key={i} className="cryp-skill-btn right" >{s}</button>; return <button key={i} className="cryp-skill-btn" onClick={skillClick} >{s}</button>;
}); });
const stats = Object.values(STATS).map((s, j) => ( const stats = Object.values(STATS).map((s, j) => (
@ -100,12 +108,18 @@ function Info(args) {
</figure> </figure>
)); ));
const specs = cryp.specs.map((s, i) => ( const specs = cryp.specs.map((s, i) => {
<figure key={i}> function specClick() {
{SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)} setInfo('spec', { spec: s, cryp });
<figcaption>{SPECS[s].caption}</figcaption> }
</figure>
)); return (
<figure key={i} onClick={specClick} >
{SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)}
<figcaption>{SPECS[s].caption}</figcaption>
</figure>
);
});
return ( return (

View File

@ -1,7 +1,6 @@
const { connect } = require('preact-redux'); const { connect } = require('preact-redux');
// const actions = require('../actions'); const actions = require('../actions');
const Info = require('./info.component'); const Info = require('./info.component');
const addState = connect( const addState = connect(
@ -23,13 +22,24 @@ const addState = connect(
sendUnequip, sendUnequip,
instance, instance,
}; };
} },
/*
function receiveDispatch(dispatch) {
return { }; function receiveDispatch(dispatch) {
function setInfo(item, value) {
dispatch(actions.setInfo([item, value]));
}
function setActiveVar(value) {
dispatch(actions.setActiveVar(value));
}
return {
setInfo,
setActiveVar,
};
} }
*/
); );
module.exports = addState(Info); module.exports = addState(Info);

View File

@ -18,7 +18,7 @@ function Cryp(props) {
setActiveCryp, setActiveCryp,
} = props; } = props;
const skills = range(0, 4).map(i => { const skills = range(0, 3).map(i => {
const skill = cryp.skills[i]; const skill = cryp.skills[i];
const s = skill const s = skill
? skill.skill ? skill.skill
@ -26,7 +26,7 @@ function Cryp(props) {
function skillClick() { function skillClick() {
if (!skill) return false; if (!skill) return false;
setInfo('skill', { skill, cryp }); setInfo('skill', { skill: skill.skill, cryp });
return setActiveCryp(cryp); return setActiveCryp(cryp);
} }

View File

@ -582,7 +582,7 @@ pub fn vbox_apply(params: VboxApplyParams, tx: &mut Transaction, account: &Accou
let skill = var.into_skill().ok_or(format_err!("var {:?} has no associated skill", var))?; let skill = var.into_skill().ok_or(format_err!("var {:?} has no associated skill", var))?;
let cryp = player.cryp_get(params.cryp_id)?; let cryp = player.cryp_get(params.cryp_id)?;
// done here because i teach them a tonne of skills for tests // done here because i teach them a tonne of skills for tests
let max_skills = 4; let max_skills = 3;
if cryp.skills.len() >= max_skills { if cryp.skills.len() >= max_skills {
return Err(format_err!("cryp at max skills ({:?})", max_skills)); return Err(format_err!("cryp at max skills ({:?})", max_skills));
} }