Merge branch 'develop' of ssh://git.mnml.gg:40022/~/mnml into develop
This commit is contained in:
@@ -2,10 +2,13 @@ const { connect } = require('preact-redux');
|
||||
const { Component } = require('preact');
|
||||
const preact = require('preact');
|
||||
const range = require('lodash/range');
|
||||
const reactStringReplace = require('react-string-replace');
|
||||
|
||||
const { STATS } = require('../utils');
|
||||
const { ConstructAvatar, ConstructText } = require('./construct');
|
||||
const shapes = require('./shapes');
|
||||
const { INFO } = require('./../constants');
|
||||
const actions = require('../actions');
|
||||
|
||||
const SkillBtn = require('./skill.btn');
|
||||
|
||||
@@ -19,6 +22,8 @@ const addState = connect(
|
||||
animFocus,
|
||||
animating,
|
||||
animText,
|
||||
gameSkillInfo,
|
||||
itemInfo,
|
||||
} = state;
|
||||
|
||||
function selectSkillTarget(targetConstructId) {
|
||||
@@ -40,8 +45,19 @@ const addState = connect(
|
||||
animText,
|
||||
activeSkill,
|
||||
selectSkillTarget,
|
||||
gameSkillInfo,
|
||||
itemInfo,
|
||||
};
|
||||
},
|
||||
|
||||
function receiveDispatch(dispatch) {
|
||||
function setGameEffectInfo(info) {
|
||||
dispatch(actions.setGameEffectInfo(info));
|
||||
}
|
||||
|
||||
return { setGameEffectInfo };
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
const eventClasses = (animating, animFocus, construct, postSkill) => {
|
||||
@@ -77,6 +93,10 @@ class GameConstruct extends Component {
|
||||
selectSkillTarget,
|
||||
animFocus,
|
||||
animText,
|
||||
|
||||
setGameEffectInfo,
|
||||
gameSkillInfo,
|
||||
itemInfo,
|
||||
} = this.props;
|
||||
|
||||
const ko = construct.green_life.value === 0 ? 'ko' : '';
|
||||
@@ -96,9 +116,33 @@ class GameConstruct extends Component {
|
||||
let crypSkills = <div></div>;
|
||||
if (player) crypSkills = (<div class="skills"> {skills} </div>);
|
||||
|
||||
const effects = construct.effects.length
|
||||
? construct.effects.map(c => <div key={c.effect}>{c.effect} - {c.duration}T</div>)
|
||||
: null;
|
||||
function hoverInfo(e, info) {
|
||||
e.stopPropagation();
|
||||
return setGameEffectInfo(info);
|
||||
}
|
||||
const effectBox = () => {
|
||||
if (gameSkillInfo && gameSkillInfo.constructId === construct.id) {
|
||||
const fullInfo = itemInfo.items.find(k => k.item === gameSkillInfo.skill) || INFO[gameSkillInfo.skill];
|
||||
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
||||
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
||||
const speed = <div> Speed {shapes.SpeedStat()} multiplier {fullInfo.speed * 4}% </div>;
|
||||
return (
|
||||
<div class="skill-description">
|
||||
<h2> {gameSkillInfo.skill} </h2>
|
||||
<div> {infoDescription} </div>
|
||||
{speed}
|
||||
</div>);
|
||||
}
|
||||
const effects = construct.effects.length
|
||||
? construct.effects.map(c =>
|
||||
<div
|
||||
key={c.effect}
|
||||
onMouseOver={e => hoverInfo(e, c)}
|
||||
onMouseOut={e => hoverInfo(e, null)}
|
||||
> {c.effect} - {c.duration}T</div>)
|
||||
: null;
|
||||
return (<div class="effects"> {effects} </div>);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -107,7 +151,7 @@ class GameConstruct extends Component {
|
||||
class={`game-construct ${ko} ${classes}`} >
|
||||
<div class="left">
|
||||
{crypSkills}
|
||||
<div class="effects"> {effects} </div>
|
||||
{effectBox()}
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="stats"> {stats} </div>
|
||||
|
||||
@@ -23,18 +23,24 @@ const addState = connect(
|
||||
dispatch(actions.setActiveSkill(constructId, skill));
|
||||
}
|
||||
|
||||
return { setActiveSkill };
|
||||
function setGameSkillInfo(info) {
|
||||
dispatch(actions.setGameSkillInfo(info));
|
||||
}
|
||||
|
||||
return { setActiveSkill, setGameSkillInfo };
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
function Skill(props) {
|
||||
const {
|
||||
animating,
|
||||
construct,
|
||||
game,
|
||||
i,
|
||||
activeSkill,
|
||||
setActiveSkill,
|
||||
setGameSkillInfo,
|
||||
} = props;
|
||||
|
||||
if (!game) return false;
|
||||
@@ -42,6 +48,11 @@ function Skill(props) {
|
||||
const s = construct.skills[i];
|
||||
const ko = construct.green_life.value === 0 ? 'ko' : '';
|
||||
|
||||
function hoverInfo(e, info) {
|
||||
e.stopPropagation();
|
||||
if (animating) return false;
|
||||
return setGameSkillInfo(info);
|
||||
}
|
||||
if (!s || !game) {
|
||||
return (
|
||||
<button
|
||||
@@ -76,6 +87,8 @@ function Skill(props) {
|
||||
<button
|
||||
disabled={cdText || s.disabled || ko}
|
||||
class={`${(targeting || highlight) ? 'active' : ''} ${border}`}
|
||||
onMouseOver={e => hoverInfo(e, { skill: s.skill, constructId: construct.id })}
|
||||
onMouseOut={e => hoverInfo(e, null)}
|
||||
type="submit"
|
||||
onClick={onClick}>
|
||||
{s.skill} {cdText}
|
||||
|
||||
@@ -6,11 +6,11 @@ const reactStringReplace = require('react-string-replace');
|
||||
const throttle = require('lodash/throttle');
|
||||
|
||||
const shapes = require('./shapes');
|
||||
const { removeTier } = require('../utils');
|
||||
const { effectInfo, removeTier } = require('../utils');
|
||||
|
||||
const addState = connect(
|
||||
({ game, account, animSkill, animating, itemInfo }) =>
|
||||
({ game, account, animSkill, animating, itemInfo })
|
||||
({ game, account, animSkill, animating, itemInfo, gameEffectInfo }) =>
|
||||
({ game, account, animSkill, animating, itemInfo, gameEffectInfo })
|
||||
);
|
||||
|
||||
class TargetSvg extends Component {
|
||||
@@ -28,10 +28,24 @@ class TargetSvg extends Component {
|
||||
}
|
||||
|
||||
render(props, state) {
|
||||
const { game, account, animating, animSkill, itemInfo } = props;
|
||||
const { game, account, animating, animSkill, itemInfo, gameEffectInfo } = props;
|
||||
const { width, height } = state;
|
||||
if (!game) return false; // game will be null when battle ends
|
||||
|
||||
// Whenever someones looking at effects throw it up here
|
||||
if (gameEffectInfo) {
|
||||
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
||||
const infoString = effectInfo(gameEffectInfo);
|
||||
const infoDescription = reactStringReplace(infoString, regEx, match => shapes[match]());
|
||||
|
||||
return (
|
||||
<div class="resolving-skill">
|
||||
<h1>{gameEffectInfo.effect}</h1>
|
||||
<div> {infoDescription} </div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// resolutions happening
|
||||
// just put skill name up
|
||||
if (animating) {
|
||||
|
||||
@@ -20,6 +20,7 @@ const addState = connect(
|
||||
itemInfo,
|
||||
itemUnequip,
|
||||
navInstance,
|
||||
info,
|
||||
} = state;
|
||||
|
||||
function sendVboxDiscard() {
|
||||
@@ -56,6 +57,7 @@ const addState = connect(
|
||||
itemUnequip,
|
||||
sendItemUnequip,
|
||||
navInstance,
|
||||
info,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -115,6 +117,7 @@ function Vbox(args) {
|
||||
sendItemUnequip,
|
||||
|
||||
setReclaiming,
|
||||
info,
|
||||
} = args;
|
||||
|
||||
if (!player) return false;
|
||||
@@ -138,7 +141,7 @@ function Vbox(args) {
|
||||
//
|
||||
function vboxHover(e, v) {
|
||||
if (v) {
|
||||
setInfo(v);
|
||||
if (info !== v) setInfo(v);
|
||||
e.stopPropagation();
|
||||
}
|
||||
return true;
|
||||
@@ -329,7 +332,7 @@ function Vbox(args) {
|
||||
|
||||
function combinerBtn() {
|
||||
let text = '';
|
||||
|
||||
let comboItem = '';
|
||||
if (combiner.length < 3) {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if (combiner.length > i) {
|
||||
@@ -339,14 +342,18 @@ function Vbox(args) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
text = 'combine';
|
||||
// Since theres 3 items in combiner and you can't have invalid combos we can preview it
|
||||
const combinerItems = combiner.map(j => vbox.bound[j]);
|
||||
const comboItemObj = itemInfo.combos.find(combo => combinerItems.every(c => combo.components.includes(c)));
|
||||
comboItem = comboItemObj ? comboItemObj.item : 'refine';
|
||||
text = `Combine - ${comboItem}`;
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
class='vbox-btn'
|
||||
disabled={combiner.length !== 3}
|
||||
onMouseOver={e => hoverInfo(e, 'refine')}
|
||||
onMouseOver={e => hoverInfo(e, comboItem)}
|
||||
onClick={e => e.stopPropagation()}
|
||||
onMouseDown={() => sendVboxCombine()}>
|
||||
{text}
|
||||
@@ -390,9 +397,10 @@ function Vbox(args) {
|
||||
//
|
||||
// EVERYTHING
|
||||
//
|
||||
function hoverInfo(e, info) {
|
||||
function hoverInfo(e, newInfo) {
|
||||
e.stopPropagation();
|
||||
return setInfo(info);
|
||||
if (info === newInfo) return true;
|
||||
return setInfo(newInfo);
|
||||
}
|
||||
|
||||
const classes = `vbox ${navInstance === 0 ? 'visible' : ''}`;
|
||||
|
||||
Reference in New Issue
Block a user