Added support for Lore Skills, Perception and Initiative. Additional skill and saves icons
@@ -5,3 +5,6 @@ cons.png: https://game-icons.net/1x1/zeromancer/heart-plus.html
|
|||||||
int.png: https://game-icons.net/1x1/lorc/bookmarklet.html
|
int.png: https://game-icons.net/1x1/lorc/bookmarklet.html
|
||||||
wis.png: https://game-icons.net/1x1/delapouite/wisdom.html
|
wis.png: https://game-icons.net/1x1/delapouite/wisdom.html
|
||||||
cha.png: https://game-icons.net/1x1/lorc/icicles-aura.html
|
cha.png: https://game-icons.net/1x1/lorc/icicles-aura.html
|
||||||
|
fort.png: https://game-icons.net/1x1/delapouite/rock-golem.html
|
||||||
|
ref.png: https://game-icons.net/1x1/lorc/dodging.html
|
||||||
|
will.png: https://game-icons.net/1x1/lorc/meditation.html
|
||||||
BIN
img/token/abilities/fort.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
img/token/abilities/ref.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
img/token/abilities/will.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
@@ -3,17 +3,22 @@ acr.png: https://game-icons.net/1x1/delapouite/contortionist.html
|
|||||||
ani.png: https://game-icons.net/1x1/delapouite/cavalry.html
|
ani.png: https://game-icons.net/1x1/delapouite/cavalry.html
|
||||||
arc.png: https://game-icons.net/1x1/delapouite/spell-book.html
|
arc.png: https://game-icons.net/1x1/delapouite/spell-book.html
|
||||||
ath.png: https://game-icons.net/1x1/lorc/muscle-up.html
|
ath.png: https://game-icons.net/1x1/lorc/muscle-up.html
|
||||||
|
cra.png: https://game-icons.net/1x1/lorc/sword-smithing.html
|
||||||
dec.png: https://game-icons.net/1x1/delapouite/convince.html
|
dec.png: https://game-icons.net/1x1/delapouite/convince.html
|
||||||
|
dip.png: https://game-icons.net/1x1/delapouite/shaking-hands.html
|
||||||
his.png: https://game-icons.net/1x1/delapouite/backward-time.html
|
his.png: https://game-icons.net/1x1/delapouite/backward-time.html
|
||||||
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
|
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
|
||||||
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
|
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
|
||||||
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
|
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
|
||||||
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
|
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
|
||||||
nat.png: https://game-icons.net/1x1/delapouite/forest.html
|
nat.png: https://game-icons.net/1x1/delapouite/forest.html
|
||||||
|
occ.png: https://game-icons.net/1x1/skoll/pentacle.html
|
||||||
prc.png: https://game-icons.net/1x1/lorc/semi-closed-eye.html
|
prc.png: https://game-icons.net/1x1/lorc/semi-closed-eye.html
|
||||||
prf.png: https://game-icons.net/1x1/lorc/sing.html
|
prf.png: https://game-icons.net/1x1/lorc/sing.html
|
||||||
per.png: https://game-icons.net/1x1/delapouite/public-speaker.html
|
per.png: https://game-icons.net/1x1/delapouite/public-speaker.html
|
||||||
rel.png: https://game-icons.net/1x1/lorc/holy-grail.html
|
rel.png: https://game-icons.net/1x1/lorc/holy-grail.html
|
||||||
|
soc.png: https://game-icons.net/1x1/delapouite/trumpet-flag.html
|
||||||
slt.png: https://game-icons.net/1x1/lorc/snatch.html
|
slt.png: https://game-icons.net/1x1/lorc/snatch.html
|
||||||
ste.png: https://game-icons.net/1x1/lorc/cloak-dagger.html
|
ste.png: https://game-icons.net/1x1/lorc/cloak-dagger.html
|
||||||
sur.png: https://game-icons.net/1x1/delapouite/pyre.html
|
sur.png: https://game-icons.net/1x1/delapouite/pyre.html
|
||||||
|
thi.png: https://game-icons.net/1x1/delapouite/lock-picking.html
|
||||||
BIN
img/token/skills/cra.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
img/token/skills/dip.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
img/token/skills/occ.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
img/token/skills/soc.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
img/token/skills/thi.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
@@ -31,17 +31,23 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSpeed(token) {
|
getSpeed(token) {
|
||||||
let speed = token.actor.data.data.attributes.speed.breakdown;
|
let speed = `${token.actor.data.data.attributes.speed.total}'`;
|
||||||
const otherSpeeds = token.actor.data.data.attributes.speed.otherSpeeds;
|
const otherSpeeds = token.actor.data.data.attributes.speed.otherSpeeds;
|
||||||
if (otherSpeeds.length > 0)
|
if (otherSpeeds.length > 0)
|
||||||
for (let i=0; i<otherSpeeds.length; i++)
|
for (let os of otherSpeeds)
|
||||||
speed += `\n${otherSpeeds[i].type}: ${otherSpeeds[i].value}`;
|
speed += `\n${os.type} ${os.total}'`;
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
getInitiative(token) {
|
getInitiative(token) {
|
||||||
let initiative = token.actor.data.data.attributes.init.value;
|
let initiativeModifier = token.actor.data.data.attributes?.initiative.totalModifier;
|
||||||
return (initiative >= 0) ? `+${initiative}` : initiative;
|
let initiativeAbility = token.actor.data.data.attributes?.initiative.ability;
|
||||||
|
if (initiativeModifier > 0) {
|
||||||
|
initiativeModifier = `+${initiativeModifier}`;
|
||||||
|
} else {
|
||||||
|
initiativeModifier = this.getPerception(token); //NPCs won't have a valid Initiative value, so default to use Perception
|
||||||
|
}
|
||||||
|
return (initiativeAbility != '') ? `(${initiativeAbility}): ${initiativeModifier}` : `(perception): ${initiativeModifier}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleInitiative(token) {
|
toggleInitiative(token) {
|
||||||
@@ -56,6 +62,11 @@ export class pf2e{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPerception(token) {
|
||||||
|
let perception = token.actor.data.data.attributes?.perception.totalModifier;
|
||||||
|
return (perception >= 0) ? `+${perception}` : perception;
|
||||||
|
}
|
||||||
|
|
||||||
getAbility(token, ability) {
|
getAbility(token, ability) {
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
return token.actor.data.data.abilities?.[ability].value;
|
return token.actor.data.data.abilities?.[ability].value;
|
||||||
@@ -78,10 +89,24 @@ export class pf2e{
|
|||||||
|
|
||||||
getSkill(token, skill) {
|
getSkill(token, skill) {
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
|
if (skill.startsWith('lor')) {
|
||||||
|
const index = parseInt(skill.split('_')[1])-1;
|
||||||
|
const loreSkills = this.getLoreSkills(token);
|
||||||
|
if (loreSkills.length > index) {
|
||||||
|
return `${loreSkills[index].name}: +${loreSkills[index].totalModifier}`;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
const val = token.actor.data.data.skills?.[skill].totalModifier;
|
const val = token.actor.data.data.skills?.[skill].totalModifier;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getLoreSkills(token) {
|
||||||
|
const skills = token.actor.data.data.skills;
|
||||||
|
return Object.keys(skills).map(key => skills[key]).filter(s => s.lore == true);
|
||||||
|
}
|
||||||
|
|
||||||
getProficiency(token) {
|
getProficiency(token) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -157,20 +182,33 @@ export class pf2e{
|
|||||||
* Roll
|
* Roll
|
||||||
*/
|
*/
|
||||||
roll(token,roll,options,ability,skill,save) {
|
roll(token,roll,options,ability,skill,save) {
|
||||||
if (roll == undefined) roll = 'ability';
|
if (roll == undefined) roll = 'skill';
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
if (save == undefined) save = 'fort';
|
if (save == undefined) save = 'fort';
|
||||||
|
if (roll == 'perception') token.actor.data.data.attributes.perception.roll(options);
|
||||||
if (roll == 'ability') token.actor.data.data.abilities?.[ability].roll(options);
|
if (roll == 'initiative') token.actor.rollInitiative(options);
|
||||||
|
if (roll == 'ability') token.actor.rollAbility(options, ability);
|
||||||
else if (roll == 'save') {
|
else if (roll == 'save') {
|
||||||
let ability = save;
|
let ability = save;
|
||||||
if (ability == 'fort') ability = 'fortitude';
|
if (ability == 'fort') ability = 'fortitude';
|
||||||
else if (ability == 'ref') ability = 'reflex';
|
else if (ability == 'ref') ability = 'reflex';
|
||||||
else if (ability == 'will') ability = 'will';
|
else if (ability == 'will') ability = 'will';
|
||||||
token.actor.data.data.saves?.[ability].roll(options);
|
token.actor.rollSave(options, ability);
|
||||||
|
}
|
||||||
|
else if (roll == 'skill') {
|
||||||
|
if (skill.startsWith('lor')) {
|
||||||
|
const index = parseInt(skill.split('_')[1])-1;
|
||||||
|
const loreSkills = this.getLoreSkills(token);
|
||||||
|
if (loreSkills.length > index) {
|
||||||
|
let loreSkill = loreSkills[index];
|
||||||
|
skill = loreSkill.shortform == undefined? loreSkills[index].expanded : loreSkills[index].shortform;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
token.actor.data.data.skills?.[skill].roll(options);
|
||||||
}
|
}
|
||||||
else if (roll == 'skill') token.actor.data.data.skills?.[skill].roll(options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -221,6 +221,11 @@ export class TokenHelper{
|
|||||||
return this.system.getResilience(token)
|
return this.system.getResilience(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PF2E */
|
||||||
|
getPerception(token) {
|
||||||
|
return this.system.getPerception(token)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conditions
|
* Conditions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ export class TokenControl{
|
|||||||
else if (stats == 'Advantage') txt += tokenHelper.getAdvantage(token) /* WFRP4e */
|
else if (stats == 'Advantage') txt += tokenHelper.getAdvantage(token) /* WFRP4e */
|
||||||
else if (stats == 'Resolve') txt += tokenHelper.getResolve(token) /* WFRP4e */
|
else if (stats == 'Resolve') txt += tokenHelper.getResolve(token) /* WFRP4e */
|
||||||
else if (stats == 'Resilience') txt += tokenHelper.getResilience(token) /* WFRP4e */
|
else if (stats == 'Resilience') txt += tokenHelper.getResilience(token) /* WFRP4e */
|
||||||
|
else if (stats == 'Perception') txt += tokenHelper.getPerception(token) /* PF2E */
|
||||||
else if (stats == 'Condition') { /* PF2E */
|
else if (stats == 'Condition') { /* PF2E */
|
||||||
const valuedCondition = tokenHelper.getConditionValue(token, settings.condition);
|
const valuedCondition = tokenHelper.getConditionValue(token, settings.condition);
|
||||||
if (valuedCondition != undefined) {
|
if (valuedCondition != undefined) {
|
||||||
|
|||||||