diff --git a/src/lang/en.json b/src/lang/en.json index c4f4806..05607bb 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -290,5 +290,18 @@ "ACKS.reaction.Unfriendly": "{name} is Unfriendly and may attack", "ACKS.reaction.Neutral": "{name} is Neutral and uncertain", "ACKS.reaction.Indifferent": "{name} is Indifferent and uninterested", - "ACKS.reaction.Friendly": "{name} is Friendly and helpful" + "ACKS.reaction.Friendly": "{name} is Friendly and helpful", + + "ACKS.loyalty.check": "Henchman Loyalty Check", + "ACKS.loyalty.hostility": "Becomes Hostile", + "ACKS.loyalty.resignation": "Tenders Resignation", + "ACKS.loyalty.grudging": "Grudging Loyalty", + "ACKS.loyalty.loyal": "Loyal", + "ACKS.loyalty.fanatic": "Fanatic Loyalty", + + "ACKS.morale.retreat": "Retreat", + "ACKS.morale.fightingWithdrawal": "Fighting Withdrawl", + "ACKS.morale.fight": "Fight On", + "ACKS.morale.advanceAndPursue": "Advance and Pursue", + "ACKS.morale.fightToTheDeath": "Victory or Death" } diff --git a/src/module/actor/character-sheet.js b/src/module/actor/character-sheet.js index 38872ab..f83df82 100644 --- a/src/module/actor/character-sheet.js +++ b/src/module/actor/character-sheet.js @@ -144,6 +144,11 @@ export class AcksActorSheetCharacter extends AcksActorSheet { let actorObject = this.actor; actorObject.rollMorale({ event: event }); }); + + html.find(".loyalty-check a").click((ev) => { + let actorObject = this.actor; + actorObject.rollLoyalty({ event: event }); + }); html.find(".ability-score .attribute-name a").click((ev) => { let actorObject = this.actor; diff --git a/src/module/actor/entity.js b/src/module/actor/entity.js index 8a2be22..21a157b 100644 --- a/src/module/actor/entity.js +++ b/src/module/actor/entity.js @@ -162,21 +162,40 @@ export class AcksActor extends Actor { rollMorale(options = {}) { const rollParts = ["2d6"]; + rollParts.push(this.data.data.details.morale); const data = { actor: this.data, roll: { - type: "below", - target: this.data.data.details.morale, + type: "table", + table: { + 1: game.i18n.format("ACKS.morale.retreat", { + name: this.data.name, + }), + 3: game.i18n.format("ACKS.morale.fightingWithdrawal", { + name: this.data.name, + }), + 6: game.i18n.format("ACKS.morale.fight", { + name: this.data.name, + }), + 9: game.i18n.format("ACKS.morale.advanceAndPursue", { + name: this.data.name, + }), + 12: game.i18n.format("ACKS.morale.fightToTheDeath", { + name: this.data.name, + }), + }, }, }; + let skip = options.event && options.event.ctrlKey; + // Roll and return return AcksDice.Roll({ event: options.event, parts: rollParts, data: data, - skipDialog: true, + skipDialog: skip, speaker: ChatMessage.getSpeaker({ actor: this }), flavor: game.i18n.localize("ACKS.roll.morale"), title: game.i18n.localize("ACKS.roll.morale"), @@ -184,26 +203,44 @@ export class AcksActor extends Actor { } rollLoyalty(options = {}) { - const label = game.i18n.localize(`ACKS.roll.loyalty`); const rollParts = ["2d6"]; + rollParts.push(this.data.data.details.morale); const data = { actor: this.data, roll: { - type: "below", - target: this.data.data.retainer.loyalty, + type: "table", + table: { + 1: game.i18n.format("ACKS.loyalty.hostility", { + name: this.data.name, + }), + 3: game.i18n.format("ACKS.loyalty.resignation", { + name: this.data.name, + }), + 6: game.i18n.format("ACKS.loyalty.grudging", { + name: this.data.name, + }), + 9: game.i18n.format("ACKS.loyalty.loyal", { + name: this.data.name, + }), + 12: game.i18n.format("ACKS.loyalty.fanatic", { + name: this.data.name, + }), + }, }, }; + let skip = options.event && options.event.ctrlKey; + // Roll and return return AcksDice.Roll({ event: options.event, parts: rollParts, data: data, - skipDialog: true, + skipDialog: skip, speaker: ChatMessage.getSpeaker({ actor: this }), - flavor: label, - title: label, + flavor: game.i18n.localize("ACKS.loyalty.check"), + title: game.i18n.localize("ACKS.loyalty.check"), }); } diff --git a/src/module/dice.js b/src/module/dice.js index 58fb885..f6c8cf7 100644 --- a/src/module/dice.js +++ b/src/module/dice.js @@ -16,7 +16,7 @@ export class AcksDice { result.isFailure = true; } } else if (data.roll.type == "below") { - // MORALE + // ? if (roll.total <= result.target) { result.isSuccess = true; } else { @@ -35,7 +35,11 @@ export class AcksDice { roll._total = 1; } } else if (data.roll.type == "table") { - // Reaction + // Reaction, MORALE + // Roll cannot be less than 2 on a 2d6 roll + if (roll.total < 2) { + roll._total = 2 + } let table = data.roll.table; let output = ""; for (let i = 0; i <= roll.total; i++) { diff --git a/src/templates/actors/partials/character-header.html b/src/templates/actors/partials/character-header.html index b11169f..51e4d9f 100644 --- a/src/templates/actors/partials/character-header.html +++ b/src/templates/actors/partials/character-header.html @@ -30,7 +30,8 @@ -