#91 Automatische Praxispunkte

Changes:
 + implementation von Automatischen Praxispunkten
 + Hinzufügen von System Settings zur abschaltung von Automatischen Praxispunkten
 + Aufräumen von Helpers und settings in eigene Dateien
This commit is contained in:
2024-03-23 20:08:30 +01:00
parent 12e6412a9f
commit 34e8998305
8 changed files with 175 additions and 105 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export interface M5RollData {
c: any;
i: any;
iType: string;
rolls: {};
rolls: any;
res: {
label: string;
};
+1 -1
View File
@@ -323,7 +323,7 @@ export class M5Item extends Item {
}
}
const roll = new M5Roll(rollData, this.actor, item.name);
const roll = new M5Roll(rollData, this.actor, item.name, item.id);
return roll.toMessage();
} else {
ChatMessage.create({
+37 -1
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
}
@@ -88,6 +88,42 @@ export class M5Roll {
});
this.data.res.label = this.label;
if ((game as Game).settings.get("midgard5", "automatedPP")) {
if ((this.data.i.type === "language" || this.data.i.type === "general") && this.data.rolls[0].dice[0] >= 0) {
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 === "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;