use server calc speeds

This commit is contained in:
Mashy
2019-09-20 15:40:53 +10:00
parent 2e366e2eca
commit 67654cbbab
3 changed files with 7 additions and 19 deletions
+2 -5
View File
@@ -3,7 +3,7 @@ const range = require('lodash/range');
const reactStringReplace = require('react-string-replace');
const { INFO } = require('./../constants');
const { convertItem, removeTier, itemSpeed } = require('../utils');
const { convertItem, removeTier } = require('../utils');
const shapes = require('./shapes');
function InfoComponent(args) {
@@ -46,10 +46,7 @@ function InfoComponent(args) {
: false;
const itemRegEx = /(Red|Blue|Green)/;
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
const calcSpeed = itemSource.length
? (24 + (itemSpeed(itemSource[0].components[0]) + itemSpeed(itemSource[0].components[1])) * itemSpeed(itemSource[0].components[2])) * 4
: (24 + itemSpeed(info)) * 4;
const speed = <div> Speed {shapes.SpeedStat()} multiplier {calcSpeed}% </div>;
const speed = <div> Speed {shapes.SpeedStat()} multiplier {fullInfo.speed * 4}% </div>;
const cooldown = fullInfo.cooldown ? `${fullInfo.cooldown} Turn delay` : null;
return (
<div class="info-skill">
-14
View File
@@ -187,20 +187,6 @@ const removeTier = skill => {
return skill;
};
function itemSpeed(item) {
switch (item) {
case 'Attack': return 1;
case 'Stun': return 2;
case 'Block': return 3;
case 'Buff': return 4;
case 'Debuff': return 4;
case 'Red': return 3;
case 'Green': return 2;
case 'Blue': return 1;
default: return 0;
}
}
function postData(url = '/', data = {}) {
// Default options are marked with *
return fetch(`/api${url}`, {