Skip to content

Commit

Permalink
Fix various tooltip issues, update library version
Browse files Browse the repository at this point in the history
  • Loading branch information
moo-man committed Oct 30, 2024
1 parent 6142239 commit 91ca553
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 203 deletions.
24 changes: 12 additions & 12 deletions modules/apps/roll-dialog/attack-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export default class AttackDialog extends SkillDialog
if (!["roll", "none"].includes(this.fields.hitLocation))
{
this.fields.modifier -= 20;
this.tooltips.addModifier(-20, game.i18n.localize('ROLL.CalledShot'))
this.tooltips.add("modifier", -20, game.i18n.localize('ROLL.CalledShot'))
}
if (game.settings.get("wfrp4e", "useGroupAdvantage"))
{
if (this.userEntry.charging)
{
this.fields.modifier += 10;
this.tooltips.addModifier(10, game.i18n.localize('Charging'))
this.tooltips.add("modifier", 10, game.i18n.localize('Charging'))
}
}

Expand All @@ -42,19 +42,19 @@ export default class AttackDialog extends SkillDialog
if (attacker.test.item.properties?.qualities.fast && this.item.attackType == "melee" && !properties?.qualities.fast)
{
this.fields.modifier += -10
this.tooltips.addModifier(-10, game.i18n.localize('CHAT.TestModifiers.FastWeapon'))
this.tooltips.add("modifier", -10, game.i18n.localize('CHAT.TestModifiers.FastWeapon'))
}

if (properties.flaws.unbalanced)
{
this.fields.slBonus -= 1;
this.tooltips.addSLBonus(-1, game.i18n.localize("PROPERTY.Unbalanced"))
this.tooltips.add("slBonus", -1, game.i18n.localize("PROPERTY.Unbalanced"))
}

if(attacker.test.item.properties?.qualities?.wrap)
{
this.fields.slBonus -= 1
this.tooltips.addSLBonus(-1, game.i18n.localize('CHAT.TestModifiers.WrapDefend'));
this.tooltips.add("slBonus", -1, game.i18n.localize('CHAT.TestModifiers.WrapDefend'));
}

//Size Differences
Expand All @@ -65,7 +65,7 @@ export default class AttackDialog extends SkillDialog
if (this.item.attackType == "melee") {
let slBonus = (-2 * sizeDiff);
this.fields.slBonus += slBonus
this.tooltips.addSLBonus(slBonus, game.i18n.localize('CHAT.TestModifiers.DefendingLarger'))
this.tooltips.add("slBonus", slBonus, game.i18n.localize('CHAT.TestModifiers.DefendingLarger'))
}
}
}
Expand All @@ -75,7 +75,7 @@ export default class AttackDialog extends SkillDialog
if (this.item.attackType == "ranged" && target.actor.statuses.has("engaged"))
{
this.fields.modifier -= 20;
this.tooltips.addModifier(-20, game.i18n.localize("EFFECT.ShootingAtEngagedTarget"));
this.tooltips.add("modifier", -20, game.i18n.localize("EFFECT.ShootingAtEngagedTarget"));
this.options.engagedModifier = -20;
}

Expand All @@ -86,7 +86,7 @@ export default class AttackDialog extends SkillDialog
if (sizeDiff < 0 && (this.item.attackType == "melee" || target.actor.sizeNum <= 3))
{
sizeModifier += 10;
this.tooltips.addModifier(10, game.i18n.localize('CHAT.TestModifiers.AttackingLarger'));
this.tooltips.add("modifier", 10, game.i18n.localize('CHAT.TestModifiers.AttackingLarger'));
}
// Attacking a larger creature with ranged
else if (this.item.attackType === "ranged")
Expand All @@ -107,7 +107,7 @@ export default class AttackDialog extends SkillDialog
if (sizeModifier)
{
const text = (game.i18n.format('CHAT.TestModifiers.ShootingSizeModifier', { size: game.wfrp4e.config.actorSizes[target.actor.details.size.value] }))
this.tooltips.addModifier(sizeModifier, text)
this.tooltips.add("modifier", sizeModifier, text)
}
}

Expand All @@ -130,7 +130,7 @@ export default class AttackDialog extends SkillDialog
if (mountSizeDiff >= 1)
{
this.fields.modifier += 20;
this.tooltips.addModifier(20, game.i18n.localize('CHAT.TestModifiers.AttackerMountLarger'));
this.tooltips.add("modifier", 20, game.i18n.localize('CHAT.TestModifiers.AttackerMountLarger'));
}
}
// Attacking a creature on a larger mount
Expand All @@ -146,11 +146,11 @@ export default class AttackDialog extends SkillDialog
if ((this.item.reachNum || 0) >= 5)
{
// TODO this tooltip won't show up because 0 value
this.tooltips.addModifier(0, `${game.i18n.localize('CHAT.TestModifiers.IgnoreDefenderMountLarger')}`);
this.tooltips.add("modifier", 0, `${game.i18n.localize('CHAT.TestModifiers.IgnoreDefenderMountLarger')}`);
}
else
{
this.tooltips.addModifier(-10, game.i18n.localize('CHAT.TestModifiers.DefenderMountLarger'));
this.tooltips.add("modifier", -10, game.i18n.localize('CHAT.TestModifiers.DefenderMountLarger'));
this.fields.modifier -= 10;
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/roll-dialog/characteristic-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class CharacteristicDialog extends RollDialog {

if (this.options.dodge && this.actor.isMounted) {
this.fields.modifier -= 20
this.tooltips.addModifier(-20, game.i18n.localize("EFFECT.DodgeMount"));
this.tooltips.add("modifier", -20, game.i18n.localize("EFFECT.DodgeMount"));
}
}

Expand All @@ -75,7 +75,7 @@ export default class CharacteristicDialog extends RollDialog {
if (!game.settings.get("wfrp4e", "mooQualities") || this.options.dodge)
{
this.fields.slBonus += 1
this.tooltips.addSLBonus(1, game.i18n.localize('CHAT.TestModifiers.SlowDefend'));
this.tooltips.add("slBonus", 1, game.i18n.localize('CHAT.TestModifiers.SlowDefend'));
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/apps/roll-dialog/skill-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class SkillDialog extends CharacteristicDialog {
if (this.item.name.includes(game.i18n.localize("NAME.Stealth"))) {
if (stealthPenaltyValue) {
this.fields.modifier += stealthPenaltyValue
this.tooltips.addModifier(stealthPenaltyValue, game.i18n.localize("SHEET.ArmourPenalties"));
this.tooltips.add("modifier", stealthPenaltyValue, game.i18n.localize("SHEET.ArmourPenalties"));
}
}
}
Expand All @@ -151,7 +151,7 @@ export default class SkillDialog extends CharacteristicDialog {
let skillValue = (this.skill?.system.advances.value + this.skill?.system.modifier.value) || 0
if (skillValue)
{
breakdown.skill = `${HandlebarsHelpers.numberFormat(skillValue, {hash :{sign: true}})} (${this.skill.name})`
breakdown.skill = `${this.skill.name} ${HandlebarsHelpers.numberFormat(skillValue, {hash :{sign: true}})}`
}
}
return breakdown;
Expand Down
178 changes: 0 additions & 178 deletions modules/apps/roll-dialog/tooltips.js

This file was deleted.

8 changes: 4 additions & 4 deletions modules/apps/roll-dialog/weapon-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ export default class WeaponDialog extends AttackDialog {
if (this.item.offhand.value && !this.item.twohanded.value && !(this.item.weaponGroup.value == "parry" && this.item.properties.qualities.defensive))
{
this.fields.modifier += -20
this.tooltips.addModifier(-20, game.i18n.localize("SHEET.Offhand"))
this.tooltips.add("modifier", -20, game.i18n.localize("SHEET.Offhand"))

const ambiMod = Math.min(20, this.actor.flags.ambi * 10) // TODO could be handled by ambidextrous effect
this.fields.modifier += ambiMod;
if (this.actor.flags.ambi) {
this.tooltips.addModifier(ambiMod, game.i18n.localize("NAME.Ambi"));
this.tooltips.add("modifier", ambiMod, game.i18n.localize("NAME.Ambi"));
}
}
}
Expand Down Expand Up @@ -166,7 +166,7 @@ export default class WeaponDialog extends AttackDialog {
if (engagedMod)
{
this.fields.modifier += engagedMod
this.tooltips.addModifier(engagedMod, game.i18n.localize("EFFECT.ShooterEngaged"));
this.tooltips.add("modifier", engagedMod, game.i18n.localize("EFFECT.ShooterEngaged"));
}
}
else
Expand All @@ -175,7 +175,7 @@ export default class WeaponDialog extends AttackDialog {
if (rangeMod)
{
this.fields.modifier += rangeMod
this.tooltips.addModifier(rangeMod, `${game.i18n.localize("Range")} - ${currentBand}`);
this.tooltips.add("modifier", rangeMod, `${game.i18n.localize("Range")} - ${currentBand}`);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "wfrp4e",
"title": "Warhammer Fantasy Roleplay 4th Edition",
"description": "A comprehensive system for running grim and perilous games of Warhammer Fantasy Roleplay in the Foundry VTT environment.",
"version": "8.2.1",
"version": "8.2.2",
"authors" : [
{
"name": "Moo Man",
Expand Down Expand Up @@ -63,15 +63,15 @@
"requires": [{
"id": "warhammer-lib",
"type": "module",
"manifest": "https://raw.githubusercontent.com/moo-man/WarhammerLibrary-FVTT/1.1.2/module.json",
"manifest": "https://raw.githubusercontent.com/moo-man/WarhammerLibrary-FVTT/1.2.0/module.json",
"compatibility": {
"minimum" : "1.1.2",
"verified": "1.1.2"
"minimum" : "1.2.0",
"verified": "1.2.0"
}
}]
},
"socket": true,
"manifest" : "https://github.com/moo-man/WFRP4e-FoundryVTT/releases/latest/download/system.json",
"download" : "https://github.com/moo-man/WFRP4e-FoundryVTT/releases/download/8.2.1/wfrp4e.zip",
"download" : "https://github.com/moo-man/WFRP4e-FoundryVTT/releases/download/8.2.2/wfrp4e.zip",
"url" : "https://github.com/moo-man/WFRP4e-FoundryVTT"
}

0 comments on commit 91ca553

Please sign in to comment.