resolution events and colours

This commit is contained in:
ntr 2019-04-12 16:30:47 +10:00
parent 4a081d6ec1
commit 56d1162d79
5 changed files with 77 additions and 32 deletions

View File

@ -596,22 +596,6 @@ header {
filter: blur(5px); filter: blur(5px);
} }
.cryp-box.red-damage {
filter: drop-shadow(0 0 0.2em red);
border-width: 5px;
color: red;
border-color: red;
}
.red-damage button {
border: 3px solid red;
color: red;
}
.red-damage .stats {
border-top: 3px solid red;
}
.team-player { .team-player {
padding: 0; padding: 0;
} }
@ -655,6 +639,60 @@ header {
display: none; display: none;
} }
/*
CRYP DAMAGE
*/
.cryp-box.red-damage {
filter: drop-shadow(0 0 0.2em red);
border-width: 5px;
color: red;
border-color: red;
}
.red-damage button {
border: 3px solid red;
color: red;
}
.red-damage .stats {
border-top: 3px solid red;
}
.cryp-box.blue-damage {
filter: drop-shadow(0 0 0.2em blue);
border-width: 5px;
color: blue;
border-color: blue;
}
.blue-damage button {
border: 3px solid blue;
color: blue;
}
.blue-damage .stats {
border-top: 3px solid blue;
}
.cryp-box.green-damage {
filter: drop-shadow(0 0 0.2em green);
border-width: 5px;
color: green;
border-color: green;
}
.green-damage button {
border: 3px solid green;
color: green;
}
.green-damage .stats {
border-top: 3px solid green;
}
/*
MOBILE
*/
@media (max-width: 1000px) { @media (max-width: 1000px) {
.selected-skills { .selected-skills {
display: none; display: none;

View File

@ -3,7 +3,7 @@ const range = require('lodash/range');
const molecule = require('./molecule'); const molecule = require('./molecule');
const { STATS } = require('../utils'); const { STATS, eventClasses } = require('../utils');
// const SKILL_HOT_KEYS = ['Q', 'W', 'E', 'R']; // const SKILL_HOT_KEYS = ['Q', 'W', 'E', 'R'];
@ -140,11 +140,7 @@ function GamePanel(props) {
function Cryp(cryp) { function Cryp(cryp) {
const ko = cryp.green_life.value === 0 ? 'ko' : ''; const ko = cryp.green_life.value === 0 ? 'ko' : '';
const unfocus = () => { const classes = eventClasses(resolution, cryp);
if (!resolution) return false;
if (cryp.id === resolution.source.id || cryp.id === resolution.target.id) return false;
return 'unfocus';
};
const skills = range(0, 3).map(i => Skill(cryp, i)); const skills = range(0, 3).map(i => Skill(cryp, i));
@ -166,7 +162,7 @@ function GamePanel(props) {
key={cryp.id} key={cryp.id}
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
onClick={onClick} onClick={onClick}
className={`cryp-box ${ko} ${unfocus()}`} > className={`cryp-box ${ko} ${classes}`} >
<div className="cryp-box-top"> <div className="cryp-box-top">
<figure <figure
className="img" className="img"
@ -197,12 +193,9 @@ function GamePanel(props) {
function OpponentCryp(cryp, i) { function OpponentCryp(cryp, i) {
const ko = cryp.green_life.value === 0 ? 'ko' : ''; const ko = cryp.green_life.value === 0 ? 'ko' : '';
const classes = eventClasses(resolution, cryp);
const unfocus = () => { console.log(cryp.name, classes);
if (!resolution) return false;
if (cryp.id === resolution.source.id || cryp.id === resolution.target.id) return false;
return 'unfocus';
};
const stats = [STATS.greenLife, STATS.redLife, STATS.blueLife].map((s, j) => ( const stats = [STATS.greenLife, STATS.redLife, STATS.blueLife].map((s, j) => (
<figure key={j} alt={s.stat}> <figure key={j} alt={s.stat}>
@ -214,7 +207,7 @@ function GamePanel(props) {
return ( return (
<div <div
key={i} key={i}
className={`cryp-box ${ko} ${unfocus()}`} className={`cryp-box ${ko} ${classes}`}
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
onClick={() => selectSkillTarget(cryp.id)} > onClick={() => selectSkillTarget(cryp.id)} >
<div className="cryp-box-top"> <div className="cryp-box-top">

View File

@ -23,6 +23,7 @@ function registerEvents(store) {
if (game.resolved.length !== currentGame.resolved.length) { if (game.resolved.length !== currentGame.resolved.length) {
const newRes = game.resolved.slice(currentGame.resolved.length); const newRes = game.resolved.slice(currentGame.resolved.length);
return eachSeries(newRes, (r, cb) => { return eachSeries(newRes, (r, cb) => {
if (r.event[0] === 'Disable') return cb();
store.dispatch(actions.setResolution(r)); store.dispatch(actions.setResolution(r));
return setTimeout(cb, TIMES.RESOLUTION_TIME_MS); return setTimeout(cb, TIMES.RESOLUTION_TIME_MS);
}, err => { }, err => {

View File

@ -97,7 +97,15 @@ const COLOUR_ICONS = {
green: { colour: 'green', caption: 'green', svg: shapes.square }, green: { colour: 'green', caption: 'green', svg: shapes.square },
}; };
function eventClasses(resolution) { function eventClasses(resolution, cryp) {
if (!resolution) return '';
// not involved at all. blur them
if (cryp.id !== resolution.source.id && cryp.id !== resolution.target.id) return 'unfocus';
// not the target. just ignore for now
if (cryp.id !== resolution.target.id) return '';
const [type, event] = resolution.event; const [type, event] = resolution.event;
if (type === 'Ko') { if (type === 'Ko') {
@ -118,6 +126,10 @@ function eventClasses(resolution) {
if (type === 'Damage') { if (type === 'Damage') {
const { skill, amount, mitigation, colour } = event; const { skill, amount, mitigation, colour } = event;
if (colour === 'RedDamage') return 'red-damage';
if (colour === 'BlueDamage') return 'blue-damage';
if (colour === 'GreenDamage') return 'green-damage';
} }
if (type === 'Healing') { if (type === 'Healing') {
@ -148,7 +160,7 @@ function eventClasses(resolution) {
const { skill, evasion_rating } = event; const { skill, evasion_rating } = event;
} }
return false; return '';
} }
module.exports = { module.exports = {
@ -156,6 +168,7 @@ module.exports = {
numSort, numSort,
genAvatar, genAvatar,
requestAvatar, requestAvatar,
eventClasses,
NULL_UUID, NULL_UUID,
STATS, STATS,
SPECS, SPECS,

View File

@ -338,7 +338,7 @@ impl Cryp {
let mut rng = thread_rng(); let mut rng = thread_rng();
let i = match available.len() { let i = match available.len() {
1 => 1, 1 => 0,
_ => rng.gen_range(0, available.len() - 1), _ => rng.gen_range(0, available.len() - 1),
}; };