'+
@@ -476,12 +480,13 @@ var MutantYearZero = MutantYearZero || (function() {
var cnt = getRollableDiceCount(dice);
return ' '+ch('[')+ch('[')+cnt+'d6'+ch(']')+ch(']')+' ';
},
- validatePlayerRollHash = function(playerid, hash, skill,base,gear){
+ validatePlayerRollHash = function(playerid, hash, skill,base,gear,diff){
var obj=state.MutantYearZero.playerRolls[playerid];
return (obj && obj.hash === hash &&
obj.dice.skillDice === skill &&
obj.dice.baseDice === base &&
- obj.dice.gearDice === gear
+ obj.dice.gearDice === gear &&
+ obj.dice.diffDice === diff
);
},
getCountsForRoll = function(playerid,hash){
@@ -614,10 +619,12 @@ var MutantYearZero = MutantYearZero || (function() {
skillDice, // skill: green
baseDice, // base(stat): yellow, trauma on 1s
gearDice, // gear: black, degradation on 1s
+ diffDice,
skillDiceArray,
baseDiceArray,
gearDiceArray,
+ diffDiceArray,
successes=0,
trauma=0,
@@ -626,6 +633,7 @@ var MutantYearZero = MutantYearZero || (function() {
pushes,
push=false,
+ nopush=false,
pushButton,
w=false,
cmd,
@@ -672,6 +680,16 @@ var MutantYearZero = MutantYearZero || (function() {
cmd=matches[1];
hash=parseInt(matches[2],10);
}
+
+ if('!wmyz-np' === cmd) {
+ cmd='!wmyz';
+ nopush=true;
+ }
+
+ if('!myz-np' === cmd) {
+ cmd='!myz';
+ nopush=true;
+ }
switch(cmd) {
case '!wmyz':
@@ -709,8 +727,8 @@ var MutantYearZero = MutantYearZero || (function() {
skillDice=getDiceCounts(msg,rollIndices[0]);
baseDice=getDiceCounts(msg,rollIndices[1]);
gearDice=getDiceCounts(msg,rollIndices[2]);
+ diffDice=getDiceCounts(msg,rollIndices[3]);
-
if(push &&
(
_.has(state.MutantYearZero.playerRolls,owner) &&
@@ -719,7 +737,8 @@ var MutantYearZero = MutantYearZero || (function() {
!validatePlayerRollHash(owner,hash,
getDiceArray(skillDice).length,
getDiceArray(baseDice).length,
- getDiceArray(gearDice).length
+ getDiceArray(gearDice).length,
+ getDiceArray(diffDice).length
)
){
reportBadPushCounts(msg.playerid);
@@ -727,18 +746,25 @@ var MutantYearZero = MutantYearZero || (function() {
}
pushedValues=getCountsForRoll(owner,hash);
- successes=pushedValues.success + (skillDice['6']||0) + (baseDice['6']||0) + (gearDice['6']||0) ;
+ successes=pushedValues.success + (skillDice['6']||0) + (baseDice['6']||0) + (gearDice['6']||0) - (diffDice['6']||0);
trauma = pushedValues.trauma + (baseDice['1']||0);
gearDamage = pushedValues.damage + (gearDice['1']||0);
pushes = pushedValues.pushes+1;
optional = (optional.length && optional) || getOptionalForRoll(owner,hash);
-
skillDiceArray=_.map(getDiceArray(skillDice),function(v){
switch(v){
case '6':
- case '-6':
+ return symbols.radioactive;
+ default:
+ return v;
+ }
+ });
+
+ diffDiceArray=_.map(getDiceArray(diffDice),function(v){
+ switch(v){
+ case '6':
return symbols.radioactive;
default:
return v;
@@ -774,7 +800,8 @@ var MutantYearZero = MutantYearZero || (function() {
dice: {
skillDice: getRollableDiceCount(skillDiceArray),
baseDice: getRollableDiceCount(baseDiceArray),
- gearDice: getRollableDiceCount(gearDiceArray)
+ gearDice: getRollableDiceCount(gearDiceArray),
+ diffDice: getRollableDiceCount(diffDiceArray)
},
counts: {
success: successes,
@@ -785,16 +812,19 @@ var MutantYearZero = MutantYearZero || (function() {
optional: optional
});
- pushButton = (_.reduce([skillDiceArray,baseDiceArray,gearDiceArray],function(m,dice){ return m+getRollableDiceCount(dice);},0) ?
- makeButton(
- '!'+(w?'w':'')+'myz['+hash+'] '+
- makeRerollExpression(skillDiceArray)+
- makeRerollExpression(baseDiceArray)+
- makeRerollExpression(gearDiceArray),
- symbols.push+' '+pushes
- ) :
- ''
- );
+ if(!nopush) {
+ pushButton = (_.reduce([skillDiceArray,baseDiceArray,gearDiceArray,diffDiceArray],function(m,dice){ return m+getRollableDiceCount(dice);},0) ?
+ makeButton(
+ '!'+(w?'w':'')+'myz['+hash+'] '+
+ makeRerollExpression(skillDiceArray)+
+ makeRerollExpression(baseDiceArray)+
+ makeRerollExpression(gearDiceArray)+
+ makeRerollExpression(diffDiceArray),
+ symbols.push+' '+pushes
+ ) :
+ ''
+ );
+ }
output = makeOutput([
makeLabel( successes+' '+symbols.radioactive, colors.lightGreen),
@@ -806,12 +836,11 @@ var MutantYearZero = MutantYearZero || (function() {
makeOptionalText(optional),
makeDiceImages(skillDiceArray,colors.green),
makeDiceImages(baseDiceArray,colors.yellow, colors.black),
- makeDiceImages(gearDiceArray,colors.black)
+ makeDiceImages(gearDiceArray,colors.black),
+ makeDiceImages(diffDiceArray,colors.red)
].join('')
);
-
-
who=getObj('player',owner).get('displayname');
if(w){
sendChat(msg.who, '/w gm '+output);
@@ -821,7 +850,6 @@ var MutantYearZero = MutantYearZero || (function() {
} else {
sendChat(who, '/direct '+output);
}
-
break;
case '!myz-config':
@@ -878,9 +906,7 @@ var MutantYearZero = MutantYearZero || (function() {
'
Unsupported Option:
'+a+'
'
);
}
-
});
-
break;
}
},
@@ -905,4 +931,3 @@ on('ready',function() {
-