forked from GitHub-Mirrors/foundry-sw5e
Merge pull request #228 from unrealkakeman89/split-powercasting
Split powercasting
This commit is contained in:
commit
db286f7883
2 changed files with 2079 additions and 3 deletions
|
@ -144,7 +144,7 @@ export default class Actor5e extends Actor {
|
|||
}
|
||||
|
||||
// Prepare power-casting data
|
||||
this._computePowercastingProgression(this.data);
|
||||
this._computeDerivedPowercasting(this.data);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -309,6 +309,9 @@ export default class Actor5e extends Actor {
|
|||
const required = xp.max - prior;
|
||||
const pct = Math.round((xp.value - prior) * 100 / required);
|
||||
xp.pct = Math.clamped(pct, 0, 100);
|
||||
|
||||
// Add base Powercasting attributes
|
||||
this._computeBasePowercasting(actorData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -325,6 +328,8 @@ export default class Actor5e extends Actor {
|
|||
// Proficiency
|
||||
data.attributes.prof = Math.floor((Math.max(data.details.cr, 1) + 7) / 4);
|
||||
|
||||
this._computeBasePowercasting(actorData);
|
||||
|
||||
// Powercaster Level
|
||||
if ( data.attributes.powercasting && !Number.isNumeric(data.details.powerLevel) ) {
|
||||
data.details.powerLevel = Math.max(data.details.cr, 1);
|
||||
|
@ -420,7 +425,7 @@ export default class Actor5e extends Actor {
|
|||
* Prepare data related to the power-casting capabilities of the Actor
|
||||
* @private
|
||||
*/
|
||||
_computePowercastingProgression (actorData) {
|
||||
_computeBasePowercasting (actorData) {
|
||||
if (actorData.type === 'vehicle' || actorData.type === 'starship') return;
|
||||
const ad = actorData.data;
|
||||
const powers = ad.powers;
|
||||
|
@ -630,7 +635,7 @@ export default class Actor5e extends Actor {
|
|||
let knownTechPowers = 0;
|
||||
for ( let knownPower of knownPowers ) {
|
||||
const d = knownPower.data;
|
||||
switch (knownPower.data.school){
|
||||
switch (d.data.school){
|
||||
case "lgt":
|
||||
case "uni":
|
||||
case "drk":{
|
||||
|
@ -650,6 +655,37 @@ export default class Actor5e extends Actor {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Prepare data related to the power-casting capabilities of the Actor
|
||||
* @private
|
||||
*/
|
||||
_computeDerivedPowercasting (actorData) {
|
||||
|
||||
if ((actorData.type === 'actor') || (actorData.type === 'npc')) return;
|
||||
|
||||
const ad = actorData.data;
|
||||
|
||||
// Powercasting DC for Actors and NPCs
|
||||
// TODO: Consider an option for using the variant rule of all powers use the same value
|
||||
ad.attributes.powerForceLightDC = 8 + ad.abilities.wis.mod + ad.attributes.prof ?? 10;
|
||||
ad.attributes.powerForceDarkDC = 8 + ad.abilities.cha.mod + ad.attributes.prof ?? 10;
|
||||
ad.attributes.powerForceUnivDC = Math.max(ad.attributes.powerForceLightDC,ad.attributes.powerForceDarkDC) ?? 10
|
||||
ad.attributes.powerTechDC = 8 + ad.abilities.int.mod + ad.attributes.prof ?? 10;
|
||||
|
||||
if (actorData.type !== 'actor') return;
|
||||
|
||||
// Set Force and tech bonus points for PC Actors
|
||||
if (!!ad.attributes.force.level){
|
||||
ad.attributes.force.points.max += Math.max(ad.abilities.wis.mod,ad.abilities.cha.mod);
|
||||
}
|
||||
if (!!ad.attributes.tech.level){
|
||||
ad.attributes.tech.points.max += ad.abilities.int.mod;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Compute the level and percentage of encumbrance for an Actor.
|
||||
*
|
||||
|
|
2040
module/actor/old_entity.js
Normal file
2040
module/actor/old_entity.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue