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