Initial Morale Implementation
Morale and Loyalty checks now on Monster and Retainer sheets. They roll against proper tables. For now, Loyalty is a rollable text field, but waiting on official RAW.master
							parent
							
								
									63509e310e
								
							
						
					
					
						commit
						2a45bd290e
					
				|  | @ -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" | ||||
| } | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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"), | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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++) { | ||||
|  |  | |||
|  | @ -30,7 +30,8 @@ | |||
|         <label>{{localize 'ACKS.details.morale'}}</label>   | ||||
|       </div> | ||||
|     </li> | ||||
|     <li class="attribute ability-score" data-stat="lr"> | ||||
|     <li class="flex2 check-field" data-stat="lr"> | ||||
|       <div class="check loyalty-check" title="{{localize 'ACKS.loyalty.check'}}"><a><i class="fas fa-dice"></i></a></div> | ||||
|       <div class="attribute-value"> | ||||
|         <input name="data.retainer.loyalty" type="text" value="{{data.retainer.loyalty}}" placeholder="Loyal" data-dtype="String" /> | ||||
|         <label>{{localize 'ACKS.Loyalty'}}</label>   | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue