Skip to content

Commit

Permalink
Merge pull request #100 from League-of-Fabulous-Developers/dev
Browse files Browse the repository at this point in the history
V2.3.5 Update
  • Loading branch information
spyrella committed Mar 21, 2024
2 parents a34d3df + 66598ab commit 07d3f11
Show file tree
Hide file tree
Showing 42 changed files with 864 additions and 613 deletions.
9 changes: 7 additions & 2 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"Custom": "Spezialwaffe",
"Melee": "Nahkampfwaffe",
"Ranged": "Fernkampfwaffe",
"DamageNone": "Keine",
"DamageNone": "Typlos",
"DamageNormal": "Physisch",
"DamageWind": "Wind",
"DamageLightning": "Blitz",
Expand Down Expand Up @@ -788,6 +788,11 @@
"Rest": "Rast",
"RestingScene": "Rastszene",
"RestingEffects": "<strong>Vollständig geheilt:</strong> Alle LP und MP wiederhergestellt.<br>Alle Statuseffekte geheilt.",
"RestingEffectsIP": "<strong>Vollständig geheilt:</strong> Alle LP, MP und IP wiederhergestellt.<br>Alle Statuseffekte geheilt."
"RestingEffectsIP": "<strong>Vollständig geheilt:</strong> Alle LP, MP und IP wiederhergestellt.<br>Alle Statuseffekte geheilt.",
"ChatResourceLoss": "<strong>{actor}</strong> hat durch <strong>{from} {amount} {resource}</strong> verloren.",
"HealthPointLoss": "LP Verlust",
"MindPointLoss": "MP Verlust",
"InventoryPointLoss": "IP Verlust",
"DragAndDropHowTo": "Zieh das Element auf einen Charakterbogen oder Token den du kontrollierst, um es anzuwenden."
}
}
9 changes: 7 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"Custom": "Custom",
"Melee": "Melee",
"Ranged": "Ranged",
"DamageNone": "None",
"DamageNone": "Untyped",
"DamageNormal": "Physical",
"DamageWind": "Air",
"DamageLightning": "Bolt",
Expand Down Expand Up @@ -788,6 +788,11 @@
"Rest": "Rest",
"RestingScene": "Resting Scene",
"RestingEffects": "<strong>Fully Restored:</strong> All Hit Points and Mind Points replenished.<br>All status effects cleared.",
"RestingEffectsIP": "<strong>Fully Restored:</strong> All Hit Points, Mind Points, and Inventory replenished.<br>All status effects cleared."
"RestingEffectsIP": "<strong>Fully Restored:</strong> All Hit Points, Mind Points, and Inventory replenished.<br>All status effects cleared.",
"ChatResourceLoss": "<strong>{actor}</strong> lost <strong>{amount} {resource}</strong> from <strong>{from}</strong>",
"HealthPointLoss": "HP Loss",
"MindPointLoss": "MP Loss",
"InventoryPointLoss": "IP Loss",
"DragAndDropHowTo": "To apply, Drag & Drop this element onto an Actor Sheet or Token you control."
}
}
9 changes: 7 additions & 2 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"Custom": "Personalizado",
"Melee": "Cuerpo a cuerpo",
"Ranged": "A distancia",
"DamageNone": "Ningun daño",
"DamageNone": "Sin Tipo",
"DamageNormal": "Físico",
"DamageWind": "Aire",
"DamageLightning": "Rayo",
Expand Down Expand Up @@ -788,6 +788,11 @@
"Rest": "Descanso",
"RestingScene": "Escena de Descanso",
"RestingEffects": "<strong>Totalmente restaurado:</strong> Todos los puntos de vida y puntos mentales han sido restaurados.<br> Todos los efectos de estado han sido eliminados.",
"RestingEffectsIP": "<strong>Totalmente Restaurado:</strong> Todos los Puntos de Vida, Puntos Mentales e Inventario han sido restablecidos.<br>Todos los efectos de estado han sido eliminados."
"RestingEffectsIP": "<strong>Totalmente Restaurado:</strong> Todos los Puntos de Vida, Puntos Mentales e Inventario han sido restablecidos.<br>Todos los efectos de estado han sido eliminados.",
"ChatResourceLoss": "<strong>{from}</strong> hace que <strong>{actor}</strong> pierda <strong>{amount} {resource}</strong>.",
"HealthPointLoss": "Pérdida de PV",
"MindPointLoss": "Pérdida de PM",
"InventoryPointLoss": "Pérdida de PI",
"DragAndDropHowTo": "Para aplicarlo, arrastra este elemento a la Ficha de Personaje o Token bajo tu control."
}
}
9 changes: 7 additions & 2 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"Custom": "Personnalisé",
"Melee": "Corps à corps",
"Ranged": "Distance",
"DamageNone": "Aucun",
"DamageNone": "Non typé",
"DamageNormal": "Physique",
"DamageWind": "Air",
"DamageLightning": "Foudre",
Expand Down Expand Up @@ -788,6 +788,11 @@
"Rest": "Repos",
"RestingScene": "Scène de repos",
"RestingEffects": "<strong>Entièrement restauré :</strong> Tous les Points de Vie et Points de Magie sont réstaurés.<br>Tous les états sont effacés.",
"RestingEffectsIP": "<strong>Entièrement restauré :</strong> Tous les Points de Vie, Points de Magie, et Points d'Inventaire sont restaurés.<br>Tous les états sont effacés."
"RestingEffectsIP": "<strong>Entièrement restauré :</strong> Tous les Points de Vie, Points de Magie, et Points d'Inventaire sont restaurés.<br>Tous les états sont effacés.",
"ChatResourceLoss": "<strong>{actor}</strong> perd <strong>{amount} {resource}</strong> à cause de <strong>{from}</strong>",
"HealthPointLoss": "Perte de PV",
"MindPointLoss": "Perte de PM",
"InventoryPointLoss": "Perte de PI",
"DragAndDropHowTo": "Pour l'appliquer, Glisser & Déposer cet élément sur une fiche d'Acteur ou un Token que vous contrôlez."
}
}
9 changes: 7 additions & 2 deletions lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"Custom": "Personalizzata",
"Melee": "Mischia",
"Ranged": "Distanza",
"DamageNone": "Nessun Danno",
"DamageNone": "Senza tipo",
"DamageNormal": "Fisico",
"DamageWind": "Aria",
"DamageLightning": "Fulmine",
Expand Down Expand Up @@ -788,6 +788,11 @@
"Rest": "Riposo",
"RestingScene": "Scena di Riposo",
"RestingEffects": "<strong>Completamente Riposato:</strong> Tutti i Punti Vita e i Punti Mente sono stati recuperati.<br>Tutti gli status sono stati rimossi.",
"RestingEffectsIP": "<strong>Completamente Riposato:</strong> Tutti i Punti Vita, i Punti Mente e i Punti Inventario sono stati recuperati.<br>Tutti gli status sono stati rimossi."
"RestingEffectsIP": "<strong>Completamente Riposato:</strong> Tutti i Punti Vita, i Punti Mente e i Punti Inventario sono stati recuperati.<br>Tutti gli status sono stati rimossi.",
"ChatResourceLoss": "<strong>{actor}</strong> ha perso <strong>{amount} {resource}</strong> a causa di <strong>{from}</strong>",
"HealthPointLoss": "Perdita di PV",
"MindPointLoss": "Perdita di PM",
"InventoryPointLoss": "Perdita di PI",
"DragAndDropHowTo": "Per applicare, trascina e rilascia su una Scheda Personaggio o un Token che controlli."
}
}
7 changes: 6 additions & 1 deletion lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,11 @@
"Rest": "",
"RestingScene": "",
"RestingEffects": "",
"RestingEffectsIP": ""
"RestingEffectsIP": "",
"ChatResourceLoss": "",
"HealthPointLoss": "",
"MindPointLoss": "",
"InventoryPointLoss": "",
"DragAndDropHowTo": ""
}
}
9 changes: 7 additions & 2 deletions lang/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"Custom": "Personalizado",
"Melee": "Corpo a Corpo",
"Ranged": "Distância",
"DamageNone": "Nenhum Dano",
"DamageNone": "Sem Tipo",
"DamageNormal": "Físico",
"DamageWind": "Ar",
"DamageLightning": "Relâmpago",
Expand Down Expand Up @@ -788,6 +788,11 @@
"Rest": "Repouso",
"RestingScene": "Cena de Repouso",
"RestingEffects": "<strong>Totalmente curado:</strong> Todos os pontos de vida e pontos mentais foram reabastecidos.<br>Todos os efeitos de status foram eliminados.",
"RestingEffectsIP": "<strong>Totalmente curado:</strong> Todos os pontos de vida, pontos mentais e inventário foram reabastecidos.<br>Todos os efeitos de status foram eliminados."
"RestingEffectsIP": "<strong>Totalmente curado:</strong> Todos os pontos de vida, pontos mentais e inventário foram reabastecidos.<br>Todos os efeitos de status foram eliminados.",
"ChatResourceLoss": "<strong>{actor}</strong> perdeu <strong>{amount} {resource}</strong> de <strong>{from}</strong>",
"HealthPointLoss": "Perda de PV",
"MindPointLoss": "Perda de PM",
"InventoryPointLoss": "Perda de PI",
"DragAndDropHowTo": "Para aplicar, arraste e solte este elemento em uma ficha de ator ou token que você controla."
}
}
9 changes: 7 additions & 2 deletions lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"Custom": "Нестандартное",
"Melee": "Ближний бой",
"Ranged": "Дальний бой",
"DamageNone": "нет",
"DamageNone": "Чистый",
"DamageNormal": "Физич.",
"DamageWind": "Воздух",
"DamageLightning": "Разряд",
Expand Down Expand Up @@ -788,6 +788,11 @@
"Rest": "Отдых",
"RestingScene": "Сцена отдыха",
"RestingEffects": "<strong>Полное восстановление:</strong> Восстановлены все ОЗ и ОМ.<br>Все статус-эффекты сняты.",
"RestingEffectsIP": "<strong>Полное восстановление:</strong> Восстановлены все ОЗ, ОМ и ОИ.<br>Все статус-эффекты сняты."
"RestingEffectsIP": "<strong>Полное восстановление:</strong> Восстановлены все ОЗ, ОМ и ОИ.<br>Все статус-эффекты сняты.",
"ChatResourceLoss": "<strong>{actor}</strong> потерял <strong>{amount} {resource}</strong> от <strong>{from}</strong>",
"HealthPointLoss": "потеря ОЗ",
"MindPointLoss": "потеря ОМ",
"InventoryPointLoss": "потеря ОИ",
"DragAndDropHowTo": "Для применения перетащите этот элемент на контролируемый вами лист или токен"
}
}
8 changes: 8 additions & 0 deletions module/documents/actors/character/character-migrations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ function migrateLegacyFabulaPoints(source) {
}
}

function migratePhysicalAffinity(source) {
if (source.affinities && 'phys' in source.affinities && !('physical' in source.affinities)) {
source.affinities.physical = source.affinities.phys;
}
}

export class CharacterMigrations {
static run(source) {
migrateLegacyBonds(source);

migrateLegacyFabulaPoints(source);

migratePhysicalAffinity(source);
}
}
4 changes: 2 additions & 2 deletions module/documents/actors/common/affinities-data-model.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AffinityDataModel} from './affinity-data-model.mjs';
import { AffinityDataModel } from './affinity-data-model.mjs';

/**
* @property {AffinityDataModel} phys
Expand All @@ -15,7 +15,7 @@ export class AffinitiesDataModel extends foundry.abstract.DataModel {
static defineSchema() {
const { EmbeddedDataField } = foundry.data.fields;
return {
phys: new EmbeddedDataField(AffinityDataModel, {}),
physical: new EmbeddedDataField(AffinityDataModel, {}),
air: new EmbeddedDataField(AffinityDataModel, {}),
bolt: new EmbeddedDataField(AffinityDataModel, {}),
dark: new EmbeddedDataField(AffinityDataModel, {}),
Expand Down
8 changes: 8 additions & 0 deletions module/documents/actors/npc/npc-migrations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ function migrateOldMisspelledVillain(source) {
}
}

function migratePhysicalAffinity(source) {
if ('phys' in source.affinities && !('physical' in source.affinities)) {
source.affinities.physical = source.affinities.phys;
}
}

export const NpcMigrations = {
run: (source) => {
migrateLegacyAffinities(source);
Expand All @@ -57,5 +63,7 @@ export const NpcMigrations = {
migrateOldMagicBonus(source);

migrateOldMisspelledVillain(source);

migratePhysicalAffinity(source);
},
};
7 changes: 3 additions & 4 deletions module/documents/actors/npc/npc-skill-tracker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ export class NpcSkillTracker {

Object.entries(this.#data.affinities).forEach(([affinity, value]) => {
if (value.base === -1) {
if (affinity === 'phys') {
if (affinity === 'physical') {
// If physical vulnerable, add 2
sum += 2;
} else {
// If vulnerable (except 'phys'), add 1
// If vulnerable (except 'physical'), add 1
sum += 1;
}
}
Expand Down Expand Up @@ -217,8 +217,7 @@ export class NpcSkillTracker {

#calcUsedSkillsFromOtherActions() {
return this.#data.actor.itemTypes.miscAbility.length;
}

}

#calcUsedSkillsFromSpecial() {
return this.#data.actor.itemTypes.rule.length;
Expand Down
6 changes: 3 additions & 3 deletions module/documents/items/basic/basic-item-data-model.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FU} from '../../../helpers/config.mjs';
import {ItemAttributesDataModel} from '../common/item-attributes-data-model.mjs';
import { FU } from '../../../helpers/config.mjs';
import { ItemAttributesDataModel } from '../common/item-attributes-data-model.mjs';

/**
* @property {string} subtype.value
Expand Down Expand Up @@ -34,7 +34,7 @@ export class BasicItemDataModel extends foundry.abstract.TypeDataModel {
accuracy: new SchemaField({ value: new NumberField({ initial: 0, integer: true, nullable: false }) }),
damage: new SchemaField({ value: new NumberField({ initial: 0, integer: true, nullable: false }) }),
type: new SchemaField({ value: new StringField({ choices: Object.keys(FU.weaponTypes) }) }),
damageType: new SchemaField({ value: new StringField({ initial: 'physical', blank: true, choices: Object.keys(FU.damageTypes) }) }),
damageType: new SchemaField({ value: new StringField({ initial: 'physical', choices: Object.keys(FU.damageTypes) }) }),
cost: new SchemaField({ value: new NumberField({ initial: 100, min: 0, integer: true, nullable: false }) }),
quality: new SchemaField({ value: new StringField() }),
source: new SchemaField({ value: new StringField() }),
Expand Down
4 changes: 0 additions & 4 deletions module/documents/items/classFeature/class-feature-sheet.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ClassFeatureDataModel } from './class-feature-data-model.mjs';
import { onManageActiveEffect, prepareActiveEffectCategories } from '../../../helpers/effects.mjs';
import { InlineDamage } from '../../../helpers/inline-damage.mjs';
import { InlineRecovery } from '../../../helpers/inline-recovery.mjs';

export class FUClassFeatureSheet extends ItemSheet {
static get defaultOptions() {
Expand Down Expand Up @@ -117,8 +115,6 @@ export class FUClassFeatureSheet extends ItemSheet {

activateListeners(html) {
super.activateListeners(html);
InlineDamage.activateListeners(html, this.item);
InlineRecovery.activateListeners(html, this.item);

html.find('.effect-control').click((ev) => onManageActiveEffect(ev, this.item));

Expand Down
4 changes: 2 additions & 2 deletions module/documents/items/common/damage-data-model.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FU} from '../../../helpers/config.mjs';
import { FU } from '../../../helpers/config.mjs';

/**
* @property {boolean} hasDamage.value
Expand All @@ -11,7 +11,7 @@ export class DamageDataModel extends foundry.abstract.DataModel {
return {
hasDamage: new SchemaField({ value: new BooleanField() }),
value: new NumberField({ initial: 0, integer: true, nullable: false }),
type: new SchemaField({ value: new StringField({ initial: 'physical', blank: true, choices: Object.keys(FU.damageTypes) }) }),
type: new SchemaField({ value: new StringField({ initial: 'physical', choices: Object.keys(FU.damageTypes) }) }),
};
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FU} from '../../../helpers/config.mjs';
import { FU } from '../../../helpers/config.mjs';

/**
* @typedef {"minor", "heavy", "massive"} ImprovisedDamageType
Expand All @@ -17,7 +17,7 @@ export class ImprovisedDamageDataModel extends foundry.abstract.DataModel {
hasImpDamage: new SchemaField({ value: new BooleanField() }),
value: new NumberField({ initial: 0, integer: true, nullable: false }),
impType: new SchemaField({ value: new StringField({ initial: 'minor', choices: ['minor', 'heavy', 'massive'] }) }),
type: new SchemaField({ value: new StringField({ initial: 'physical', blank: true, choices: Object.keys(FU.damageTypes) }) }),
type: new SchemaField({ value: new StringField({ initial: 'physical', choices: Object.keys(FU.damageTypes) }) }),
};
}
}
2 changes: 1 addition & 1 deletion module/documents/items/shield/shield-data-model.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ShieldDataModel extends foundry.abstract.TypeDataModel {
category: new SchemaField({ value: new StringField({ initial: 'brawling', choices: Object.keys(FU.weaponCategories) }) }),
hands: new SchemaField({ value: new StringField({ initial: 'two-handed', choices: Object.keys(FU.handedness) }) }),
impType: new SchemaField({ value: new StringField({ initial: 'minor', choices: ['minor', 'heavy', 'massive'] }) }),
damageType: new SchemaField({ value: new StringField({ initial: 'physical', blank: true, choices: Object.keys(FU.damageTypes) }) }),
damageType: new SchemaField({ value: new StringField({ initial: 'physical', choices: Object.keys(FU.damageTypes) }) }),
isBehavior: new SchemaField({ value: new BooleanField() }),
weight: new SchemaField({ value: new NumberField({ initial: 1, min: 1, integer: true, nullable: false }) }),
isDualShield: new SchemaField({ value: new BooleanField() }),
Expand Down
10 changes: 5 additions & 5 deletions module/documents/items/weapon/weapon-data-model.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {FU} from '../../../helpers/config.mjs';
import {WeaponMigrations} from './weapon-migrations.mjs';
import {IsEquippedDataModel} from '../common/is-equipped-data-model.mjs';
import {ItemAttributesDataModel} from '../common/item-attributes-data-model.mjs';
import { FU } from '../../../helpers/config.mjs';
import { WeaponMigrations } from './weapon-migrations.mjs';
import { IsEquippedDataModel } from '../common/is-equipped-data-model.mjs';
import { ItemAttributesDataModel } from '../common/item-attributes-data-model.mjs';

/**
* @property {string} subtype.value
Expand Down Expand Up @@ -47,7 +47,7 @@ export class WeaponDataModel extends foundry.abstract.TypeDataModel {
category: new SchemaField({ value: new StringField({ initial: 'brawling', choices: Object.keys(FU.weaponCategories) }) }),
hands: new SchemaField({ value: new StringField({ initial: 'one-handed', choices: Object.keys(FU.handedness) }) }),
impType: new SchemaField({ value: new StringField({ initial: 'minor', choices: ['minor', 'heavy', 'massive'] }) }),
damageType: new SchemaField({ value: new StringField({ initial: 'physical', blank: true, choices: Object.keys(FU.damageTypes) }) }),
damageType: new SchemaField({ value: new StringField({ initial: 'physical', choices: Object.keys(FU.damageTypes) }) }),
isBehavior: new SchemaField({ value: new BooleanField() }),
weight: new SchemaField({ value: new NumberField({ initial: 1, min: 1, integer: true, nullable: false }) }),
isCustomWeapon: new SchemaField({ value: new BooleanField() }),
Expand Down
13 changes: 0 additions & 13 deletions module/documents/message/chat-message.mjs

This file was deleted.

17 changes: 13 additions & 4 deletions module/helpers/apply-damage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@ const affinityKeys = {
* @return {Promise<Awaited<unknown>[]>}
*/
export async function applyDamage(targets, damageType, total, modifiers, sourceName) {
const affinityType = damageType === 'physical' ? 'phys' : damageType;

const updates = [];
for (const actor of targets) {
const affinity = actor.system.affinities[affinityType].current;
let affinity = FU.affValue.none; // Default to no affinity
let affinityIcon = '';
let affinityString = '';
if (damageType in actor.system.affinities) {
affinity = actor.system.affinities[damageType].current;
affinityIcon = FU.affIcon[damageType];
}
affinityString = await renderTemplate('systems/projectfu/templates/chat/partials/inline-damage-icon.hbs', {
damageType: game.i18n.localize(FU.damageTypes[damageType]),
affinityIcon: affinityIcon,
});

const damageMod = affinityDamageModifier[affinity] ?? affinityDamageModifier[FU.affValue.none];
const damageTaken = -damageMod(total, modifiers);
updates.push(actor.modifyTokenAttribute('resources.hp', damageTaken, true));
Expand All @@ -90,7 +99,7 @@ export async function applyDamage(targets, damageType, total, modifiers, sourceN
message: affinityKeys[affinity](modifiers),
actor: actor.name,
damage: Math.abs(damageTaken),
type: game.i18n.localize(FU.damageTypes[damageType]),
type: affinityString,
from: sourceName,
}),
}),
Expand Down
Loading

0 comments on commit 07d3f11

Please sign in to comment.