From 919f2f9cf14769a0f4049cf694c2863ab8c04774 Mon Sep 17 00:00:00 2001 From: Russell Champoux Date: Tue, 27 Jan 2015 17:06:23 -0500 Subject: [PATCH] Fixed some generation of intelligence items --- weapons.js | 5 +++-- wondrousItems.js | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/weapons.js b/weapons.js index 171f103..108392c 100644 --- a/weapons.js +++ b/weapons.js @@ -1,4 +1,4 @@ -/*global _:false */ +/*global _:false, console:false */ /*global Grimoire:true, Intelligence:true */ 'use strict'; @@ -523,7 +523,7 @@ Weapons.getWeapon = function(type, wClass, final) { console.log(type); console.log(wClass); console.log(final); - console.log("roll: " + roll); + console.log('roll: ' + roll); console.log(newWeapon); console.log(special); return err.stack; @@ -540,6 +540,7 @@ Weapons.getWeapon = function(type, wClass, final) { if(final === true && _.random(1,100) === 1) { weapon.name = 'Intelligent ' + weapon.name; weapon.intelligence = Intelligence.getItemIntelligence(weapon.cost); + weapon.cost += weapon.intelligence.cost; } if(final === true && _.random(1,100) <= 30) { diff --git a/wondrousItems.js b/wondrousItems.js index 0280572..8966c94 100644 --- a/wondrousItems.js +++ b/wondrousItems.js @@ -1,4 +1,6 @@ /*global _:false */ +/*global Intelligence:false */ +"use strict"; var WondrousItems = {}; WondrousItems.getAllItems = function() { return [ @@ -488,25 +490,28 @@ WondrousItems.getItem = function(type, source) { //spell = _.sample(sourceSpells[type][level]); } - //I *know* that the APG has it's own roll table but I really don't care... + //I *know* that the APG has it"s own roll table but I really don"t care... item = _.sample(sourceItems); //remember that consumable items should NEVER have intelligence - if(_.random(1,100) === 1) + if(_.random(1,100) === 1) { item.name = "Intelligent " + item.name; + item.intelligence = Intelligence.getItemIntelligence(item.cost); + item.cost += item.intelligence.cost; + } if(_.random(1,100) <= 20) item.name += " with a clue as to its purpose"; return item; }; WondrousItems.getMinor = function() { - return this.getItem('minor'); + return this.getItem("minor"); }; WondrousItems.getMedium = function() { - return this.getItem('medium'); + return this.getItem("medium"); }; WondrousItems.getMajor = function() { - return this.getItem('major'); + return this.getItem("major"); }; \ No newline at end of file