This commit is contained in:
2024-03-28 17:31:26 +01:00
17 changed files with 372 additions and 237 deletions
+88 -9
View File
@@ -11,7 +11,7 @@ export class M5Roll {
public _total: number = 0;
public pool: PoolTerm = null;
constructor(public data: M5RollData, public actor: any, public label: string) {
constructor(public data: M5RollData, public actor: any, public label: string, public id?: string) {
//super(null)
//this.data = rollData
}
@@ -89,6 +89,51 @@ export class M5Roll {
});
this.data.res.label = this.label;
console.log(this.data);
if ((game as Game).settings.get("midgard5", "automatedPP") && this.data.iType !== null) {
if ((this.data.i.type === "language" || this.data.i.type === "general") && this.data.rolls[0].dice[0] >= 16) {
this.actor.items.get(this.id).update({
system: {
pp: this.data.i.pp + 1,
},
});
} else if (this.data.rolls[0].dice[0] === 20) {
if (this.data.i.type === "combat") {
// Rolling through skill
this.actor.items.get(this.id).update({
system: {
pp: this.data.i.pp + 1,
},
});
} else if (this.data.iType === "weapon") {
// Rolling through Weapon Item
const skill = this.actor.items.get(this.data.i.skillId);
skill.update({
system: {
pp: skill.system.pp + 1,
},
});
} else if (this.data.iType === "defensiveWeapon") {
// Rolling through defensiveWeapon Item
const skill = this.actor.items.get(this.data.i.skillId);
skill.update({
system: {
pp: skill.system.pp + 1,
},
});
} else if (this.data.iType === "spell") {
// Rolling through Spell Item
const klasse = this.actor.items.find((x) => x.type === "class" && x.system.equipped);
klasse.update({
system: {
lernKostenZauber: {
[this.data.i.process]: { pp: klasse.system.lernKostenZauber[this.data.i.process].pp + 1 },
},
},
});
}
}
}
this._evaluated = true;
return this;
@@ -204,13 +249,13 @@ export class M5Roll {
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.brawl"));
}
static perception(actor: any) {
static deprivationCold(actor: any) {
const rollData = actor.getRollData() as M5RollData;
rollData.rolls["0"] = {
formula: "1d20 + @c.calc.stats.perception.value + @c.calc.stats.perceptionFW",
formula: "@c.calc.stats.deprivationCold.value -1D100",
enabled: true,
label: (game as Game).i18n.localize("midgard5.perception"),
label: (game as Game).i18n.localize("midgard5.deprivationCold"),
result: "",
total: 0,
totalStr: "",
@@ -218,16 +263,16 @@ export class M5Roll {
css: "",
} as M5RollResult;
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.perception"));
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.deprivationCold"));
}
static drinking(actor: any) {
static deprivationHeat(actor: any) {
const rollData = actor.getRollData() as M5RollData;
rollData.rolls["0"] = {
formula: "1d20 + @c.calc.stats.drinking.value + @c.calc.stats.drinkingFW",
formula: "@c.calc.stats.deprivationHeat.value -1D100",
enabled: true,
label: (game as Game).i18n.localize("midgard5.drinking"),
label: (game as Game).i18n.localize("midgard5.deprivationHeat"),
result: "",
total: 0,
totalStr: "",
@@ -235,7 +280,41 @@ export class M5Roll {
css: "",
} as M5RollResult;
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.drinking"));
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.deprivationHeat"));
}
static deprivationFood(actor: any) {
const rollData = actor.getRollData() as M5RollData;
rollData.rolls["0"] = {
formula: "@c.calc.stats.deprivationFood.value -1D100",
enabled: true,
label: (game as Game).i18n.localize("midgard5.deprivationFood"),
result: "",
total: 0,
totalStr: "",
dice: {},
css: "",
} as M5RollResult;
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.deprivationFood"));
}
static cleanSpell(actor: any) {
const rollData = actor.getRollData() as M5RollData;
rollData.rolls["0"] = {
formula: "1d20 + @c.calc.stats.spellCasting.value",
enabled: true,
label: (game as Game).i18n.localize("midgard5.spellCasting"),
result: "",
total: 0,
totalStr: "",
dice: {},
css: "",
} as M5RollResult;
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.spellCasting"));
}
static defense(actor: any) {