inventory wip

This commit is contained in:
ntr 2019-07-07 21:25:26 +10:00
parent f24b5afd5c
commit e45f28e4ea
6 changed files with 72 additions and 26 deletions

View File

@ -33,7 +33,6 @@
* rename costs 1cr
* invader set
* start with 3 constructs w/ random names
* new construct costs 5cr
@ -56,10 +55,10 @@ do not allow vbox actions for finished instances
*SERVER*
* push events
## SOON
* push events
* iconography
* icons change with %
* find new icons for colours / life
@ -76,9 +75,6 @@ do not allow vbox actions for finished instances
* mnml tv
* flavour text
* chat wheel trash talk
* KO animations and trash talk
* the *real* authentication endpoint
hit /auth with un/pw or token

View File

@ -399,6 +399,7 @@ header {
.menu-construct .controls {
display: flex;
justify-content: flex-end;
}
.menu-construct .controls h2 {
@ -408,9 +409,8 @@ header {
.menu-construct .controls button {
color: #444;
flex: 0;
margin: 0;
margin: 0 1em 0 0;
border: none;
padding: 0.25em;
}
.menu-construct .controls button:hover, .menu-construct .controls button:active {
@ -454,6 +454,31 @@ header {
opacity: 0
}
.inventory {
display: flex;
flex-flow: row wrap;
}
.inventory h2 {
flex: 1 0 100%;
}
.inventory figure {
flex: 0 0 10%;
display: flex;
flex-flow: column;
margin: 0.5em 1em;
}
/* heading included */
.inventory figure:nth-child(3) {
margin-right: 2em;
}
.inventory figure div {
}
.menu-instances {
display: flex;
flex-flow: column;

View File

@ -1,6 +1,6 @@
export const setAccount = value => ({ type: 'SET_ACCOUNT', value });
export const setConstructs = value => ({ type: 'SET_CONSTRUCTS', value });
export const setConstructDeleteId = value => ({ type: 'SET_CONSTRUCT_DELETE_ID', value });
export const setConstructEditId = value => ({ type: 'SET_CONSTRUCT_EDIT_ID', value });
export const setItemInfo = value => ({ type: 'SET_ITEM_INFO', value });
export const setSkip = value => ({ type: 'SET_SKIP', value });
export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value });

View File

@ -37,6 +37,16 @@ const addState = connect(
instanceList,
};
},
function receiveDispatch(dispatch) {
function editConstruct(id) {
dispatch(actions.setConstructEditId(id));
}
return {
editConstruct,
};
}
);
function List(args) {
@ -48,20 +58,16 @@ function List(args) {
sendInstanceJoin,
sendInstanceList,
instanceList,
editConstruct,
} = args;
function listElements() {
if (!instanceList) return <div>...</div>;
const instancePanels = instanceList.map(instance => {
const player = instance.players.find(p => p.id === account.id);
const scoreText = player
? `${player.wins} : ${player.losses}`
: '';
function instanceClick() {
if (!player) return sendInstanceJoin(instance);
return sendInstanceState(instance);
return sendInstanceJoin(instance);
}
return (
@ -69,21 +75,16 @@ function List(args) {
class="right"
onClick={instanceClick} >
<td>{instance.name}</td>
<td>{instance.players.length} / {instance.max_players}</td>
<td>{scoreText}</td>
</tr>
);
});
return (
<div class="menu-instance-list" >
<hr />
<table>
<thead>
<tr>
<th>instance name</th>
<th>players</th>
<th>status</th>
<th>opponent name</th>
</tr>
</thead>
<tbody>
@ -98,14 +99,22 @@ function List(args) {
);
}
// <div class="controls">
// <button>&#9881;</button>
// </div>
const constructPanels = constructs
.filter(c => team.includes(c.id))
.sort(idSort)
.map(construct =>
<div
key={construct.id}
// onClick={() => editConstruct(construct.id)}
class="menu-construct" >
<ConstructAvatar name={construct.name} id={construct.id} />
<ConstructAvatar
name={construct.name}
id={construct.id}
/>
<h2>{construct.name}</h2>
</div>
);
@ -115,6 +124,22 @@ function List(args) {
<div class="construct-list">
{constructPanels}
</div>
<hr />
<div class="inventory">
<h2>Inventory</h2>
<figure>
<figcaption>Reimage</figcaption>
<button>¤1</button>
</figure>
<figure>
<figcaption>Rename</figcaption>
<button>¤1</button>
</figure>
<figure>
<figcaption>Invader Architecture</figcaption>
<button></button>
</figure>
</div>
{listElements()}
</main>
);

View File

@ -17,7 +17,7 @@ module.exports = {
activeSkill: createReducer(null, 'SET_ACTIVE_SKILL'),
combiner: createReducer([null, null, null], 'SET_COMBINER'),
constructs: createReducer([], 'SET_CONSTRUCTS'),
constructDeleteId: createReducer(null, 'SET_CONSTRUCT_DELETE_ID'),
constructEditId: createReducer(null, 'SET_CONSTRUCT_EDIT_ID'),
game: createReducer(null, 'SET_GAME'),
info: createReducer(null, 'SET_INFO'),
instance: createReducer(null, 'SET_INSTANCE'),

View File

@ -314,7 +314,7 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
.find(|e| e.effect == Effect::Absorb).unwrap().clone();
match meta {
Some(EffectMeta::Skill(s)) => {
resolutions = absorb(&mut target, &mut source, resolutions, skill, amount, s);
resolutions = absorption(&mut target, &mut source, resolutions, skill, amount, s);
},
_ => panic!("no absorb skill"),
};
@ -1520,12 +1520,12 @@ fn hex(source: &mut Construct, target: &mut Construct, mut results: Resolutions,
return results;;
}
fn absorbtion(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
fn absorb(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect()[0])));
return results;;
}
fn absorb(source: &mut Construct, target: &mut Construct, mut results: Resolutions, reflect_skill: Skill, amount: u64, skill: Skill) -> Resolutions {
fn absorption(source: &mut Construct, target: &mut Construct, mut results: Resolutions, reflect_skill: Skill, amount: u64, skill: Skill) -> Resolutions {
let absorb = skill.effect()[0].set_meta(EffectMeta::AddedDamage(amount));
results.push(Resolution::new(source, target)
.event(target.add_effect(reflect_skill, absorb))