mirror of
https://github.com/RussellChamp/GrimoireJS.git
synced 2026-10-27 22:42:32 +00:00
Resolve the 0.1% chance issue with Weapons not generating due to a too high bonus
This commit is contained in:
1 parent
c190be3236
commit
4655191030
2 files changed
+22
-2
No files matched your search
+3
-2
@@ -1,8 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>GrimoireJS</title>
|
||||
<script src="./jquery-2.1.1.min.js"></script>
|
||||
<script src="./lodash.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
|
||||
<script type="application/javascript" src="grimoire.js"></script>
|
||||
<script type="application/javascript" src="intelligence.js"></script>
|
||||
<script type="application/javascript" src="weapons.js"></script>
|
||||
@@ -57,6 +57,7 @@
|
||||
<ul style="list-style-type:square">
|
||||
<li>All get*() function take a "type" argument that can be either 'minor', 'medium', or 'major'</li>
|
||||
<li>Try running Grimoire.getItems(2,2,2) to generate several minor, medium, and major items</li>
|
||||
<li>NOTE that all non-unique weapons are returned as "minor/medium/major melee/range weapon". It is up to the GM to determine what specific weapon this resolves to. It is recommend to check what proficiencies your players have. :)
|
||||
<li>Many get*() functions also have an optional paramater "source" that specifies which source material to pull from. Currently, only "CRB" and "APG" are supported.</li>
|
||||
</ul>
|
||||
<br/>
|
||||
|
||||
+19
@@ -432,6 +432,9 @@ Weapons.getWeapon = function(type, wClass, final) {
|
||||
'cost': newWeapon.cost + Weapons.data.bonusCost[newWeapon.bonus + special.bonus].cost - Weapons.data.bonusCost[newWeapon.bonus].cost,
|
||||
};
|
||||
}
|
||||
else {
|
||||
weapon = newWeapon; //Don't apply the new special
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -471,6 +474,9 @@ Weapons.getWeapon = function(type, wClass, final) {
|
||||
'cost': newWeapon.cost + Weapons.data.bonusCost[newWeapon.bonus + special.bonus].cost - Weapons.data.bonusCost[newWeapon.bonus].cost,
|
||||
};
|
||||
}
|
||||
else {
|
||||
weapon = newWeapon; //Don't apply the new special
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -505,10 +511,23 @@ Weapons.getWeapon = function(type, wClass, final) {
|
||||
'cost': newWeapon.cost + Weapons.data.bonusCost[newWeapon.bonus + special.bonus].cost - Weapons.data.bonusCost[newWeapon.bonus].cost,
|
||||
};
|
||||
}
|
||||
else {
|
||||
weapon = newWeapon; //Don't apply the new special
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(weapon === undefined || Object.keys(weapon).length === 0) {
|
||||
var err = new Error();
|
||||
console.log(type);
|
||||
console.log(wClass);
|
||||
console.log(final);
|
||||
console.log("roll: " + roll);
|
||||
console.log(newWeapon);
|
||||
console.log(special);
|
||||
return err.stack;
|
||||
}
|
||||
var i = weapon.name.indexOf('+');
|
||||
if(i != -1) {
|
||||
//move the '+X' to the front
|
||||
|
||||
Reference in new issue
Block a user