Skip to content

Commit

Permalink
Merge pull request #665 from pwatson100/RT-V12
Browse files Browse the repository at this point in the history
Set of minor fixes for v12
  • Loading branch information
pwatson100 authored Jul 10, 2024
2 parents 4e0cd90 + 574d283 commit ae3b3d0
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 67 deletions.
7 changes: 7 additions & 0 deletions Release_Notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 5.1

* Fix for #656 removeCondition errors when a condition does not exist in statusEffects
* Fix for #662 Artifacts are not seen as mythical
* Fix for #664 No dice sound or animation in attribute or attack rolls
* Fix for #655 Setting for Multiple attacks needs bounce when set or unset

Version 5.0
* Updated for Foundry vtt version 12

Expand Down
10 changes: 6 additions & 4 deletions script/common/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ export class SymbaroumActor extends Actor {
reference: item.system.reference,
isMelee: item.system.isMelee,
isDistance: item.system.isDistance,
isArtifact: item.system.isArtifact,
doAlternativeDamage: doAlternativeDamage,
qualities: item.system.qualities,
damage: {
Expand Down Expand Up @@ -773,14 +774,15 @@ export class SymbaroumActor extends Actor {

async addCondition(effect, flagData) {
if (typeof effect === "string") {
effect = foundry.utils.duplicate(CONFIG.statusEffects.find((e) => e.id == effect));
effect = CONFIG.statusEffects.find((e) => e.id == effect);
}
if (!effect) return "No Effect Found";
if (!effect.id) return "Conditions require an id field";

let existing = this.hasCondition(effect.id);

if (!existing) {
if (!existing) {
effect = foundry.utils.duplicate(effect);
effect.label = game.i18n.localize(effect.label)?.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => letter.toUpperCase());
effect.name = game.i18n.localize(effect.name)?.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => letter.toUpperCase());
if (foundry.utils.isNewerVersion('11', game.version) ) {
Expand All @@ -796,7 +798,7 @@ export class SymbaroumActor extends Actor {
}

async removeCondition(effect) {
if (typeof effect === "string") effect = foundry.utils.duplicate(CONFIG.statusEffects.find((e) => e.id == effect));
if (typeof effect === "string") effect = CONFIG.statusEffects.find((e) => e.id == effect);
if (!effect) return "No Effect Found";
if (!effect.id) return "Conditions require an id field";
let existing = this.hasCondition(effect.id);
Expand Down Expand Up @@ -991,7 +993,7 @@ export class SymbaroumActor extends Actor {
favour: 0,
modifier: 0,
poison: 0,
isMystical: weapon.qualities.mystical,
isMystical: weapon.qualities.mystical || weapon.isArtifact,
isAlternativeDamage: false,
alternativeDamageAttribute: "none",
introText: actingCharName + game.i18n.localize("COMBAT.CHAT_INTRO") + weapon.name,
Expand Down
71 changes: 36 additions & 35 deletions script/common/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Hooks.once('init', () => {
scope: 'world',
config: false,
default: 0,
type: Number,
type: Number
});

game.settings.register('symbaroum', 'systemMigrationVersion', {
Expand All @@ -81,7 +81,7 @@ Hooks.once('init', () => {
scope: 'world',
config: false,
default: '0',
type: String,
type: String
});

game.settings.register('symbaroum', 'symbaroumDevMessageVersionNumber', {
Expand All @@ -90,7 +90,7 @@ Hooks.once('init', () => {
scope: 'world',
config: false,
default: 0,
type: Number,
type: Number
});

game.settings.register('symbaroum', 'combatAutomation', {
Expand All @@ -99,7 +99,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'playerResistButton', {
Expand All @@ -108,7 +108,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'alwaysSucceedOnOne', {
Expand All @@ -117,7 +117,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'optionalCrit', {
Expand All @@ -126,7 +126,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'optionalRareCrit', {
Expand All @@ -135,7 +135,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'critsApplyToAllTests', {
Expand All @@ -144,7 +144,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'optionalMoreRituals', {
Expand All @@ -153,7 +153,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'saveCombatRoll', {
Expand All @@ -162,47 +162,48 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});
game.settings.register('symbaroum', 'saveAttributeRoll', {
name: 'SYMBAROUM.OPTIONAL_SAVEATTRIBUTEROLL',
hint: 'SYMBAROUM.OPTIONAL_SAVEATTRIBUTEROLL_HINT',
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});
game.settings.register('symbaroum', 'showModifiersInDialogue', {
name: 'SYMBAROUM.OPTIONAL_SHOWMODIFIERSINDIALOGUE',
hint: 'SYMBAROUM.OPTIONAL_SHOWMODIFIERSINDIALOGUE_HINT',
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});
game.settings.register('symbaroum', 'showNpcModifiers', {
name: 'SYMBAROUM.OPTIONAL_NPC_MODIFIERS',
hint: 'SYMBAROUM.OPTIONAL_NPC_MODIFIERS_HINT',
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});
game.settings.register('symbaroum', 'showNpcAttacks', {
name: 'SYMBAROUM.OPTIONAL_NPC_ATTACKS',
hint: 'SYMBAROUM.OPTIONAL_NPC_ATTACKS_HINT',
scope: 'world',
type: Boolean,
default: false,
config: true,
requiresReload: true,
config: true
});
game.settings.register('symbaroum', 'allowShowReference', {
name: 'SYMBAROUM.OPTIONAL_SHOWREFERENCE',
hint: 'SYMBAROUM.OPTIONAL_SHOWREFERENCE_HINT',
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'hideIniativeRolls', {
Expand All @@ -211,15 +212,15 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});
game.settings.register('symbaroum', 'autoRollInitiative', {
name: 'SYMBAROUM.OPTIONAL_AUTOROLLINITIATIVE',
hint: 'SYMBAROUM.OPTIONAL_AUTOROLLINITIATIVE_HINT',
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'enhancedDeathSaveBonus', {
Expand All @@ -228,7 +229,7 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'manualInitValue', {
Expand All @@ -237,43 +238,43 @@ Hooks.once('init', () => {
scope: 'world',
type: Boolean,
default: false,
config: true,
config: true
});

game.settings.register('symbaroum', 'charBGChoice', {
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/green_flower_light.webp) repeat',
default: 'url(../asset/image/background/green_flower_light.webp) repeat'
});
game.settings.register('symbaroum', 'npcBGChoice', {
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/purple_flower_light.webp) repeat',
default: 'url(../asset/image/background/purple_flower_light.webp) repeat'
});
game.settings.register('symbaroum', 'titleBGChoice', {
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/title.webp)',
default: 'url(../asset/image/background/title.webp)'
});
game.settings.register('symbaroum', 'editableChoice', {
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/editable.webp)',
default: 'url(../asset/image/background/editable.webp)'
});
game.settings.register('symbaroum', 'nonEditableChoice', {
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/not-editable.webp)',
default: 'url(../asset/image/background/not-editable.webp)'
});

game.settings.register('symbaroum', 'switchCharBGColour', {
Expand All @@ -282,53 +283,53 @@ Hooks.once('init', () => {
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/green_flower_light.webp) repeat',
default: 'url(../asset/image/background/green_flower_light.webp) repeat'
});
game.settings.register('symbaroum', 'switchNpcBGColour', {
name: 'SYMBAROUM.OPTIONAL_NPC_COLOUR_SELECTOR',
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/purple_flower_light.webp) repeat',
default: 'url(../asset/image/background/purple_flower_light.webp) repeat'
});
game.settings.register('symbaroum', 'switchTitleColour', {
name: 'SYMBAROUM.OPTIONAL_TITLE_COLOUR_SELECTOR',
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/title.webp)',
default: 'url(../asset/image/background/title.webp)'
});
game.settings.register('symbaroum', 'switchEditableColour', {
name: 'SYMBAROUM.OPTIONAL_EDITABLE_COLOUR_SELECTOR',
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/editable.webp)',
default: 'url(../asset/image/background/editable.webp)'
});
game.settings.register('symbaroum', 'switchNoNEditableColour', {
name: 'SYMBAROUM.OPTIONAL_EDITABLE_COLOUR_SELECTOR',
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/not-editable.webp)',
default: 'url(../asset/image/background/not-editable.webp)'
});
game.settings.register('symbaroum', 'chatBGChoice', {
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/editable.webp)',
default: 'url(../asset/image/background/editable.webp)'
});
game.settings.register('symbaroum', 'switchChatBGColour', {
restricted: false,
type: String,
config: false,
scope: 'client',
default: 'url(../asset/image/background/green_flower_light.webp) repeat',
default: 'url(../asset/image/background/green_flower_light.webp) repeat'
});

game.settings.registerMenu('symbaroum', 'symbaroumSettings', {
Expand All @@ -337,7 +338,7 @@ Hooks.once('init', () => {
hint: 'SYMBAROUM.OPTIONAL_CONFIG_MENUHINT',
icon: 'fas fa-palette',
type: SymbaroumConfig,
restricted: false,
restricted: false
});

// register setting for add/remove menu button
Expand All @@ -350,7 +351,7 @@ Hooks.once('init', () => {
type: Boolean,
onChange: (enabled) => {
SymbaroumConfig.toggleConfigButton(enabled);
},
}
});

game.settings.register('symbaroum', 'symSemaphore', {
Expand All @@ -359,7 +360,7 @@ Hooks.once('init', () => {
scope: 'world',
type: String,
config: false,
default: '',
default: ''
});

game.symbaroum.macros = new SymbaroumMacros();
Expand Down
6 changes: 4 additions & 2 deletions script/common/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -3553,9 +3553,10 @@ async function attackResult(rollData, functionStuff) {
actor: actorid,
}),
content: html,
roll: JSON.stringify(createRollData(rolls)),
rolls: [createRollData(rolls)],
rollMode: game.settings.get("core", "rollMode"),
};
ChatMessage.applyRollMode(chatData, "roll");
let NewMessage = await ChatMessage.create(chatData);
if (flagDataArray.length > 0) {
await createModifyTokenChatButton(flagDataArray);
Expand Down Expand Up @@ -4002,8 +4003,9 @@ async function standardPowerResult(rollData, functionStuff) {
}
} else if (rolls.length > 0) {
// Only shows rolls if they are displayed to
chatData.roll = JSON.stringify(createRollData(rolls));
chatData.rolls = [createRollData(rolls)];
}
ChatMessage.applyRollMode(chatData, "roll");
let NewMessage = await ChatMessage.create(chatData);
if (trueActorSucceeded && functionStuff.addTargetEffect.length > 0) {
for (let effect of functionStuff.addTargetEffect) {
Expand Down
Loading

0 comments on commit ae3b3d0

Please sign in to comment.