From 71a3af85ddb2f21e4e4e73753b23e466af094caf Mon Sep 17 00:00:00 2001 From: Vlyan Date: Tue, 19 Jan 2021 12:10:04 +0100 Subject: [PATCH] Xp not in curriculum are now rounded up (down before) No more automation in stats for Npc (these cheaters !) 20Q Pushed the step3 item's limit to 20 (10 previous) Gm Tool no longer stuck the escape key process --- CHANGELOG.md | 2 ++ system/scripts/actor.js | 26 +++++++++---------- system/scripts/combat.js | 4 +-- system/scripts/dice/gm-tools-dialog.js | 10 ++++++- .../actors/character/attributes.html | 16 +++++++----- system/templates/actors/npc/attributes.html | 16 +++++++----- .../actors/twenty-questions-dialog.html | 2 +- 7 files changed, 47 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db50129..46c63f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ - Added a visual indicator for equipped / readied - Now only equipped armor / weapon will show in conflict tab, and all armors/weapons now show in inventory tab - Xp not in curriculum are now rounded up (down before) + - No more automation in stats for Npc (these cheaters !) +- 20Q Pushed the step3 item's limit to 20 (10 previous) ## 1.0.0 - First public release - Removed the 0ds if no skill point diff --git a/system/scripts/actor.js b/system/scripts/actor.js index a61f581..4151d01 100644 --- a/system/scripts/actor.js +++ b/system/scripts/actor.js @@ -76,22 +76,22 @@ export class ActorL5r5e extends Actor { if (["character", "npc"].includes(this.data.type)) { const data = this.data.data; - data.endurance = (Number(data.rings.earth) + Number(data.rings.fire)) * 2; - data.composure = (Number(data.rings.earth) + Number(data.rings.water)) * 2; - data.focus = Number(data.rings.air) + Number(data.rings.fire); - - // Attributes bars - data.void_points.max = data.rings.void; - data.fatigue.max = data.endurance; - data.strife.max = data.composure; - - // if compromise, vigilance = 1 - if (data.strife.value > data.strife.max) { - data.vigilance = 1; - } else { + // No automation for npc as they cheat in stats + if (this.data.type === "character") { + data.endurance = (Number(data.rings.earth) + Number(data.rings.fire)) * 2; + data.composure = (Number(data.rings.earth) + Number(data.rings.water)) * 2; + data.focus = Number(data.rings.air) + Number(data.rings.fire); data.vigilance = Math.ceil((Number(data.rings.air) + Number(data.rings.water)) / 2); } + // Attributes bars + data.fatigue.max = data.endurance; + data.strife.max = data.composure; + data.void_points.max = data.rings.void; + + // if compromise, vigilance = 1 + data.is_compromised = data.strife.value > data.strife.max; + // Make sure void points are never greater than max if (data.void_points.value > data.void_points.max) { data.void_points.value = data.void_points.max; diff --git a/system/scripts/combat.js b/system/scripts/combat.js index c6c01db..161ffcd 100644 --- a/system/scripts/combat.js +++ b/system/scripts/combat.js @@ -59,7 +59,7 @@ export class CombatL5r5e extends Combat { if (combatant.actor.data.type === "npc" && combatant.actor.data.data.type === "minion") { // Minion NPCs can generate initiative value without a check, using their focus or vigilance attribute - initiative = cfg.prepared.minion ? data.focus : data.vigilance; + initiative = cfg.prepared.minion ? data.focus : data.is_compromised ? 1 : data.vigilance; } else { // PC and Adversary const isPc = combatant.actor.data.type === "character"; @@ -69,7 +69,7 @@ export class CombatL5r5e extends Combat { if (isPrepared === "null") { isPrepared = data.prepared; } - initiative = isPrepared ? data.focus : data.vigilance; + initiative = isPrepared ? data.focus : data.is_compromised ? 1 : data.vigilance; // Roll formula if (!formula) { diff --git a/system/scripts/dice/gm-tools-dialog.js b/system/scripts/dice/gm-tools-dialog.js index baf2e9b..f828555 100644 --- a/system/scripts/dice/gm-tools-dialog.js +++ b/system/scripts/dice/gm-tools-dialog.js @@ -48,7 +48,15 @@ export class GmToolsDialog extends FormApplication { * @override */ close() { - // nothing ! + // TODO better implementation needed : see KeyboardManager._onEscape(event, up, modifiers) + // This windows is always open, so esc key si stuck at step 2 : Object.keys(ui.windows).length > 0 + // Case 3 (GM) - release controlled objects + if (canvas?.ready && game.user.isGM && Object.keys(canvas.activeLayer._controlled).length) { + canvas.activeLayer.releaseAll(); + } else { + // Case 4 - toggle the main menu + ui.menu.toggle(); + } } /** diff --git a/system/templates/actors/character/attributes.html b/system/templates/actors/character/attributes.html index 33720ef..9948d52 100644 --- a/system/templates/actors/character/attributes.html +++ b/system/templates/actors/character/attributes.html @@ -2,7 +2,7 @@
  • {{ localize 'l5r5e.attributes.focustip' }}

  • -
  • +
  • {{ localize 'l5r5e.attributes.vigilancetip' }}

  • @@ -39,7 +43,7 @@ \ No newline at end of file diff --git a/system/templates/actors/npc/attributes.html b/system/templates/actors/npc/attributes.html index 33720ef..00249b4 100644 --- a/system/templates/actors/npc/attributes.html +++ b/system/templates/actors/npc/attributes.html @@ -2,7 +2,7 @@
  • {{ localize 'l5r5e.attributes.focustip' }}

  • -
  • +
  • {{ localize 'l5r5e.attributes.vigilancetip' }}

  • @@ -39,7 +43,7 @@ \ No newline at end of file diff --git a/system/templates/actors/twenty-questions-dialog.html b/system/templates/actors/twenty-questions-dialog.html index dbe9650..aeb35cf 100644 --- a/system/templates/actors/twenty-questions-dialog.html +++ b/system/templates/actors/twenty-questions-dialog.html @@ -236,7 +236,7 @@ {{localize 'l5r5e.twenty_questions.part2.outfit'}} - {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.equipment stepName='step3.equipment' itemType='items' hideDndAt=10 }} + {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.equipment stepName='step3.equipment' itemType='items' hideDndAt=20 }}