forked from GitHub-Mirrors/foundry-sw5e
Merge branch 'Develop-VJ' into cyr-power-point-ui
This commit is contained in:
commit
2127eaebc2
7 changed files with 964 additions and 509 deletions
|
@ -492,11 +492,13 @@ export default class Actor5e extends Actor {
|
|||
// EXCEPTION: NPC with an explicit power-caster level
|
||||
if (isNPC && actorData.data.details.powerForceLevel) {
|
||||
forceProgression.levels = actorData.data.details.powerForceLevel;
|
||||
actorData.data.attributes.force.level = forceProgression.levels;
|
||||
forceProgression.maxClass = actorData.data.attributes.powercasting;
|
||||
forceProgression.maxClassPowerLevel = SW5E.powerMaxLevel[forceProgression.maxClass][Math.clamped((forceProgression.levels - 1), 0, 20)];
|
||||
}
|
||||
if (isNPC && actorData.data.details.powerTechLevel) {
|
||||
techProgression.levels = actorData.data.details.powerTechLevel;
|
||||
actorData.data.attributes.tech.level = techProgression.levels;
|
||||
techProgression.maxClass = actorData.data.attributes.powercasting;
|
||||
techProgression.maxClassPowerLevel = SW5E.powerMaxLevel[techProgression.maxClass][Math.clamped((techProgression.levels - 1), 0, 20)];
|
||||
}
|
||||
|
@ -536,13 +538,13 @@ export default class Actor5e extends Actor {
|
|||
}
|
||||
}
|
||||
|
||||
// Set Force and tech power
|
||||
if (forceProgression.levels > 0){
|
||||
// Set Force and tech power for PC Actors
|
||||
if (!isNPC && forceProgression.levels){
|
||||
actorData.data.attributes.force.known.max = forceProgression.powersKnown;
|
||||
actorData.data.attributes.force.points.max = forceProgression.points + Math.max(actorData.data.abilities.wis.mod,actorData.data.abilities.cha.mod);
|
||||
actorData.data.attributes.force.level = forceProgression.levels;
|
||||
}
|
||||
if (techProgression.levels > 0){
|
||||
if (!isNPC && techProgression.levels){
|
||||
actorData.data.attributes.tech.known.max = techProgression.powersKnown;
|
||||
actorData.data.attributes.tech.points.max = techProgression.points + actorData.data.abilities.int.mod;
|
||||
actorData.data.attributes.tech.level = techProgression.levels;
|
||||
|
|
|
@ -116,6 +116,11 @@ export default class AbilityUseDialog extends Dialog {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// eliminate point usage for innate casters
|
||||
if (actorData.attributes.powercasting === 'innate') points = 999;
|
||||
|
||||
|
||||
let powerLevels
|
||||
if (powerType === "force"){
|
||||
powerLevels = Array.fromRange(10).reduce((arr, i) => {
|
||||
|
|
|
@ -556,7 +556,9 @@ SW5E.powerLimit = {
|
|||
"engineer": [1000,1000,1000,1000,1000,1,1,1,1],
|
||||
"guardian": [1000,1000,1000,1000,1,0,0,0,0],
|
||||
"scout": [1000,1000,1000,1,1,0,0,0,0],
|
||||
"sentinel": [1000,1000,1000,1000,1,1,1,0,0]
|
||||
"sentinel": [1000,1000,1000,1000,1,1,1,0,0],
|
||||
"innate": [1000,1000,1000,1000,1000,1000,1000,1000,1000],
|
||||
"dual": [1000,1000,1000,1000,1000,1,1,1,1]
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -570,7 +572,9 @@ SW5E.powerMaxLevel = {
|
|||
"guardian": [1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5],
|
||||
"scout": [0,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5],
|
||||
"sentinel": [1,1,2,2,2,3,3,3,4,4,5,5,5,6,6,6,7,7,7,7],
|
||||
"multi": [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9,9]
|
||||
"multi": [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9,9],
|
||||
"innate": [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9,9],
|
||||
"dual": [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9,9]
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -431,13 +431,7 @@ export default class Item5e extends Item {
|
|||
let consumeUsage = !!uses.per; // Consume limited uses
|
||||
let consumeQuantity = uses.autoDestroy; // Consume quantity of the item in lieu of uses
|
||||
|
||||
/*//set rollback values in case you pick a spell level you can't cast anymore
|
||||
let forcePointValueRollback = actor.data.data.attributes.force.points.value;
|
||||
let forcePointTempRollback = actor.data.data.attributes.force.points.temp;
|
||||
let techPointValueRollback = actor.data.data.attributes.tech.points.value;
|
||||
let techPointTempRollback = actor.data.data.attributes.tech.points.temp;
|
||||
*/
|
||||
// Display a configuration dialog to customize the usage
|
||||
// Display a configuration dialog to customize the usage
|
||||
const needsConfiguration = createMeasuredTemplate || consumeRecharge || consumeResource || consumePowerSlot || consumeUsage;
|
||||
if (configureDialog && needsConfiguration) {
|
||||
const configuration = await AbilityUseDialog.create(this);
|
||||
|
@ -532,40 +526,43 @@ export default class Item5e extends Item {
|
|||
const fp = this.actor.data.data.attributes.force.points;
|
||||
const tp = this.actor.data.data.attributes.tech.points;
|
||||
const powerCost = id.level + 1;
|
||||
switch (id.school){
|
||||
case "lgt":
|
||||
case "uni":
|
||||
case "drk": {
|
||||
const powers = Number(level?.fvalue ?? 0);
|
||||
if ( powers === 0 ) {
|
||||
const label = game.i18n.localize(`SW5E.PowerLevel${id.level}`);
|
||||
ui.notifications.warn(game.i18n.format("SW5E.PowerCastNoSlots", {name: this.name, level: label}));
|
||||
return false;
|
||||
const innatePower = this.actor.data.data.attributes.powercasting === 'innate';
|
||||
if (!innatePower){
|
||||
switch (id.school){
|
||||
case "lgt":
|
||||
case "uni":
|
||||
case "drk": {
|
||||
const powers = Number(level?.fvalue ?? 0);
|
||||
if ( powers === 0 ) {
|
||||
const label = game.i18n.localize(`SW5E.PowerLevel${id.level}`);
|
||||
ui.notifications.warn(game.i18n.format("SW5E.PowerCastNoSlots", {name: this.name, level: label}));
|
||||
return false;
|
||||
}
|
||||
actorUpdates[`data.powers.${consumePowerSlot}.fvalue`] = Math.max(powers - 1, 0);
|
||||
if (fp.temp >= powerCost) {
|
||||
actorUpdates["data.attributes.force.points.temp"] = fp.temp - powerCost;
|
||||
}else{
|
||||
actorUpdates["data.attributes.force.points.value"] = fp.value + fp.temp - powerCost;
|
||||
actorUpdates["data.attributes.force.points.temp"] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
actorUpdates[`data.powers.${consumePowerSlot}.fvalue`] = Math.max(powers - 1, 0);
|
||||
if (fp.temp >= powerCost) {
|
||||
actorUpdates["data.attributes.force.points.temp"] = fp.temp - powerCost;
|
||||
}else{
|
||||
actorUpdates["data.attributes.force.points.value"] = fp.value + fp.temp - powerCost;
|
||||
actorUpdates["data.attributes.force.points.temp"] = 0;
|
||||
case "tec": {
|
||||
const powers = Number(level?.tvalue ?? 0);
|
||||
if ( powers === 0 ) {
|
||||
const label = game.i18n.localize(`SW5E.PowerLevel${id.level}`);
|
||||
ui.notifications.warn(game.i18n.format("SW5E.PowerCastNoSlots", {name: this.name, level: label}));
|
||||
return false;
|
||||
}
|
||||
actorUpdates[`data.powers.${consumePowerSlot}.tvalue`] = Math.max(powers - 1, 0);
|
||||
if (tp.temp >= powerCost) {
|
||||
actorUpdates["data.attributes.tech.points.temp"] = tp.temp - powerCost;
|
||||
}else{
|
||||
actorUpdates["data.attributes.tech.points.value"] = tp.value + tp.temp - powerCost;
|
||||
actorUpdates["data.attributes.tech.points.temp"] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tec": {
|
||||
const powers = Number(level?.tvalue ?? 0);
|
||||
if ( powers === 0 ) {
|
||||
const label = game.i18n.localize(`SW5E.PowerLevel${id.level}`);
|
||||
ui.notifications.warn(game.i18n.format("SW5E.PowerCastNoSlots", {name: this.name, level: label}));
|
||||
return false;
|
||||
}
|
||||
actorUpdates[`data.powers.${consumePowerSlot}.tvalue`] = Math.max(powers - 1, 0);
|
||||
if (tp.temp >= powerCost) {
|
||||
actorUpdates["data.attributes.tech.points.temp"] = tp.temp - powerCost;
|
||||
}else{
|
||||
actorUpdates["data.attributes.tech.points.value"] = tp.value + tp.temp - powerCost;
|
||||
actorUpdates["data.attributes.tech.points.temp"] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,27 +131,28 @@ export const migrateActorData = function(actor) {
|
|||
_migrateActorSenses(actor, updateData);
|
||||
|
||||
// Migrate Owned Items
|
||||
if ( !actor.items ) return updateData;
|
||||
let hasItemUpdates = false;
|
||||
const items = actor.items.map(i => {
|
||||
if ( !!actor.items ) {
|
||||
let hasItemUpdates = false;
|
||||
const items = actor.items.map(i => {
|
||||
|
||||
// Migrate the Owned Item
|
||||
let itemUpdate = migrateItemData(i);
|
||||
// Migrate the Owned Item
|
||||
let itemUpdate = migrateItemData(i);
|
||||
|
||||
// Prepared, Equipped, and Proficient for NPC actors
|
||||
if ( actor.type === "npc" ) {
|
||||
if (getProperty(i.data, "preparation.prepared") === false) itemUpdate["data.preparation.prepared"] = true;
|
||||
if (getProperty(i.data, "equipped") === false) itemUpdate["data.equipped"] = true;
|
||||
if (getProperty(i.data, "proficient") === false) itemUpdate["data.proficient"] = true;
|
||||
}
|
||||
// Prepared, Equipped, and Proficient for NPC actors
|
||||
if ( actor.type === "npc" ) {
|
||||
if (getProperty(i.data, "preparation.prepared") === false) itemUpdate["data.preparation.prepared"] = true;
|
||||
if (getProperty(i.data, "equipped") === false) itemUpdate["data.equipped"] = true;
|
||||
if (getProperty(i.data, "proficient") === false) itemUpdate["data.proficient"] = true;
|
||||
}
|
||||
|
||||
// Update the Owned Item
|
||||
if ( !isObjectEmpty(itemUpdate) ) {
|
||||
hasItemUpdates = true;
|
||||
return mergeObject(i, itemUpdate, {enforceTypes: false, inplace: false});
|
||||
} else return i;
|
||||
});
|
||||
if ( hasItemUpdates ) updateData.items = items;
|
||||
// Update the Owned Item
|
||||
if ( !isObjectEmpty(itemUpdate) ) {
|
||||
hasItemUpdates = true;
|
||||
return mergeObject(i, itemUpdate, {enforceTypes: false, inplace: false});
|
||||
} else return i;
|
||||
});
|
||||
if ( hasItemUpdates ) updateData.items = items;
|
||||
}
|
||||
|
||||
// migrate powers last since it relies on item classes being migrated first.
|
||||
_migrateActorPowers(actor, updateData);
|
||||
|
|
File diff suppressed because one or more lines are too long
447
packs/packs/monsters_backup.db
Normal file
447
packs/packs/monsters_backup.db
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue