effect descriptions, skill speed in game info, fix block stages

This commit is contained in:
Mashy 2019-10-17 21:47:55 +10:00
parent 38899d31d0
commit b71cc8fc0f
8 changed files with 121 additions and 27 deletions

View File

@ -17,9 +17,12 @@ export const setCombiner = value => ({ type: 'SET_COMBINER', value: Array.from(v
export const setConstructEditId = value => ({ type: 'SET_CONSTRUCT_EDIT_ID', value }); export const setConstructEditId = value => ({ type: 'SET_CONSTRUCT_EDIT_ID', value });
export const setConstructs = value => ({ type: 'SET_CONSTRUCTS', value }); export const setConstructs = value => ({ type: 'SET_CONSTRUCTS', value });
export const setConstructRename = value => ({ type: 'SET_CONSTRUCT_RENAME', value }); export const setConstructRename = value => ({ type: 'SET_CONSTRUCT_RENAME', value });
export const setGame = value => ({ type: 'SET_GAME', value }); export const setGame = value => ({ type: 'SET_GAME', value });
export const setGameInfo = value => ({ type: 'SET_GAME_INFO', value }); export const setGameSkillInfo = value => ({ type: 'SET_GAME_SKILL_INFO', value });
export const setGameEffectInfo = value => ({ type: 'SET_GAME_EFFECT_INFO', value });
export const setInfo = value => ({ type: 'SET_INFO', value }); export const setInfo = value => ({ type: 'SET_INFO', value });
export const setEmail = value => ({ type: 'SET_EMAIL', value }); export const setEmail = value => ({ type: 'SET_EMAIL', value });
export const setInvite = value => ({ type: 'SET_INVITE', value }); export const setInvite = value => ({ type: 'SET_INVITE', value });
export const setInstance = value => ({ type: 'SET_INSTANCE', value }); export const setInstance = value => ({ type: 'SET_INSTANCE', value });

View File

@ -8,6 +8,7 @@ const { STATS } = require('../utils');
const { ConstructAvatar, ConstructText } = require('./construct'); const { ConstructAvatar, ConstructText } = require('./construct');
const shapes = require('./shapes'); const shapes = require('./shapes');
const { INFO } = require('./../constants'); const { INFO } = require('./../constants');
const actions = require('../actions');
const SkillBtn = require('./skill.btn'); const SkillBtn = require('./skill.btn');
@ -21,8 +22,7 @@ const addState = connect(
animFocus, animFocus,
animating, animating,
animText, animText,
gameSkillInfo,
gameInfo,
itemInfo, itemInfo,
} = state; } = state;
@ -45,11 +45,19 @@ const addState = connect(
animText, animText,
activeSkill, activeSkill,
selectSkillTarget, selectSkillTarget,
gameSkillInfo,
gameInfo,
itemInfo, itemInfo,
}; };
},
function receiveDispatch(dispatch) {
function setGameEffectInfo(info) {
dispatch(actions.setGameEffectInfo(info));
}
return { setGameEffectInfo };
} }
); );
const eventClasses = (animating, animFocus, construct, postSkill) => { const eventClasses = (animating, animFocus, construct, postSkill) => {
@ -86,7 +94,8 @@ class GameConstruct extends Component {
animFocus, animFocus,
animText, animText,
gameInfo, setGameEffectInfo,
gameSkillInfo,
itemInfo, itemInfo,
} = this.props; } = this.props;
@ -107,20 +116,30 @@ class GameConstruct extends Component {
let crypSkills = <div></div>; let crypSkills = <div></div>;
if (player) crypSkills = (<div class="skills"> {skills} </div>); if (player) crypSkills = (<div class="skills"> {skills} </div>);
function hoverInfo(e, info) {
e.stopPropagation();
return setGameEffectInfo(info);
}
const effectBox = () => { const effectBox = () => {
if (gameInfo && gameInfo.constructId === construct.id) { if (gameSkillInfo && gameSkillInfo.constructId === construct.id) {
const fullInfo = itemInfo.items.find(k => k.item === gameInfo.skill) || INFO[gameInfo.skill]; const fullInfo = itemInfo.items.find(k => k.item === gameSkillInfo.skill) || INFO[gameSkillInfo.skill];
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/; const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]()); const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
const speed = <div> Speed {shapes.SpeedStat()} multiplier {fullInfo.speed * 4}% </div>;
return ( return (
<div class="skill-description"> <div class="skill-description">
<h2> {gameInfo.skill} </h2> <h2> {gameSkillInfo.skill} </h2>
<div> {infoDescription} </div> <div> {infoDescription} </div>
{speed}
</div>); </div>);
} }
const effects = construct.effects.length const effects = construct.effects.length
? construct.effects.map(c => <div key={c.effect}>{c.effect} - {c.duration}T</div>) ? 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; : null;
return (<div class="effects"> {effects} </div>); return (<div class="effects"> {effects} </div>);
} }

View File

@ -23,11 +23,11 @@ const addState = connect(
dispatch(actions.setActiveSkill(constructId, skill)); dispatch(actions.setActiveSkill(constructId, skill));
} }
function setGameInfo(info) { function setGameSkillInfo(info) {
dispatch(actions.setGameInfo(info)); dispatch(actions.setGameSkillInfo(info));
} }
return { setActiveSkill, setGameInfo }; return { setActiveSkill, setGameSkillInfo };
} }
); );
@ -40,7 +40,7 @@ function Skill(props) {
i, i,
activeSkill, activeSkill,
setActiveSkill, setActiveSkill,
setGameInfo, setGameSkillInfo,
} = props; } = props;
if (!game) return false; if (!game) return false;
@ -51,7 +51,7 @@ function Skill(props) {
function hoverInfo(e, info) { function hoverInfo(e, info) {
e.stopPropagation(); e.stopPropagation();
if (animating) return false; if (animating) return false;
return setGameInfo(info); return setGameSkillInfo(info);
} }
if (!s || !game) { if (!s || !game) {
return ( return (

View File

@ -6,11 +6,11 @@ const reactStringReplace = require('react-string-replace');
const throttle = require('lodash/throttle'); const throttle = require('lodash/throttle');
const shapes = require('./shapes'); const shapes = require('./shapes');
const { removeTier } = require('../utils'); const { effectInfo, removeTier } = require('../utils');
const addState = connect( const addState = connect(
({ game, account, animSkill, animating, itemInfo }) => ({ game, account, animSkill, animating, itemInfo, gameEffectInfo }) =>
({ game, account, animSkill, animating, itemInfo }) ({ game, account, animSkill, animating, itemInfo, gameEffectInfo })
); );
class TargetSvg extends Component { class TargetSvg extends Component {
@ -28,10 +28,24 @@ class TargetSvg extends Component {
} }
render(props, state) { render(props, state) {
const { game, account, animating, animSkill, itemInfo } = props; const { game, account, animating, animSkill, itemInfo, gameEffectInfo } = props;
const { width, height } = state; const { width, height } = state;
if (!game) return false; // game will be null when battle ends 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 // resolutions happening
// just put skill name up // just put skill name up
if (animating) { if (animating) {

View File

@ -109,7 +109,7 @@ function registerEvents(store) {
store.dispatch(actions.setAnimTarget(null)); store.dispatch(actions.setAnimTarget(null));
store.dispatch(actions.setAnimText(null)); store.dispatch(actions.setAnimText(null));
store.dispatch(actions.setAnimating(false)); store.dispatch(actions.setAnimating(false));
store.dispatch(actions.setGameEffectInfo(null));
store.dispatch(actions.setSkip(false)); store.dispatch(actions.setSkip(false));
// set the game state so resolutions don't fire twice // set the game state so resolutions don't fire twice

View File

@ -29,7 +29,8 @@ module.exports = {
constructEditId: createReducer(null, 'SET_CONSTRUCT_EDIT_ID'), constructEditId: createReducer(null, 'SET_CONSTRUCT_EDIT_ID'),
constructRename: createReducer(null, 'SET_CONSTRUCT_RENAME'), constructRename: createReducer(null, 'SET_CONSTRUCT_RENAME'),
game: createReducer(null, 'SET_GAME'), game: createReducer(null, 'SET_GAME'),
gameInfo: createReducer(null, 'SET_GAME_INFO'), gameSkillInfo: createReducer(null, 'SET_GAME_SKILL_INFO'),
gameEffectInfo: createReducer(null, 'SET_GAME_EFFECT_INFO'),
email: createReducer(null, 'SET_EMAIL'), email: createReducer(null, 'SET_EMAIL'),
invite: createReducer(null, 'SET_INVITE'), invite: createReducer(null, 'SET_INVITE'),
info: createReducer(null, 'SET_INFO'), info: createReducer(null, 'SET_INFO'),

View File

@ -237,6 +237,64 @@ function convertItem(v) {
// return; // return;
} }
function effectInfo(i) {
console.log(i);
function multiplier(s) { // Update later to use server info in future
if (s === 'CounterAttack') return 70;
if (s === 'CounterAttack+') return 95;
if (s === 'CounterAttack++') return 120;
if (s === 'DecayTick') return 33;
if (s === 'DecayTick+') return 45;
if (s === 'DecayTick++') return 70;
if (s === 'SiphonTick') return 40;
if (s === 'SiphonTick+') return 50;
if (s === 'SiphonTick++') return 60;
if (s === 'TriageTick') return 75;
if (s === 'TriageTick+') return 110;
if (s === 'TriageTick++') return 140;
if (s === 'Electrocute' || s === 'ElectrocuteTick') return 80;
if (s === 'Electrocute+' || s === 'ElectrocuteTick+') return 100;
if (s === 'Electrocute++' || s === 'ElectrocuteTick++') return 130;
return 0;
}
switch (i.effect) {
case 'Amplify': return `Increases construct RedPower and BluePower by ${i.meta[1] - 100}%`;
case 'Banish': return 'Banished construct cannot cast or take damage';
case 'Block': return `Reduces construct red damage taken by ${100 - i.meta[1]}%`;
case 'Buff': return `Increases construct RedPower and SpeedStat by ${i.meta[1] - 100}%`;
case 'Sustain': return 'Construct cannot be KO while active. Additionally provides immunity to disables';
case 'Curse': return `Construct will take ${i.meta[1] - 100}% increased red and blue damage`;
case 'Haste': return `Construct has ${i.meta[1] - 100}% increased SpeedStat. Red attack skills will trigger a HasteStrike dealing 30% SpeedStat as red damage.`;
case 'Hybrid': return `Construct has ${i.meta[1] - 100}% increased GreenPower. Blue attack skills will trigger a HybridBlast dealing 25% GreenPower as red damage.`;
case 'Invert': return 'Reverses damage and healing. Healing will damage this construct and damage will heal.';
case 'Counter': return `Red damage taken by this construct will trigger a CounterAttack. CounterAttack deals ${multiplier(i.meta[1])}% RedPower as red damage.`;
case 'Purge': return 'Disable construct from casting any green skills';
case 'Reflect': return 'Reflect blue skills back to caster';
case 'Slow': return `Reduces construct SpeedStat by ${100 - i.meta[1]}%`;
case 'Restrict': return 'Disable construct from casting any red skills';
case 'Stun': return 'Stunned construct cannot use skills';
case 'Intercept': return 'Redirect any skills on team to this target construct';
case 'Vulnerable': return `Construct will take ${i.meta[1] - 100}% increased red damage`;
case 'Silence': return 'Disable construct from casting any blue skills';
case 'Wither': return `Construct will take ${100 - i.meta[1]}% reduced healing`; //
case 'Decay': return `Construct will take ${multiplier(i.tick.skill)}% of caster's BluePower as blue damage each turn.`; //
case 'Electric': return `Attacks against this construct will apply Electrocute dealing ${multiplier(i.meta[1])}% of construct BluePower as blue damage each turn.`;
case 'Electrocute': return `Construct will take ${multiplier(i.tick.skill)}% of caster's BluePower as blue damage each turn.`;
case 'Absorb': return 'If construct takes damage, Absorption will be applied increasing RedPower and BluePower based on damage taken.';
case 'Absorption': return `Increasing construct RedPower and BluePower by ${i.meta[1]}`;
case 'Triage': return `Construct will be healed for ${multiplier(i.tick.skill)}% of caster's GreenPower each turn.`;
case 'Siphon': return `Construct will take ${multiplier(i.tick.skill)}% of caster's BluePower as blue damage each turn, healing the caster.`;
default: return 'Missing Effect Text';
}
}
module.exports = { module.exports = {
stringSort, stringSort,
numSort, numSort,
@ -251,4 +309,5 @@ module.exports = {
randomPoints, randomPoints,
removeTier, removeTier,
match, match,
effectInfo,
}; };

View File

@ -1420,9 +1420,7 @@ fn break_(source: &mut Construct, target: &mut Construct, mut results: Resolutio
} }
fn block(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions { fn block(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target) results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect()[0])));
.event(target.add_effect(skill, skill.effect()[0]))
.stages(EventStages::StartEnd));
return results; return results;
} }