Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
spyrella committed Feb 1, 2024
2 parents 24683e4 + 7fe41c3 commit e8c5a3a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@
"MonsterRule": "Monsters have no special rules",
"PlantRule": "Plants are Vulnerable to <b>(choose one: air, bolt, fire, ice)</b> damage.",
"UndeadRule": "Undead are Immune to <b>dark</b> and <b>poison</b> damage, immune to <b>poisoned</b> and Vulnerable to <b>light</b> damage.",
"CustomRule": "Custom NPC",
"UseEquipment": "Use Equipment?",
"Potency": "Potency",
"Area": "Area",
Expand Down
1 change: 1 addition & 0 deletions lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@
"MonsterRule": "I mostri non hanno regole speciali.",
"PlantRule": "Le piante sono Vulnerabili al danno da (scegliere uno tra aria, fulmine, fuoco, ghiaccio)",
"UndeadRule": "I non morti sono Immuni al danno da ombra e da veleno e Vulnerabili al danno da luce.",
"CustomRule": "Custom NPC",
"UseEquipment": "Use Equipment?",
"Potency": "Power",
"Area": "Area",
Expand Down
2 changes: 1 addition & 1 deletion module/documents/actors/npc/npc-data-model.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {BondDataModel} from '../common/bond-data-model.mjs';
* @property {number} derived.mdef.bonus
* @property {BonusesDataModel} bonuses
* @property {string} traits.value
* @property {'beast', 'construct', 'demon', 'elemental', 'humanoid', 'monster', 'plant', 'undead'} species.value
* @property {'beast', 'construct', 'demon', 'elemental', 'humanoid', 'monster', 'plant', 'undead', 'custom'} species.value
* @property {"", "minor", "major", "supreme"} villain.value
* @property {number} phases.value
* @property {string} multipart.value
Expand Down
43 changes: 30 additions & 13 deletions module/documents/items/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,52 @@ export class FUItem extends Item {
getWeaponDisplayData() {
const isWeaponOrShieldWithDual = this.type === 'weapon' || (this.type === 'shield' && this.system.isDualShield?.value);
const isBasic = this.type === 'basic';
// Check if this item is not a weapon or not a weapon/shield with dual
// Check if this item is not a weapon or not a weapon/shield with dual
if (!isBasic && !isWeaponOrShieldWithDual) {
return false;
}

function capitalizeFirst(string) {
if (typeof string !== 'string') {
// Handle the case where string is not a valid string
return string;
}
return string.charAt(0).toUpperCase() + string.slice(1);
}

const hrZeroText = this.system.rollInfo?.useWeapon?.hrZero?.value ? 'HR0' : 'HR';
const qualText = this.system.quality?.value || '';
let qualityString = '';

const attackAttributes = [this.system.attributes.primary.value.toUpperCase(), this.system.attributes.secondary.value.toUpperCase()].join(' + ');

const attackString = `【${attackAttributes}${this.system.accuracy.value > 0 ? ` +${this.system.accuracy.value}` : ''}`;

const damageString = `【${hrZeroText} + ${this.system.damage.value}${this.system.damageType.value}`;


const primaryAttribute = this.system.attributes?.primary?.value;
const secondaryAttribute = this.system.attributes?.secondary?.value;

const attackAttributes = [
(primaryAttribute || '').toUpperCase(),
(secondaryAttribute || '').toUpperCase()
].join(' + ');

const accuracyValue = this.system.accuracy?.value ?? 0;
const damageValue = this.system.damage?.value ?? 0;

const attackString = `【${attackAttributes}${accuracyValue > 0 ? ` +${accuracyValue}` : ''}`;

const hrZeroValue = this.system.rollInfo?.useWeapon?.hrZero?.value ?? false;
const damageTypeValue = this.system.damageType?.value || '';

const damageString = `【${hrZeroText} + ${damageValue}${damageTypeValue}`;

if (isWeaponOrShieldWithDual) {
qualityString = [capitalizeFirst(this.system.category.value), capitalizeFirst(this.system.hands.value), capitalizeFirst(this.system.type.value), qualText].filter(Boolean).join(' ⬥ ');
qualityString = [
capitalizeFirst(this.system.category?.value),
capitalizeFirst(this.system.hands?.value),
capitalizeFirst(this.system.type?.value),
qualText
].filter(Boolean).join(' ⬥ ');
} else if (isBasic) {
qualityString = [attackString, damageString, qualText].filter(Boolean).join(' ⬥ ');
}

return {
attackString,
damageString,
Expand Down Expand Up @@ -819,7 +836,7 @@ export class FUItem extends Item {
check: {
title: game.i18n.localize('FU.AccuracyCheck'),
attr1: {
attribute: attributes.primary.value,
attribute: attributes.primary?.value,
dice: this.actor.system.attributes[attributes.primary.value].current,
},
attr2: {
Expand Down
3 changes: 2 additions & 1 deletion module/helpers/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ FU.affTypeAbbr = {
4: 'FU.AffinityRepulsionAbbr',
};

FU.species = ['beast', 'construct', 'demon', 'elemental', 'humanoid', 'monster', 'plant', 'undead'];
FU.species = ['beast', 'construct', 'demon', 'elemental', 'humanoid', 'monster', 'plant', 'undead', 'custom'];

FU.villainTypes = ['minor', 'major', 'supreme'];

Expand All @@ -98,6 +98,7 @@ FU.speciesRule = {
monster: 'FU.MonsterRule',
plant: 'FU.PlantRule',
undead: 'FU.UndeadRule',
custom: 'FU.CustomRule',
};

FU.itemTypes = {
Expand Down
1 change: 0 additions & 1 deletion module/sheets/actor-standard-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ export class FUStandardActorSheet extends ActorSheet {
const li = $(ev.currentTarget).parents('.item');
const itemId = li.data('itemId');
const item = this.actor.items.get(itemId);
const currentEquipped = item.system.isEquipped.value;
const itemType = item.system.type;
const handType = item.system.hands;

Expand Down

0 comments on commit e8c5a3a

Please sign in to comment.