FIX: Roll mods concatenation, Added GetExperience

master
U~man 2020-07-05 15:25:20 +02:00
parent 881ab7f8f0
commit b609b673e6
4 changed files with 30 additions and 19 deletions

View File

@ -10,7 +10,7 @@
"OSE.SitMod": "Situational Modifier", "OSE.SitMod": "Situational Modifier",
"OSE.Modifier": "Modifier", "OSE.Modifier": "Modifier",
"OSE.RollMode": "Roll Mode", "OSE.RollMode": "Roll Mode",
"OSE.RollExample": "Roll Example", "OSE.RollExample": "e.g. +1d4",
"OSE.Name": "Name", "OSE.Name": "Name",
"OSE.Class": "Class", "OSE.Class": "Class",
@ -161,5 +161,7 @@
"OSE.exploration.sd.long": "Find Secret Door", "OSE.exploration.sd.long": "Find Secret Door",
"OSE.exploration.sd.short": "Secret Door", "OSE.exploration.sd.short": "Secret Door",
"OSE.exploration.ft.long": "Find Room Trap", "OSE.exploration.ft.long": "Find Room Trap",
"OSE.exploration.ft.short": "Find Trap" "OSE.exploration.ft.short": "Find Trap",
"OSE.messages.getExperience": "{name} gained {value} experience points!"
} }

View File

@ -25,7 +25,20 @@ export class OseActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Socket Listeners and Handlers /* Socket Listeners and Handlers
/* -------------------------------------------- */ /* -------------------------------------------- */
getExperience(value, options = {}) {
console.log(this.data);
if (this.data.type != 'character') {
return;
}
let modified = value + (this.data.data.details.xp.bonus * value) / 100;
console.log(modified);
return this.update({
"data.details.xp.value": modified + this.data.data.details.xp.value
}).then(() => {
const speaker = ChatMessage.getSpeaker({actor: this});
ChatMessage.create({content: game.i18n.format("OSE.messages.getExperience", {name: this.name, value: modified}), speaker});
});
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Rolls */ /* Rolls */
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -89,7 +102,7 @@ export class OseActor extends Actor {
...{ ...{
rollData: { rollData: {
type: "Check", type: "Check",
stat: score, target: this.data.data.scores[score].value,
}, },
}, },
}; };
@ -178,7 +191,7 @@ export class OseActor extends Actor {
// Add Str to damage // Add Str to damage
if (attData.type == 'melee') { if (attData.type == 'melee') {
dmgParts.push("+", data.scores.str.mod); dmgParts.push(data.scores.str.mod);
} }
// Damage roll // Damage roll
@ -199,21 +212,17 @@ export class OseActor extends Actor {
if (attData.type == "missile") { if (attData.type == "missile") {
rollParts.push( rollParts.push(
"+",
data.scores.dex.mod.toString(), data.scores.dex.mod.toString(),
"+",
data.thac0.mod.missile.toString() data.thac0.mod.missile.toString()
); );
} else if (attData.type == "melee") { } else if (attData.type == "melee") {
rollParts.push( rollParts.push(
"+",
data.scores.str.mod.toString(), data.scores.str.mod.toString(),
"+",
data.thac0.mod.melee.toString() data.thac0.mod.melee.toString()
); );
} }
if (game.settings.get("ose", "ascendingAC")) { if (game.settings.get("ose", "ascendingAC")) {
rollParts.push("+", this.data.data.thac0.bba.toString()); rollParts.push(this.data.data.thac0.bba.toString());
} }
const rollData = { const rollData = {

View File

@ -53,7 +53,7 @@ export class OseDice {
} }
} else if (data.rollData.type == "Check") { } else if (data.rollData.type == "Check") {
// SCORE CHECKS // SCORE CHECKS
let sc = data.data.scores[data.rollData.stat].value; let sc = data.rollData.target;
if (die == 1 || (roll.total <= sc && die < 20)) { if (die == 1 || (roll.total <= sc && die < 20)) {
details = `<div class='roll-result roll-success'><b>Success!</b> (${sc})</div>`; details = `<div class='roll-result roll-success'><b>Success!</b> (${sc})</div>`;
} else { } else {
@ -95,8 +95,8 @@ export class OseDice {
// Optionally include a situational bonus // Optionally include a situational bonus
if (form !== null) data["bonus"] = form.bonus.value; if (form !== null) data["bonus"] = form.bonus.value;
if (data["bonus"]) parts.push(data["bonus"]); if (data["bonus"]) parts.push(data["bonus"]);
const roll = new Roll(parts.join(""), data).roll(); const roll = new Roll(parts.join("+"), data).roll();
// Convert the roll to a chat message and return the roll // Convert the roll to a chat message and return the roll
let rollMode = game.settings.get("core", "rollMode"); let rollMode = game.settings.get("core", "rollMode");

View File

@ -1,33 +1,33 @@
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" /> <img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" />
<section class="header-details flexrow"> <section class="header-details flexrow">
<h1 class="charname"> <h1 class="charname">
<input name="name" type="text" value="{{actor.name}}" placeholder="{{localize 'OSE.Name'}}" /> <input name="name" type="text" value="{{actor.name}}" placeholder="{{localize 'OSE.Name'}}" data-dtype="String" />
</h1> </h1>
<ul class="summary flexrow"> <ul class="summary flexrow">
<li> <li>
<input type="text" name="data.details.title" value="{{data.details.title}}" <input type="text" name="data.details.title" value="{{data.details.title}}" data-dtype="String"
/> />
<label>{{localize 'OSE.Title'}}</label> <label>{{localize 'OSE.Title'}}</label>
</li> </li>
<li> <li>
<input type="text" name="data.details.alignment" value="{{data.details.alignment}}" <input type="text" name="data.details.alignment" value="{{data.details.alignment}}" data-dtype="String"
/> />
<label>{{localize 'OSE.Alignment'}}</label> <label>{{localize 'OSE.Alignment'}}</label>
</li> </li>
</ul> </ul>
<ul class="summary flexrow"> <ul class="summary flexrow">
<li class="flex3"> <li class="flex3">
<input type="text" name="data.details.class" value="{{data.details.class}}" <input type="text" name="data.details.class" value="{{data.details.class}}" data-dtype="String"
/> />
<label>{{localize 'OSE.Class'}}</label> <label>{{localize 'OSE.Class'}}</label>
</li> </li>
<li> <li>
<input type="text" name="data.details.level" value="{{data.details.level}}" <input type="text" name="data.details.level" value="{{data.details.level}}" data-dtype="Number"
/> />
<label>{{localize 'OSE.Level'}}</label> <label>{{localize 'OSE.Level'}}</label>
</li> </li>
<li class="flex2"> <li class="flex2">
<input type="text" name="data.details.xp.value" value="{{data.details.xp.value}}" <input type="text" name="data.details.xp.value" value="{{data.details.xp.value}}" data-dtype="Number"
/> />
<label>{{localize 'OSE.Experience'}}</label> <label>{{localize 'OSE.Experience'}}</label>
{{#if data.details.xp.bonus}} {{#if data.details.xp.bonus}}