-
Notifications
You must be signed in to change notification settings - Fork 0
WeaponGenerator.js
Randomly generates weapons for randomly generated xenos civilizations. These weapons can be melee, thrown, pistol, basic, heavy, or superheavy. The Damage, Penetration, Range, Rate of Fire, Clip, Reload, and Weapon Qualities are all randomly generated. However, the technology level of the xenos civilization allows multiple dice to be rolled, picking the highest one.
There is no frontend output for this script. It is meant to supplement XenosGenerator.js and VehicleGenerator.js.
TechRoll(rerolls, diceSides, diceNum)
TechoRoll initially rolls diceNum number of dice with diceSides sides. If rerolls is 0, it simply outputs the initial roll, unmodified. If rerolls is greater than zero, TechRoll rolls the initial roll rerolls number of times and outputs the highest of those rolls. If rerolls is less than zero, TechRoll rolls the initial roll AbsoluteValue(rerolls) number of times and outputs the lowest of those rolls. For example TechRoll(-3,10,2) would output the minimum of (2D10,2D10,2D10). By default rerolls is -1. By default diceSides is 10. By default diceNum is 1. Therefore TechRoll() = minimum of (D10,D10).
RandomWeapon(type, tech, qualities, blast, rangemultiplier, clipmultiplier)
Takes the input and outputs an object detailing a weapon. XenosGenerator.js and VehicleGenerator.js take that weapon object and not only convert it into text on a Character Sheet but also construct a Token Macro to fire that weapon. The inputs affect the following:
- type - The weapon type. The currently accepted types are 'melee', 'thrown', 'pistol', 'basic', 'heavy', and 'superheavy'. By default this is 'melee'.
- tech - A numerical representation of the tech level of the xenos civilization. It determines the base number of rerolls used in TechRoll(). By default this is -1.
- qualities - Add on a guaranteed list of qualities to the weapon (in the form of a string). By default this is an empty string.
- blast - A numerical bonus to the Blast quality. By default this is 0.
- rangemultiplier - Multiplies the randomly generated range of the weapon by this number. By default this is 1.
- clipmultiplier - Multiplies the randomly generated clip of the weapon by this number. By default this is 1.
The output is an object named weapon. It has the following key properties
- weapon.WeaponName (string)
- weapon.Type (string)
- weapon.Damage (int)
- weapon.DiceNum (int)
- weapon.Pen (int)
- weapon.Range (int)
- weapon.Single (bool)
- weapon.Semi (int)
- weapon.Full (int)
- weapon.Clip (int)
- weapon.Qualities (string)
The weapon also has the following qualities which are used internally to construct the Qualities string.
- weapon.Blast (int)
- weapon.Claws (int)
- weapon.Concussive (int)
- weapon.Crippling (int)
- weapon.Devastating (int)
- weapon.Felling (int)
- weapon.Hallucinogenic (int)
- weapon.Haywire (int)
- weapon.Proven (int)
- weapon.Smoke (int)
- weapon.Toxic (int)
- weapon.Spray (int)
- weapon.AreaSaturation (int)
Requires Find.js for the GetLink() function.
Random values should be adjusted as more play testing is done.