#91 Automatische Praxispunkte (#93)

Changes:
 + implementation von Automatischen Praxispunkten
 + Hinzufügen von System Settings zur abschaltung von Automatischen Praxispunkten
 + Aufräumen von Helpers und settings in eigene Dateien
Co-authored-by: LeFrique <lefrique@live.de>
Reviewed-on: #93
This commit was merged in pull request #93.
This commit is contained in:
2024-03-24 15:09:08 +01:00
parent 3a58485d27
commit 046d5f0286
9 changed files with 192 additions and 107 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({
+45 -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,50 @@ 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] >= 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;