ENH: Appearing rolls
							parent
							
								
									5946fbf804
								
							
						
					
					
						commit
						13f4e9ac7d
					
				|  | @ -38,6 +38,7 @@ | |||
|     "OSE.RetainerWage": "Wage", | ||||
|     "OSE.RetainerUpkeep": "Upkeep", | ||||
|     "OSE.Appearing": "NA", | ||||
|     "OSE.AppearingCheck": "Appearing Check", | ||||
|     "OSE.Attack": "Attack", | ||||
|     "OSE.Encumbrance": "Encumbrance", | ||||
| 
 | ||||
|  |  | |||
|  | @ -244,6 +244,37 @@ export class OseActor extends Actor { | |||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   rollAppearing(options = {}) { | ||||
|     const rollParts = []; | ||||
|     let label = ""; | ||||
|     if (options.check == "wilderness") { | ||||
|       rollParts.push(this.data.data.details.appearing.w); | ||||
|       label = "(2)"; | ||||
|     } else { | ||||
|       rollParts.push(this.data.data.details.appearing.d); | ||||
|       label = "(1)"; | ||||
|     } | ||||
|     const data = { | ||||
|       ...this.data, | ||||
|       ...{ | ||||
|         rollData: { | ||||
|           type: "Appearing", | ||||
|         }, | ||||
|       }, | ||||
|     }; | ||||
| 
 | ||||
|     // Roll and return
 | ||||
|     return OseDice.Roll({ | ||||
|       event: options.event, | ||||
|       parts: rollParts, | ||||
|       data: data, | ||||
|       skipDialog: true, | ||||
|       speaker: ChatMessage.getSpeaker({ actor: this }), | ||||
|       flavor: `${game.i18n.localize('OSE.AppearingCheck')} ${label}`, | ||||
|       title: `${game.i18n.localize('OSE.AppearingCheck')} ${label}`, | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   rollExploration(expl, options = {}) { | ||||
|     const label = game.i18n.localize(`OSE.exploration.${expl}.long`); | ||||
|     const rollParts = ["1d6"]; | ||||
|  |  | |||
|  | @ -179,6 +179,12 @@ export class OseActorSheetMonster extends OseActorSheet { | |||
|       actorObject.rollReaction({ event: event }); | ||||
|     }); | ||||
| 
 | ||||
|     html.find(".appearing-check a").click((ev) => { | ||||
|       let actorObject = this.actor; | ||||
|       let check = $(ev.currentTarget).closest('.check-field').data('check'); | ||||
|       actorObject.rollAppearing({ event: event, check: check }); | ||||
|     }); | ||||
| 
 | ||||
|     html | ||||
|       .find(".counter input") | ||||
|       .click((ev) => ev.target.select()) | ||||
|  |  | |||
|  | @ -3,11 +3,21 @@ | |||
|   min-width: 460px; | ||||
|   .header-details { | ||||
|     .summary { | ||||
|       .morale-check,.reaction-check { | ||||
|         line-height: 35px; | ||||
|         flex: 0 0 20px; | ||||
|       .check-field { | ||||
|         &:hover { | ||||
|           color: $colorDark; | ||||
|           .check { | ||||
|             display: block; | ||||
|           } | ||||
|         } | ||||
|         .check { | ||||
|           display: none; | ||||
|           line-height: 35px; | ||||
|           flex: 0 0 20px; | ||||
|           position: absolute; | ||||
|           font-size: 12px; | ||||
|           &:hover { | ||||
|             color: $colorDark; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | @ -21,6 +31,11 @@ | |||
|       justify-content: space-around; | ||||
|       flex-direction: column; | ||||
|       height: 100%; | ||||
|       .attribute-row { | ||||
|         .attributes { | ||||
|           justify-content: space-between; | ||||
|         } | ||||
|       } | ||||
|       .attribute-row { | ||||
|         .attribute-group { | ||||
|           margin: 5px; | ||||
|  | @ -32,7 +47,7 @@ | |||
|           flex: 0 0 85px; | ||||
|         } | ||||
|         &.saving-throw { | ||||
|           flex: 1; | ||||
|           flex: 0 0 40px; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  |  | |||
|  | @ -149,7 +149,10 @@ | |||
|           "table": "", | ||||
|           "type": "" | ||||
|         }, | ||||
|         "appearing": "", | ||||
|         "appearing": { | ||||
|           "d": 0, | ||||
|           "w": 0 | ||||
|         }, | ||||
|         "morale": 0 | ||||
|       }, | ||||
|       "attacks": "" | ||||
|  |  | |||
|  | @ -4,22 +4,34 @@ | |||
|     <input name="name" type="text" value="{{actor.name}}" placeholder="{{localize 'OSE.Name'}}" /> | ||||
|   </h1> | ||||
|   <ul class="summary flexrow"> | ||||
|     <li class="flex"> | ||||
|       <input type="text" name="data.details.alignment" value="{{data.details.alignment}}" /> | ||||
|       <label>{{localize 'OSE.Alignment'}}</label> | ||||
|     <li class="flex2 flexrow check-field"> | ||||
|       <div> | ||||
|         <input type="text" name="data.details.alignment" value="{{data.details.alignment}}" /> | ||||
|         <label>{{localize 'OSE.Alignment'}}</label> | ||||
|       </div> | ||||
|       <div class="check reaction-check" title="{{localize 'OSE.ReactionCheck'}}"><a><i class="fas fa-dice"></i></a></div> | ||||
|     </li> | ||||
|     <li class="reaction-check" title="{{localize 'OSE.ReactionCheck'}}"><a><i class="fas fa-dice"></i></a></li> | ||||
|     <li> | ||||
|       <input type="text" name="data.details.appearing" value="{{data.details.appearing}}" /> | ||||
|       <label>{{localize 'OSE.Appearing'}}</label> | ||||
|     <li class="flexrow check-field" data-check="dungeon"> | ||||
|       <div> | ||||
|         <input type="text" name="data.details.appearing.d" value="{{data.details.appearing.d}}" /> | ||||
|         <label>{{localize 'OSE.Appearing'}}</label> | ||||
|       </div> | ||||
|       <div class="check appearing-check" title="{{localize 'OSE.AppearingCheck'}}"><a><i class="fas fa-dice"></i></a></div> | ||||
|     </li> | ||||
|     <li class="flexrow check-field" data-check="wilderness"> | ||||
|       <div> | ||||
|         (<input type="text" name="data.details.appearing.w" value="{{data.details.appearing.w}}" />) | ||||
|         <label>{{localize 'OSE.Appearing'}}</label> | ||||
|       </div> | ||||
|       <div class="check appearing-check" title="{{localize 'OSE.AppearingCheck'}}"><a><i class="fas fa-dice"></i></a></div> | ||||
|     </li> | ||||
|     {{#if config.morale}} | ||||
|     <li class="flexrow"> | ||||
|     <li class="flexrow check-field"> | ||||
|       <div> | ||||
|         <input type="text" name="data.details.morale" value="{{data.details.morale}}" /> | ||||
|         <label>{{localize 'OSE.Morale'}}</label>   | ||||
|       </div> | ||||
|       <div class="morale-check" title="{{localize 'OSE.MoraleCheck'}}"><a><i class="fas fa-dice"></i></a></div> | ||||
|       <div class="check morale-check" title="{{localize 'OSE.MoraleCheck'}}"><a><i class="fas fa-dice"></i></a></div> | ||||
|     </li> | ||||
|     {{/if}} | ||||
|   </ul> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue