Skip to content

Commit 857d886

Browse files
authored
Merge pull request #38 from orffen/r8
R8
2 parents b2eafe3 + 736a30a commit 857d886

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

module/documents/actor.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,20 @@ export class BasicFantasyRPGActor extends Actor {
8888
let specialAbilityLookup = [3, 12, 25, 30, 40, 45, 55, 65, 70, 75, 90, 95, 100, 110, 115, 125, 135, 145, 160, 175, 200, 225, 250, 275, 300, 325];
8989
let xpValue = 0;
9090
let xpSpecialAbilityBonus = 0;
91-
if (data.hitDice.size == "d8" && data.hitDice.mod >= 0) {
92-
xpValue = xpLookup[data.hitDice.number];
93-
xpSpecialAbilityBonus = specialAbilityLookup[data.hitDice.number] * data.specialAbility.value;
94-
} else {
91+
if (data.hitDice.number < 1 || (data.hitDice.number == 1 && data.hitDice.mod < 0) || data.hitDice.size < "d8") {
9592
xpValue = xpLookup[0];
9693
xpSpecialAbilityBonus = specialAbilityLookup[0] * data.specialAbility.value;
94+
} else if (data.hitDice.number > 25) {
95+
xpValue = 9000 + (data.hitDice.number - 25) * 750;
96+
xpSpecialAbilityBonus = (325 + (data.hitDice.number - 25) * 25) * data.specialAbility.value;
97+
} else {
98+
xpValue = xpLookup[data.hitDice.number];
99+
xpSpecialAbilityBonus = specialAbilityLookup[data.hitDice.number] * data.specialAbility.value;
97100
}
98-
return xpValue + xpSpecialAbilityBonus;
101+
return xpValue + Math.max(0, xpSpecialAbilityBonus); // never return a negative special ability bonus
99102
};
100103

101104
data.attackBonus.value = this._calculateMonsterAttackBonus();
102-
103105
}
104106

105107
/**
@@ -108,7 +110,9 @@ export class BasicFantasyRPGActor extends Actor {
108110
_calculateMonsterAttackBonus() {
109111
if (this.system.hitDice.number < 1) {
110112
return 0;
111-
}
113+
} else if (this.system.hitDice.number > 31) {
114+
return 16;
115+
}
112116
switch (this.system.hitDice.number) {
113117
case 9: return 8;
114118
case 10:
@@ -133,7 +137,7 @@ export class BasicFantasyRPGActor extends Actor {
133137
case 29:
134138
case 30:
135139
case 31: return 15;
136-
default: return this.system.hitDice.number;
140+
default: return this.system.hitDice.number; // this handles 1-9
137141
}
138142
}
139143

system.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "basicfantasyrpg",
33
"title": "Basic Fantasy RPG",
44
"description": "The Basic Fantasy RPG system for FoundryVTT!",
5-
"version": "r7",
5+
"version": "r8",
66
"compatibility": {
77
"minimum": "10",
88
"verified": "10",
@@ -32,6 +32,6 @@
3232
"secondaryTokenAttribute": null,
3333
"url": "https://github.com/orffen/basicfantasyrpg",
3434
"manifest": "https://raw.githubusercontent.com/orffen/basicfantasyrpg/main/system.json",
35-
"download": "https://github.com/orffen/basicfantasyrpg/archive/refs/tags/r7.zip",
35+
"download": "https://github.com/orffen/basicfantasyrpg/archive/refs/tags/r8.zip",
3636
"license": "LICENSE.txt"
3737
}

0 commit comments

Comments
 (0)