ENH: Exploration rolls

master
U~man 2020-07-04 12:58:56 +02:00
parent 21e42928d2
commit 07fff9b20a
5 changed files with 56 additions and 18 deletions

View File

@ -54,7 +54,7 @@
"OSE.saves.breath.long": "Dragon Breath", "OSE.saves.breath.long": "Dragon Breath",
"OSE.saves.spell.short": "S", "OSE.saves.spell.short": "S",
"OSE.saves.spell.long": "Rod, Staff, Spell", "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.Health": "Hit Points",
"OSE.HealthMax": "Maximum Hit Points", "OSE.HealthMax": "Maximum Hit Points",
@ -145,12 +145,13 @@
"OSE.abilities.Requirements": "Requirements", "OSE.abilities.Requirements": "Requirements",
"OSE.exploration.ListenDoor.long": "Listen at Door", "OSE.ExplorationCheck": "Check",
"OSE.exploration.ListenDoor.short": "Listen Door", "OSE.exploration.ld.long": "Listen at Door",
"OSE.exploration.OpenDoor.long": "Open Stuck Door", "OSE.exploration.ld.short": "Listen Door",
"OSE.exploration.OpenDoor.short": "Open Door", "OSE.exploration.od.long": "Open Stuck Door",
"OSE.exploration.SecretDoor.long": "Find Secret Door", "OSE.exploration.od.short": "Open Door",
"OSE.exploration.SecretDoor.short": "Secret Door", "OSE.exploration.sd.long": "Find Secret Door",
"OSE.exploration.RoomTrap.long": "Find Room Trap", "OSE.exploration.sd.short": "Secret Door",
"OSE.exploration.RoomTrap.short": "Find Trap" "OSE.exploration.ft.long": "Find Room Trap",
"OSE.exploration.ft.short": "Find Trap"
} }

View File

@ -123,6 +123,13 @@ export class OseActorSheetCharacter extends OseActorSheet {
actorObject.rollCheck(score, { event: event }); 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 => { html.find(".attack a").click(ev => {
let actorObject = this.actor; let actorObject = this.actor;
let element = event.currentTarget; let element = event.currentTarget;

View File

@ -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={}) { rollAttack(attack, options={}) {
const label = game.i18n.localize(`OSE.${attack}`); const label = game.i18n.localize(`OSE.${attack}`);
const rollParts = ['1d20',]; const rollParts = ['1d20',];

View File

@ -46,6 +46,14 @@ export class OseDice {
} else { } else {
details = `<div class='roll-result roll-fail'><b>Failure</b> (${sc})</div>`; 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; return details;
} }

View File

@ -1,29 +1,29 @@
<ul class="attributes exploration flexrow"> <ul class="attributes exploration flexrow">
<li class="attribute flexrow"> <li class="attribute flexrow" data-exploration="ld">
<h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.ListenDoor.long'}}"><a>{{ localize "OSE.exploration.ListenDoor.short" }}</a></h4> <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.ld.long'}}"><a>{{ localize "OSE.exploration.ld.short" }}</a></h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.exploration.ld" type="text" value="{{data.exploration.ld}}" data-dtype="Number" placeholder="0" /> <input name="data.exploration.ld" type="text" value="{{data.exploration.ld}}" data-dtype="Number" placeholder="0" />
</div> </div>
</li> </li>
<li class="attribute flexrow"> <li class="attribute flexrow" data-exploration="od">
<h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.OpenDoor.long'}}"><a>{{ localize "OSE.exploration.OpenDoor.short" }}</a> <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.od.long'}}"><a>{{ localize "OSE.exploration.od.short" }}</a>
</h4> </h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.exploration.od" type="text" value="{{data.exploration.od}}" placeholder="0" data-dtype="String" /> <input name="data.exploration.od" type="text" value="{{data.exploration.od}}" placeholder="0" data-dtype="String" />
</div> </div>
</li> </li>
<li class="attribute flexrow"> <li class="attribute flexrow" data-exploration="sd">
<h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.SecretDoor.long'}}"><a>{{ localize "OSE.exploration.SecretDoor.short" }}</a> <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.sd.long'}}"><a>{{ localize "OSE.exploration.sd.short" }}</a>
</h4> </h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.exploration.sd" type="text" value="{{data.exploration.sd}}" placeholder="0" data-dtype="String" /> <input name="data.exploration.sd" type="text" value="{{data.exploration.sd}}" placeholder="0" data-dtype="String" />
</div> </div>
</li> </li>
<li class="attribute flexrow"> <li class="attribute flexrow" data-exploration="ft">
<h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.RoomTrap.long'}}"><a>{{ localize "OSE.exploration.RoomTrap.short" }}</a> <h4 class="attribute-name box-title" title="{{localize 'OSE.exploration.ft.long'}}"><a>{{ localize "OSE.exploration.ft.short" }}</a>
</h4> </h4>
<div class="attribute-value"> <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> </div>
</li> </li>
</ul> </ul>