0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-18 01:22:43 +00:00

Polishing the sidebar so more

This commit is contained in:
Scott Tolksdorf
2015-11-16 14:22:00 -05:00
parent e6e87457da
commit 5918267c86
10 changed files with 152 additions and 154 deletions

View File

@@ -68,15 +68,16 @@ var Encounter = React.createClass({
getPlayerObjects : function(){
return _.map(this.props.players.split('\n'), function(line){
return _.reduce(this.props.players.split('\n'), function(r, line){
var parts = line.split(' ');
if(parts.length != 2) return null;
return {
if(parts.length != 2) return r;
r.push({
name : parts[0],
initiative : parts[1] * 1,
isPC : true
}
})
})
return r;
},[])
},
@@ -84,7 +85,7 @@ var Encounter = React.createClass({
var self = this;
var sortedEnemies = _.sortBy(_.union(_.values(this.state.enemies), this.getPlayerObjects()), function(e){
if(e.initiative) return -e.initiative;
if(e && e.initiative) return -e.initiative;
return 0;
});