@rpg-engine/long-bow 0.8.92 → 0.8.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Spellbook/Spell.d.ts +1 -0
- package/dist/components/Spellbook/Spellbook.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +40 -11
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +41 -12
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/SkillsContainer.tsx +4 -7
- package/src/components/Spellbook/Spell.tsx +38 -4
- package/src/components/Spellbook/Spellbook.tsx +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.94",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@capacitor/core": "^6.1.0",
|
|
86
86
|
"@rollup/plugin-image": "^2.1.1",
|
|
87
|
-
"@rpg-engine/shared": "^0.10.
|
|
87
|
+
"@rpg-engine/shared": "^0.10.41",
|
|
88
88
|
"dayjs": "^1.11.2",
|
|
89
89
|
"font-awesome": "^4.7.0",
|
|
90
90
|
"fs-extra": "^10.1.0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ISkill,
|
|
3
3
|
ISkillDetails,
|
|
4
|
-
getSPForLevel,
|
|
5
4
|
getSPForLevelExponential,
|
|
6
5
|
getSkillConstants,
|
|
7
6
|
CharacterClass,
|
|
@@ -115,13 +114,11 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
115
114
|
continue;
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
// Calculate skillPointsToNextLevel using exponential formula
|
|
117
|
+
// Calculate skillPointsToNextLevel using exponential formula with character class
|
|
119
118
|
const calcSkillPointsToNextLevel = (): number => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
return Math.round(getSPForLevel(skillDetails.level + 1));
|
|
119
|
+
const effectiveClass = characterClass ?? CharacterClass.None;
|
|
120
|
+
const { A, b, c } = getSkillConstants(key, effectiveClass);
|
|
121
|
+
return Math.round(getSPForLevelExponential(skillDetails.level + 1, A, b, c));
|
|
125
122
|
};
|
|
126
123
|
|
|
127
124
|
output.push(
|
|
@@ -11,6 +11,7 @@ export interface ISpellProps {
|
|
|
11
11
|
atlasIMG: any;
|
|
12
12
|
charMana: number;
|
|
13
13
|
charMagicLevel: number;
|
|
14
|
+
charSkillLevels?: Record<string, number>;
|
|
14
15
|
onPointerUp?: (spellKey: string) => void;
|
|
15
16
|
isSettingShortcut?: boolean;
|
|
16
17
|
spellKey: string;
|
|
@@ -18,12 +19,29 @@ export interface ISpellProps {
|
|
|
18
19
|
activeCooldown?: number;
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
const SKILL_NAMES: Record<string, string> = {
|
|
23
|
+
magicLevel: 'magic level',
|
|
24
|
+
distanceFighting: 'distance fighting',
|
|
25
|
+
swordFighting: 'sword fighting',
|
|
26
|
+
axeFighting: 'axe fighting',
|
|
27
|
+
clubFighting: 'club fighting',
|
|
28
|
+
shielding: 'shielding',
|
|
29
|
+
fishing: 'fishing',
|
|
30
|
+
cooking: 'cooking',
|
|
31
|
+
fistFighting: 'fist fighting',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getSkillName = (attribute: string): string => {
|
|
35
|
+
return SKILL_NAMES[attribute] || attribute;
|
|
36
|
+
};
|
|
37
|
+
|
|
21
38
|
export const Spell: React.FC<ISpellProps> = ({
|
|
22
39
|
atlasIMG,
|
|
23
40
|
atlasJSON,
|
|
24
41
|
spellKey,
|
|
25
42
|
charMana,
|
|
26
43
|
charMagicLevel,
|
|
44
|
+
charSkillLevels,
|
|
27
45
|
onPointerUp,
|
|
28
46
|
isSettingShortcut,
|
|
29
47
|
spell,
|
|
@@ -32,13 +50,29 @@ export const Spell: React.FC<ISpellProps> = ({
|
|
|
32
50
|
const {
|
|
33
51
|
manaCost,
|
|
34
52
|
minMagicLevelRequired,
|
|
53
|
+
minSkillLevelRequired,
|
|
54
|
+
attribute,
|
|
35
55
|
magicWords,
|
|
36
56
|
name,
|
|
37
57
|
description,
|
|
38
58
|
} = spell;
|
|
59
|
+
|
|
60
|
+
const getRequiredLevel = (): number => {
|
|
61
|
+
return minSkillLevelRequired ?? minMagicLevelRequired;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getCharacterSkillLevel = (): number => {
|
|
65
|
+
if (attribute && charSkillLevels) {
|
|
66
|
+
return charSkillLevels[attribute] ?? 0;
|
|
67
|
+
}
|
|
68
|
+
return charMagicLevel;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const requiredLevel = getRequiredLevel();
|
|
72
|
+
const characterSkillLevel = getCharacterSkillLevel();
|
|
39
73
|
const disabled = isSettingShortcut
|
|
40
|
-
?
|
|
41
|
-
: manaCost > charMana ||
|
|
74
|
+
? characterSkillLevel < requiredLevel
|
|
75
|
+
: manaCost > charMana || characterSkillLevel < requiredLevel;
|
|
42
76
|
|
|
43
77
|
const CONTAINER_STYLE = { width: '32px', height: '32px' };
|
|
44
78
|
const IMAGE_SCALE = 2;
|
|
@@ -52,8 +86,8 @@ export const Spell: React.FC<ISpellProps> = ({
|
|
|
52
86
|
>
|
|
53
87
|
{disabled && (
|
|
54
88
|
<Overlay>
|
|
55
|
-
{
|
|
56
|
-
?
|
|
89
|
+
{characterSkillLevel < requiredLevel
|
|
90
|
+
? `Low ${getSkillName(attribute || 'magic level')} level`
|
|
57
91
|
: manaCost > charMana && 'No mana'}
|
|
58
92
|
</Overlay>
|
|
59
93
|
)}
|
|
@@ -15,6 +15,7 @@ export interface ISpellbookProps {
|
|
|
15
15
|
spells: ISpell[];
|
|
16
16
|
magicLevel: number;
|
|
17
17
|
mana: number;
|
|
18
|
+
charSkillLevels?: Record<string, number>;
|
|
18
19
|
onSpellClick: (spellKey: string) => void;
|
|
19
20
|
setSpellShortcut: (key: string, index: number) => void;
|
|
20
21
|
shortcuts: IShortcut[];
|
|
@@ -34,6 +35,7 @@ export const Spellbook: React.FC<ISpellbookProps> = ({
|
|
|
34
35
|
spells,
|
|
35
36
|
magicLevel,
|
|
36
37
|
mana,
|
|
38
|
+
charSkillLevels,
|
|
37
39
|
onSpellClick,
|
|
38
40
|
setSpellShortcut,
|
|
39
41
|
shortcuts,
|
|
@@ -107,6 +109,7 @@ export const Spellbook: React.FC<ISpellbookProps> = ({
|
|
|
107
109
|
atlasJSON={iconAtlasJSON}
|
|
108
110
|
charMana={mana}
|
|
109
111
|
charMagicLevel={magicLevel}
|
|
112
|
+
charSkillLevels={charSkillLevels}
|
|
110
113
|
onPointerUp={
|
|
111
114
|
settingShortcutIndex !== -1 ? setShortcut : onSpellClick
|
|
112
115
|
}
|