Skip to content

INQTest.js.getStats.js

kyleady edited this page Jan 30, 2018 · 1 revision

Purpose

Retrieves the current value of the Characteristic that is being used by INQTest from the given inqcharacter. It will also retrieve the corresponding Unnatural Characteristic.

Usage

INQTest.prototype.getStats(inqcharacter)

inqcharacter is an INQCharacter. The Characteristic being used will be saved to this.Stat. The corresponding Unnatural Characteristic will be saved to this.Unnatural.

If this.PartyStat is true, the Characteristic will not be taken from the given character but will instead use AttributeValue.js to find the one instance of that Roll20 Attribute in the campaign. It will also search for the corresponding Unnatural Roll20 Attribute in the campaign but it will not deliver a warning if it is not found.

If the Characteristic being used has not yet been defined, this method will do nothing.

If no inqcharacter is given and the Characteristic is not a Party Stat, this method will do nothing.

Examples

Not all Characteristics have corresponding Unnatural Characteristics

var inqcharacter = new INQCharacter();
inqcharacter.Attributes.Insanity = 36;

var myTest = new INQTest();
myTest.Characteristic = 'Insanity';

myTest.getStats(inqcharacter);
//myTest.Stat == 36;
//myTest.Unnatural == undefined;

The inqcharacter input is not required if the Characteristic is a Party Stat.

var character = createObj('character', {name: 'Party Attributes'});
createObj('attribute', {
  name: 'Profit Factor',
  _characterid: character.id,
  current: 13,
  max: 24
});

var myTest = new INQTest();
myTest.Characteristic = 'Profit Factor';
myTest.PartyStat = true;

myTest.getStats();
//myTest.Stat == 13;
//myTest.Unnatural == undefined;

Clone this wiki locally