Skip to content

Commit

Permalink
Squashed 'GroupInitiative/' changes from 682faa9..f64b168
Browse files Browse the repository at this point in the history
f64b168 prod-GroupInitiative: Updated prod version of GroupInitiative at version 0.8.8.

git-subtree-dir: GroupInitiative
git-subtree-split: f64b168704ded8d90ef8e845a3725336f34e9f18
  • Loading branch information
shdwjk committed May 11, 2015
1 parent 178cdf5 commit 473fca8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
37 changes: 20 additions & 17 deletions GroupInitiative.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
var GroupInitiative = GroupInitiative || (function() {
'use strict';

var version = '0.8.7',
lastUpdate = 1431320918,
var version = '0.8.8',
lastUpdate = 1431382263,
schemaVersion = 0.8,
intBaseSize = 10000,
bonusCache = {},
sorters = {
'None': function(to) {
Expand Down Expand Up @@ -73,7 +74,7 @@ var GroupInitiative = GroupInitiative || (function() {
(bonus>=0 ? '+' :'-')+' <span style="font-weight:bold;">'+Math.abs(bonus)+'</span> [bonus]'+
'</span>'
))+'">'+
(die+bonus)+
(((die*intBaseSize)+(bonus*intBaseSize))/intBaseSize)+
'</span>';
},
buildAnnounceGroups = function(l) {
Expand All @@ -100,7 +101,7 @@ var GroupInitiative = GroupInitiative || (function() {
((s.token && s.token.get('name')) || (s.character && s.character.get('name')) || '(Creature)')+
'</div>'+
'<div>'+
formatDieRoll(Math.round(s.init-s.bonus),s.bonus)+
formatDieRoll( (s.dieRoll || Math.round(s.init-s.bonus)),s.bonus)+
'</div>'+
'<div style="clear: both;"></div>'+
'</div>');
Expand Down Expand Up @@ -191,7 +192,7 @@ var GroupInitiative = GroupInitiative || (function() {
this.init=_.chain(l)
.pluck('bonus')
.map(function(d){
return randomInteger(state.GroupInitiative.config.dieSize)+d;
return ((randomInteger(state.GroupInitiative.config.dieSize)*intBaseSize)+(d*intBaseSize))/intBaseSize;
},{})
.min()
.value();
Expand All @@ -205,17 +206,17 @@ var GroupInitiative = GroupInitiative || (function() {
func: function(s,k,l){
if(!_.has(this,'init')) {
this.init=_.chain(l)
.pluck('bonus')
.map(function(d){
return randomInteger(state.GroupInitiative.config.dieSize)+d;
},{})
.reduce(function(memo,r){
return memo+r;
},[0])
.map(function(v){
return Math.floor(v/l.length);
})
.value();
.pluck('bonus')
.map(function(d){
return ((randomInteger(state.GroupInitiative.config.dieSize)*intBaseSize)+(d*intBaseSize))/intBaseSize;
},{})
.reduce(function(memo,r){
return memo+r;
},[0])
.map(function(v){
return Math.floor(v/l.length);
})
.value();
}
s.init=this.init;
return s;
Expand All @@ -224,13 +225,15 @@ var GroupInitiative = GroupInitiative || (function() {
},
'Individual-Roll': {
func: function(s,k,l){
s.init=randomInteger(state.GroupInitiative.config.dieSize)+s.bonus;
s.dieRoll=randomInteger(state.GroupInitiative.config.dieSize);
s.init=((s.dieRoll*intBaseSize)+(s.bonus*intBaseSize))/intBaseSize;
return s;
},
desc: 'Sets the initiative individually for each member of the group.'
},
'Constant-By-Stat': {
func: function(s,k,l){
s.dieRoll=0;
s.init=s.bonus;
return s;
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "GroupInitiative",
"version": "0.8.7",
"version": "0.8.8",
"description": "Adds the selected tokens to the turn order after rolling their initiative + configurable data.",
"authors": "The Aaron",
"roll20userid": "104025",
Expand Down

0 comments on commit 473fca8

Please sign in to comment.