change combat format
This commit is contained in:
@@ -6,9 +6,14 @@ function CrypPanel({ battle }) {
|
||||
<div className="">
|
||||
<div>{JSON.stringify(battle.a)}</div>
|
||||
<div>{JSON.stringify(battle.b)}</div>
|
||||
<ul>
|
||||
{battle.log.map((l, i) => (<li key={i} >{l}</li>))}
|
||||
</ul>
|
||||
<div>
|
||||
{
|
||||
battle.log.map((l, i) => {
|
||||
if (l === '') return (<br/>);
|
||||
return <p key={i} >{l}</p>
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,22 @@ const stringSort = (k, desc) => {
|
||||
};
|
||||
};
|
||||
|
||||
const numSort = (k, desc) => {
|
||||
if (desc) {
|
||||
return (a, b) => {
|
||||
if (!get(a, k)) return 1;
|
||||
if (!get(b, k)) return -1;
|
||||
return get(b, k) - get(a, k);
|
||||
};
|
||||
}
|
||||
return (a, b) => {
|
||||
if (!get(a, k)) return 1;
|
||||
if (!get(b, k)) return -1;
|
||||
return get(a, k) - get(b, k);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringSort,
|
||||
numSort,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user