Skip to content

Commit

Permalink
Merge pull request #18 from vtt-lair/feat/v12
Browse files Browse the repository at this point in the history
feat: v12 compatiblity
  • Loading branch information
vtt-lair authored Sep 2, 2024
2 parents e637af0 + 8464b50 commit 796a35f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
8 changes: 4 additions & 4 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"type": "system",
"manifest": "https://gitlab.com/asacolips-projects/foundry-mods/archmage/-/raw/2.0.2/system.json",
"compatibility": {
"verified": "2.0.2"
"verified": "3.3.1"
}
}
],
Expand All @@ -71,13 +71,13 @@
"id": "simbuls-athenaeum",
"type": "module",
"compatibility": {
"verified": "1.0.0"
"verified": "1.1.0"
}
}
]
},
"compatibility": {
"minimum": "10",
"verified": "11"
"minimum": "12",
"verified": "12"
}
}
6 changes: 3 additions & 3 deletions scripts/apps/config-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class HelpersSettingsConfig extends SettingsConfig {

/**@override */
static get defaultOptions(){
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
title : HELPER.localize("Helpers"),
id : "creature-aide-client-settings",
template : `${MODULE.data.athenaeum}/templates/ModularSettings.html`,
Expand Down Expand Up @@ -86,12 +86,12 @@ export class HelpersSettingsConfig extends SettingsConfig {

/**@override */
getData(options){
const canConfigure = game.user.can("SETTING_MODIFY");
const canConfigure = game.user.can("SETTING_MODIFY") || game.user.can("SETTINGS_MODIFY");
const settings = Array.from(game.settings.settings);

options.title = HELPER.format('SCA.ConfigApp.title');
let data = {
tabs: duplicate(options.groupLabels),
tabs: foundry.utils.duplicate(options.groupLabels),
hasParent: !!options.subMenuId,
parentMenu: options.parentMenu
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/modules/AbilityRecharge.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class AbilityRecharge {

queueUpdate(async () => {
// Roll the check
const roll = await(new Roll("1d6").evaluate({async: true}));
const roll = await(new Roll("1d6").evaluate());
const success = roll.total >= parseInt(data.recharge.value);
const rollMode = HELPER.setting(MODULE.data.name, "hideAbilityRecharge") == true ? "blindroll" : "";

Expand Down
4 changes: 2 additions & 2 deletions scripts/modules/LairActionManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class LairActionManagement {
/* do not run if not the first GM or the feature is not enabled */
if (!HELPER.isFirstGM() || !HELPER.setting(MODULE.data.name, 'lairActionHelper')) return;

const usesLair = getProperty(combatant, "actor.system.resources.lair.value");
const usesLair = foundry.utils.getProperty(combatant, "actor.system.resources.lair.value");
const hasLairAction = !!combatant.actor?.items.find((i) => i.system?.activation?.type === "lair");

/* flag this combatant as a lair actor for quick filtering */
Expand Down Expand Up @@ -109,7 +109,7 @@ export class LairActionManagement {
}

const hasHp = (combatant) => {
return getProperty(combatant.actor, 'system.attributes.hp.value') ?? 0 > 0;
return foundry.utils.getProperty(combatant.actor, 'system.attributes.hp.value') ?? 0 > 0;
}

const filterCondition = inside ? containsLair : excludesLair;
Expand Down
8 changes: 4 additions & 4 deletions scripts/modules/LegendaryActionManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export class LegendaryActionManagement {
let legendaryCombatants = combat.combatants.filter( combatant => combatant.getFlag(MODULE.data.name, 'hasLegendary') && combatant.id != previousId );

/* only prompt for actions from alive creatures with leg acts remaining */
legendaryCombatants = legendaryCombatants.filter( combatant => getProperty(combatant.actor, 'system.resources.legact.value') ?? 0 > 0 );
legendaryCombatants = legendaryCombatants.filter( combatant => getProperty(combatant.actor, 'system.attributes.hp.value') ?? 0 > 0 );
legendaryCombatants = legendaryCombatants.filter( combatant => foundry.utils.getProperty(combatant.actor, 'system.resources.legact.value') ?? 0 > 0 );
legendaryCombatants = legendaryCombatants.filter( combatant => foundry.utils.getProperty(combatant.actor, 'system.attributes.hp.value') ?? 0 > 0 );

/* send list of combantants to the action dialog subclass */
if (legendaryCombatants.length > 0) {
Expand Down Expand Up @@ -142,7 +142,7 @@ export class LegendaryActionManagement {
return;
}

let legact = getProperty(combatant.actor, 'system.resources.legact');
let legact = foundry.utils.getProperty(combatant.actor, 'system.resources.legact');

/* does this creature have the legendary action counter? */
if (!!legact && legact.value !== null) {
Expand All @@ -152,7 +152,7 @@ export class LegendaryActionManagement {

/* send the reset update and sheet refresh */
queueUpdate( async () => {
const newActor = await combatant.actor.update({'data.resources.legact.value': legact.max});
const newActor = await combatant.actor.update({'system.resources.legact.value': legact.max});
newActor.sheet.render(false);
});
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/modules/Regeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class Regeneration {
/** before we check anything else, is regen blocked on this actor? */
const regenBlockName = HELPER.setting(MODULE.data.name, "regenBlock");
const blockEffect = actor.effects?.find(e => e.name ?? e.label === regenBlockName );
const enabledBlockEffect = !(getProperty(blockEffect ?? {}, 'disabled') ?? true);
const enabledBlockEffect = !(foundry.utils.getProperty(blockEffect ?? {}, 'disabled') ?? true);

if (enabledBlockEffect) {
logger.debug(game.settings.get(MODULE.data.name, "debug"), `${NAME} | ${actor.name}'s regeneration blocked by ${blockEffect.name ?? blockEffect.label}`);
Expand All @@ -90,7 +90,7 @@ export class Regeneration {
}

static _getActorHP(actor) {
const actorHP = getProperty(actor, 'system.attributes.hp');
const actorHP = foundry.utils.getProperty(actor, 'system.attributes.hp');
return actorHP;
}

Expand Down Expand Up @@ -121,7 +121,7 @@ export class Regeneration {
const rollRegenCallback = () => queueUpdate( async () => {

/** roll the regen expression */
const rollObject = await new Roll(regen).evaluate({async: true});
const rollObject = await new Roll(regen).evaluate();
let regenRoll = rollObject.total;

/** apply the damage to the token */
Expand Down
8 changes: 5 additions & 3 deletions scripts/modules/UndeadFortitude.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,19 @@ export class UndeadFortitude {
if (!(HELPER.setting(MODULE.data.name, 'undeadFortEnable') > 0)) return;

/* bail if HP isnt being modified */
if ( getProperty(update, "system.attributes.hp.value") == undefined ) return;
if (foundry.utils.getProperty(update, "system.attributes.hp.value") == undefined ) return;

/* Bail if the actor does not have undead fortitude and the flag is not set to true (shakes fist at double negatives)*/
if (!actor.items.getName(HELPER.setting(MODULE.data.name, "undeadFortName")) && !actor.getFlag("dnd5e","helpersUndeadFortitude")) return;

/* collect the needed information and pass it along to the handler */
const originalHp = actor.system.attributes.hp.value;
const finalHp = getProperty(update, "system.attributes.hp.value") ?? originalHp;
const finalHp = foundry.utils.getProperty(update, "system.attributes.hp.value") ?? originalHp;

// default the damage to this calculation
let hpDelta = originalHp - finalHp;
if (originalHp === 0 && finalHp === 0) return;

// if you have midi-QOL then you'll have the applied damage
if (options.damageItem) {
hpDelta = options.damageItem.appliedDamage
Expand Down Expand Up @@ -146,7 +148,7 @@ export class UndeadFortitude {
if (hasSaved) {
/* they saved, report and restore to 1 HP */
content = HELPER.format("SCA.UndeadFort_surivalmessage", { tokenName: messageName, total: result });
await data.actor.update({'data.attributes.hp.value': 1});
await data.actor.update({'system.attributes.hp.value': 1});
} else {
/* rolled and failed, but not instantly via damage type */
content = HELPER.format("SCA.UndeadFort_deathmessage", { tokenName: messageName, total: result });
Expand Down

0 comments on commit 796a35f

Please sign in to comment.