From 0840dd7dfd01525936f5e2d14cbf7c6288cdabac Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 4 Apr 2019 12:50:01 +1000 Subject: [PATCH] Thresholds for specs --- client/cryps.css | 8 ++++- client/src/components/constants.jsx | 43 ++++++++++++++++++++---- client/src/components/game.component.jsx | 4 +-- client/src/components/info.component.jsx | 34 +++++++++++++++++-- client/src/components/info.container.jsx | 2 +- client/src/utils.jsx | 7 ++++ 6 files changed, 84 insertions(+), 14 deletions(-) diff --git a/client/cryps.css b/client/cryps.css index 5828ea18..2599a2b2 100644 --- a/client/cryps.css +++ b/client/cryps.css @@ -512,4 +512,10 @@ header { align-items: center; padding-left: 2em; flex: 1; -} \ No newline at end of file +} + +.thresholds { + display: flex; + flex-direction: row; + justify-content: left; +} diff --git a/client/src/components/constants.jsx b/client/src/components/constants.jsx index a5b80c85..a5e2230b 100644 --- a/client/src/components/constants.jsx +++ b/client/src/components/constants.jsx @@ -190,62 +190,79 @@ module.exports = { GreenDamageI: { description: 'Increases green damage', + colours: ['green'], + thresholds: [5, 10, 20], }, RedDamageI: { description: 'Increased red damage', + colours: ['red'], + thresholds: [5, 10, 20], }, BlueDamageI: { description: 'Increased blue damage', + colours: ['blue'], + thresholds: [5, 10, 20], }, GRDI: { description: 'Increased green and red damage', + colours: ['green', 'red'], + thresholds: [2, 5, 10], }, GBDI: { description: 'Increased green and blue damage', + colours: ['green', 'blue'], + thresholds: [2, 5, 10], }, RBDI: { description: 'Increased red and blue damage', + colours: ['red', 'blue'], + thresholds: [2, 5, 10], }, - Speed: { - description: 'Increases speed of cryp', - upgrades: 'combine with 2 red / blue / green', - }, - - Hp: { description: 'Increases life', upgrades: 'combine with 2 red / blue / green', - }, LifeI: { description: 'Increases life', + colours: ['green'], + thresholds: [5, 10, 20], }, RedShieldI: { description: 'Increased red shield', + colours: ['red'], + thresholds: [5, 10, 20], }, BlueShieldI: { description: 'Increased blue shield', + colours: ['blue'], + thresholds: [5, 10, 20], }, LRSI: { description: 'Increased life and red shield', + colours: ['green', 'red'], + thresholds: [2, 5, 10], }, LBSI: { description: 'Increased life and blue shield', + colours: ['green', 'blue'], + thresholds: [2, 5, 10], }, RBSI: { description: 'Increased red and blue shield', + colours: ['red', 'blue'], + thresholds: [2, 5, 10], }, Speed: { @@ -255,26 +272,38 @@ module.exports = { RedSpeedI: { description: 'Increases red speed', + colours: ['red'], + thresholds: [5, 10, 20], }, BlueSpeedI: { description: 'Increases blue speed', + colours: ['blue'], + thresholds: [5, 10, 20], }, GreenSpeedI: { description: 'Increases green speed', + colours: ['green'], + thresholds: [5, 10, 20], }, GRSpeedI: { description: 'Increases green and red speed', + colours: ['green', 'red'], + thresholds: [2, 5, 10], }, GBSpeedI: { description: 'Increases green and blue speed', + colours: ['green', 'blue'], + thresholds: [2, 5, 10], }, RBSpeedI: { description: 'Increases red and blue speed', + colours: ['red', 'blue'], + thresholds: [2, 5, 10], }, }, diff --git a/client/src/components/game.component.jsx b/client/src/components/game.component.jsx index c8b8175d..ddaea234 100644 --- a/client/src/components/game.component.jsx +++ b/client/src/components/game.component.jsx @@ -5,8 +5,6 @@ const molecule = require('./molecule'); const { STATS } = require('../utils'); -console.log(STATS); - // const SKILL_HOT_KEYS = ['Q', 'W', 'E', 'R']; function GamePanel(props) { @@ -142,7 +140,7 @@ function GamePanel(props) { {skills} -
+
{stats}
diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index ad65f55f..7bacdcdb 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -1,13 +1,21 @@ const preact = require('preact'); const { ITEMS: { SKILLS, SPECS, COLOURS } } = require('./constants'); +const { COLOUR_ICONS } = require('../utils'); function Info(args) { const { info, sendUnequip, + instance, } = args; if (!info.length) return (
 
); - + let red = 0; let blue = 0; let green = 0; + instance.cryps.forEach(cryp => { + red += cryp.colours.red; + blue += cryp.colours.blue; + green += cryp.colours.green; + }); + const teamColours = { red, blue, green }; const [type, value] = info; if (type === 'item') { let itemDetails; @@ -17,7 +25,7 @@ function Info(args) { itemDetails = SPECS[value]; } else if (COLOURS[value]) { itemDetails = COLOURS[value]; - } console.log(itemDetails); + } return (
{value} - {itemDetails.description} @@ -38,12 +46,34 @@ function Info(args) {
); } + + function thresholds(t, spec) { + return ( + SPECS[spec].colours.map((c, i) => ( +
+ {COLOUR_ICONS[c].svg(`stat-icon ${COLOUR_ICONS[c].colour}`)} +
{Math.min(teamColours[c], t)} / {t}
+
+ )) + ); + } + + if (type === 'spec') { + const breaks = SPECS[value.spec].thresholds ? SPECS[value.spec].thresholds.map((t, i) => { + const threshold = thresholds(t, value.spec); + return ( +
+ {threshold} +
+ ); + }) : null; return (
{value.spec}
{SPECS[value.spec].description}
+ {breaks}