ENH: Roll Loyalty
parent
4fa91f1759
commit
765e06debe
|
@ -202,7 +202,7 @@ export class OseActorSheetCharacter extends OseActorSheet {
|
|||
let update = data[table].value.filter((el) => el != lang);
|
||||
console.log(update);
|
||||
let newData = {};
|
||||
newData[table] = {value: update};
|
||||
newData[table] = { value: update };
|
||||
return this.actor.update({ data: newData }).then(() => {
|
||||
this.render(true);
|
||||
});
|
||||
|
@ -298,7 +298,14 @@ export class OseActorSheetCharacter extends OseActorSheet {
|
|||
let actorObject = this.actor;
|
||||
let element = event.currentTarget;
|
||||
let score = element.parentElement.parentElement.dataset.score;
|
||||
actorObject.rollCheck(score, { event: event });
|
||||
let stat = element.parentElement.parentElement.dataset.stat;
|
||||
if (!score) {
|
||||
if (stat == "lr") {
|
||||
actorObject.rollLoyalty(score, { event: event });
|
||||
}
|
||||
} else {
|
||||
actorObject.rollCheck(score, { event: event });
|
||||
}
|
||||
});
|
||||
|
||||
html.find(".exploration .attribute-name a").click((ev) => {
|
||||
|
@ -308,17 +315,6 @@ export class OseActorSheetCharacter extends OseActorSheet {
|
|||
actorObject.rollExploration(expl, { event: event });
|
||||
});
|
||||
|
||||
html.find(".ability-score .attribute-mod a").click((ev) => {
|
||||
let box = $(
|
||||
event.currentTarget.parentElement.parentElement.parentElement
|
||||
);
|
||||
box.children(".attribute-bonuses").slideDown(200);
|
||||
});
|
||||
|
||||
html.find(".ability-score .attribute-bonuses a").click((ev) => {
|
||||
$(event.currentTarget.parentElement.parentElement).slideUp(200);
|
||||
});
|
||||
|
||||
html.find(".inventory .item-titles .item-caret").click((ev) => {
|
||||
let items = $(event.currentTarget.parentElement.parentElement).children(
|
||||
".item-list"
|
||||
|
|
|
@ -118,6 +118,32 @@ export class OseActor extends Actor {
|
|||
});
|
||||
}
|
||||
|
||||
rollLoyalty(options = {}) {
|
||||
const label = game.i18n.localize(`OSE.Loyalty`);
|
||||
const rollParts = ["2d6"];
|
||||
|
||||
const data = {
|
||||
...this.data,
|
||||
...{
|
||||
rollData: {
|
||||
type: "Below",
|
||||
target: this.data.data.retainer.loyalty,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Roll and return
|
||||
return OseDice.Roll({
|
||||
event: options.event,
|
||||
parts: rollParts,
|
||||
data: data,
|
||||
skipDialog: true,
|
||||
speaker: ChatMessage.getSpeaker({ actor: this }),
|
||||
flavor: `${label} ${game.i18n.localize("OSE.Roll")}`,
|
||||
title: `${label} ${game.i18n.localize("OSE.Roll")}`,
|
||||
});
|
||||
}
|
||||
|
||||
rollReaction(options = {}) {
|
||||
const label = game.i18n.localize(`OSE.Reaction`);
|
||||
const rollParts = ["2d6"];
|
||||
|
@ -128,12 +154,22 @@ export class OseActor extends Actor {
|
|||
rollData: {
|
||||
type: "Table",
|
||||
table: {
|
||||
2: game.i18n.format("OSE.reaction.Hostile", {name: this.data.name}),
|
||||
3: game.i18n.format("OSE.reaction.Unfriendly", {name: this.data.name}),
|
||||
6: game.i18n.format("OSE.reaction.Neutral", {name: this.data.name}),
|
||||
9: game.i18n.format("OSE.reaction.Indifferent", {name: this.data.name}),
|
||||
12: game.i18n.format("OSE.reaction.Friendly", {name: this.data.name})
|
||||
}
|
||||
2: game.i18n.format("OSE.reaction.Hostile", {
|
||||
name: this.data.name,
|
||||
}),
|
||||
3: game.i18n.format("OSE.reaction.Unfriendly", {
|
||||
name: this.data.name,
|
||||
}),
|
||||
6: game.i18n.format("OSE.reaction.Neutral", {
|
||||
name: this.data.name,
|
||||
}),
|
||||
9: game.i18n.format("OSE.reaction.Indifferent", {
|
||||
name: this.data.name,
|
||||
}),
|
||||
12: game.i18n.format("OSE.reaction.Friendly", {
|
||||
name: this.data.name,
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -369,15 +405,15 @@ export class OseActor extends Actor {
|
|||
|
||||
_isSlow() {
|
||||
this.data.data.isSlow = false;
|
||||
if (this.data.type != 'character') {
|
||||
if (this.data.type != "character") {
|
||||
return;
|
||||
}
|
||||
this.data.items.forEach(item => {
|
||||
if (item.type == 'weapon' && item.data.slow && item.data.equipped) {
|
||||
this.data.items.forEach((item) => {
|
||||
if (item.type == "weapon" && item.data.slow && item.data.equipped) {
|
||||
this.data.data.isSlow = true;
|
||||
return;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
computeModifiers() {
|
||||
|
@ -393,14 +429,32 @@ export class OseActor extends Actor {
|
|||
9: 0,
|
||||
13: 1,
|
||||
16: 2,
|
||||
18: 3
|
||||
}
|
||||
data.scores.str.mod = OseActor._valueFromTable(standard, data.scores.str.value);
|
||||
data.scores.int.mod = OseActor._valueFromTable(standard, data.scores.int.value);
|
||||
data.scores.dex.mod = OseActor._valueFromTable(standard, data.scores.dex.value);
|
||||
data.scores.cha.mod = OseActor._valueFromTable(standard, data.scores.cha.value);
|
||||
data.scores.wis.mod = OseActor._valueFromTable(standard, data.scores.wis.value);
|
||||
data.scores.con.mod = OseActor._valueFromTable(standard, data.scores.con.value);
|
||||
18: 3,
|
||||
};
|
||||
data.scores.str.mod = OseActor._valueFromTable(
|
||||
standard,
|
||||
data.scores.str.value
|
||||
);
|
||||
data.scores.int.mod = OseActor._valueFromTable(
|
||||
standard,
|
||||
data.scores.int.value
|
||||
);
|
||||
data.scores.dex.mod = OseActor._valueFromTable(
|
||||
standard,
|
||||
data.scores.dex.value
|
||||
);
|
||||
data.scores.cha.mod = OseActor._valueFromTable(
|
||||
standard,
|
||||
data.scores.cha.value
|
||||
);
|
||||
data.scores.wis.mod = OseActor._valueFromTable(
|
||||
standard,
|
||||
data.scores.wis.value
|
||||
);
|
||||
data.scores.con.mod = OseActor._valueFromTable(
|
||||
standard,
|
||||
data.scores.con.value
|
||||
);
|
||||
|
||||
const capped = {
|
||||
3: -2,
|
||||
|
@ -409,10 +463,16 @@ export class OseActor extends Actor {
|
|||
9: 0,
|
||||
13: 1,
|
||||
16: 1,
|
||||
18: 2
|
||||
}
|
||||
data.scores.dex.init = OseActor._valueFromTable(capped, data.scores.dex.value);
|
||||
data.scores.cha.npc = OseActor._valueFromTable(capped, data.scores.cha.value);
|
||||
18: 2,
|
||||
};
|
||||
data.scores.dex.init = OseActor._valueFromTable(
|
||||
capped,
|
||||
data.scores.dex.value
|
||||
);
|
||||
data.scores.cha.npc = OseActor._valueFromTable(
|
||||
capped,
|
||||
data.scores.cha.value
|
||||
);
|
||||
data.scores.cha.retain = data.scores.cha.mod + 4;
|
||||
data.scores.cha.loyalty = data.scores.cha.mod + 7;
|
||||
|
||||
|
@ -421,23 +481,32 @@ export class OseActor extends Actor {
|
|||
9: 2,
|
||||
13: 3,
|
||||
16: 4,
|
||||
18: 5
|
||||
}
|
||||
data.exploration.odMod = OseActor._valueFromTable(od, data.scores.str.value);
|
||||
|
||||
18: 5,
|
||||
};
|
||||
data.exploration.odMod = OseActor._valueFromTable(
|
||||
od,
|
||||
data.scores.str.value
|
||||
);
|
||||
|
||||
const literacy = {
|
||||
3: "OSE.Illiterate",
|
||||
6: "OSE.LiteracyBasic",
|
||||
9: "OSE.Literate"
|
||||
}
|
||||
data.languages.literacy = OseActor._valueFromTable(literacy, data.scores.int.value)
|
||||
9: "OSE.Literate",
|
||||
};
|
||||
data.languages.literacy = OseActor._valueFromTable(
|
||||
literacy,
|
||||
data.scores.int.value
|
||||
);
|
||||
|
||||
const spoken = {
|
||||
3: 0,
|
||||
13: 2,
|
||||
16: 3,
|
||||
18: 4
|
||||
}
|
||||
data.languages.count = OseActor._valueFromTable(spoken, data.scores.int.value)
|
||||
18: 4,
|
||||
};
|
||||
data.languages.count = OseActor._valueFromTable(
|
||||
spoken,
|
||||
data.scores.int.value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
</div>
|
||||
</li>
|
||||
{{#if data.retainer.enabled}}
|
||||
<li class="attribute ability-score">
|
||||
<li class="attribute ability-score" data-stat="lr">
|
||||
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Loyalty' }}">
|
||||
{{ localize "OSE.LoyaltyShort" }}
|
||||
<a>{{ localize "OSE.LoyaltyShort" }}</a>
|
||||
</h4>
|
||||
<div class="attribute-value">
|
||||
<input name="data.retainer.loyalty" type="text" value="{{data.retainer.loyalty}}" placeholder="0"
|
||||
|
|
Loading…
Reference in New Issue