ENH: Exploration rolls
							parent
							
								
									21e42928d2
								
							
						
					
					
						commit
						07fff9b20a
					
				|  | @ -54,7 +54,7 @@ | |||
|     "OSE.saves.breath.long": "Dragon Breath", | ||||
|     "OSE.saves.spell.short": "S", | ||||
|     "OSE.saves.spell.long": "Rod, Staff, Spell", | ||||
|     "OSE.saves.magic.long": "vs Magic", | ||||
|     "OSE.saves.magic.long": "Bonus vs Magic", | ||||
| 
 | ||||
|     "OSE.Health": "Hit Points", | ||||
|     "OSE.HealthMax": "Maximum Hit Points", | ||||
|  | @ -145,12 +145,13 @@ | |||
| 
 | ||||
|     "OSE.abilities.Requirements": "Requirements", | ||||
| 
 | ||||
|     "OSE.exploration.ListenDoor.long": "Listen at Door", | ||||
|     "OSE.exploration.ListenDoor.short": "Listen Door", | ||||
|     "OSE.exploration.OpenDoor.long": "Open Stuck Door", | ||||
|     "OSE.exploration.OpenDoor.short": "Open Door", | ||||
|     "OSE.exploration.SecretDoor.long": "Find Secret Door", | ||||
|     "OSE.exploration.SecretDoor.short": "Secret Door", | ||||
|     "OSE.exploration.RoomTrap.long": "Find Room Trap", | ||||
|     "OSE.exploration.RoomTrap.short": "Find Trap" | ||||
|     "OSE.ExplorationCheck": "Check", | ||||
|     "OSE.exploration.ld.long": "Listen at Door", | ||||
|     "OSE.exploration.ld.short": "Listen Door", | ||||
|     "OSE.exploration.od.long": "Open Stuck Door", | ||||
|     "OSE.exploration.od.short": "Open Door", | ||||
|     "OSE.exploration.sd.long": "Find Secret Door", | ||||
|     "OSE.exploration.sd.short": "Secret Door", | ||||
|     "OSE.exploration.ft.long": "Find Room Trap", | ||||
|     "OSE.exploration.ft.short": "Find Trap" | ||||
| } | ||||
|  | @ -123,6 +123,13 @@ export class OseActorSheetCharacter extends OseActorSheet { | |||
|       actorObject.rollCheck(score, { event: event }); | ||||
|     }); | ||||
| 
 | ||||
|     html.find(".exploration .attribute-name a").click((ev) => { | ||||
|       let actorObject = this.actor; | ||||
|       let element = event.currentTarget; | ||||
|       let expl = element.parentElement.parentElement.dataset.exploration; | ||||
|       actorObject.rollExploration(expl, { event: event }); | ||||
|     }); | ||||
| 
 | ||||
|     html.find(".attack a").click(ev => { | ||||
|       let actorObject = this.actor; | ||||
|       let element = event.currentTarget; | ||||
|  |  | |||
|  | @ -56,6 +56,28 @@ export class OseActor extends Actor { | |||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   rollExploration(expl, options = {}) { | ||||
|     const label = game.i18n.localize(`OSE.exploration.${expl}.long`); | ||||
|     const rollParts = ['1d6']; | ||||
| 
 | ||||
|     const data = {...this.data, ...{ | ||||
|       rollData : { | ||||
|         type: 'Exploration', | ||||
|         stat: expl | ||||
|       } | ||||
|     }}; | ||||
| 
 | ||||
|     // Roll and return
 | ||||
|     return OseDice.Roll({ | ||||
|       event: options.event, | ||||
|       parts: rollParts, | ||||
|       data: data, | ||||
|       speaker: ChatMessage.getSpeaker({ actor: this }), | ||||
|       flavor: `${label} ${game.i18n.localize('OSE.ExplorationCheck')}`, | ||||
|       title: `${label} ${game.i18n.localize('OSE.ExplorationCheck')}`, | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   rollAttack(attack, options={}) { | ||||
|     const label = game.i18n.localize(`OSE.${attack}`); | ||||
|     const rollParts = ['1d20',]; | ||||
|  |  | |||
|  | @ -46,6 +46,14 @@ export class OseDice { | |||
|       } else { | ||||
|         details = `<div class='roll-result roll-fail'><b>Failure</b> (${sc})</div>`; | ||||
|       } | ||||
|     } else if (data.rollData.type == "Exploration") { | ||||
|       // Exploration Checks
 | ||||
|       let sc = data.data.exploration[data.rollData.stat]; | ||||
|       if (roll.total <= sc) { | ||||
|         details = `<div class='roll-result roll-success'><b>Success!</b> (${sc})</div>`; | ||||
|       } else { | ||||
|         details = `<div class='roll-result roll-fail'><b>Failure</b> (${sc})</div>`; | ||||
|       } | ||||
|     } | ||||
|     return details; | ||||
|   } | ||||
|  |  | |||
|  | @ -1,29 +1,29 @@ | |||
| <ul class="attributes exploration flexrow"> | ||||
|   <li class="attribute flexrow"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.ListenDoor.long'}}"><a>{{ localize "OSE.exploration.ListenDoor.short" }}</a></h4> | ||||
|   <li class="attribute flexrow" data-exploration="ld"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.ld.long'}}"><a>{{ localize "OSE.exploration.ld.short" }}</a></h4> | ||||
|     <div class="attribute-value"> | ||||
|       <input name="data.exploration.ld" type="text" value="{{data.exploration.ld}}" data-dtype="Number" placeholder="0" /> | ||||
|     </div> | ||||
|   </li> | ||||
|   <li class="attribute flexrow"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.OpenDoor.long'}}"><a>{{ localize "OSE.exploration.OpenDoor.short" }}</a> | ||||
|   <li class="attribute flexrow" data-exploration="od"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.od.long'}}"><a>{{ localize "OSE.exploration.od.short" }}</a> | ||||
|     </h4> | ||||
|     <div class="attribute-value"> | ||||
|       <input name="data.exploration.od" type="text" value="{{data.exploration.od}}" placeholder="0" data-dtype="String" /> | ||||
|     </div> | ||||
|   </li> | ||||
|   <li class="attribute flexrow"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.SecretDoor.long'}}"><a>{{ localize "OSE.exploration.SecretDoor.short" }}</a> | ||||
|   <li class="attribute flexrow" data-exploration="sd"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.sd.long'}}"><a>{{ localize "OSE.exploration.sd.short" }}</a> | ||||
|     </h4> | ||||
|     <div class="attribute-value"> | ||||
|       <input name="data.exploration.sd" type="text" value="{{data.exploration.sd}}" placeholder="0" data-dtype="String" /> | ||||
|     </div> | ||||
|   </li> | ||||
|   <li class="attribute flexrow"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.RoomTrap.long'}}"><a>{{ localize "OSE.exploration.RoomTrap.short" }}</a> | ||||
|   <li class="attribute flexrow" data-exploration="ft"> | ||||
|     <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.ft.long'}}"><a>{{ localize "OSE.exploration.ft.short" }}</a> | ||||
|     </h4> | ||||
|     <div class="attribute-value"> | ||||
|       <input name="data.exploration.rt" type="text" value="{{data.exploration.rt}}" placeholder="0" data-dtype="String" /> | ||||
|       <input name="data.exploration.ft" type="text" value="{{data.exploration.ft}}" placeholder="0" data-dtype="String" /> | ||||
|     </div> | ||||
|   </li> | ||||
| </ul> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue