@rpg-engine/long-bow 0.8.80 → 0.8.81
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/SkillProgressBar.d.ts +1 -0
- package/dist/components/SkillsContainer.d.ts +2 -1
- package/dist/long-bow.cjs.development.js +15 -3
- 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 +16 -4
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/SkillProgressBar.tsx +4 -3
- package/src/components/SkillsContainer.tsx +17 -4
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.81",
|
|
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": "
|
|
87
|
+
"@rpg-engine/shared": "0.10.32",
|
|
88
88
|
"dayjs": "^1.11.2",
|
|
89
89
|
"font-awesome": "^4.7.0",
|
|
90
90
|
"fs-extra": "^10.1.0",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getSPForLevel } from '@rpg-engine/shared';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import { uiColors } from '../constants/uiColors';
|
|
@@ -15,6 +14,7 @@ export interface ISkillProgressBarProps {
|
|
|
15
14
|
texturePath: string;
|
|
16
15
|
showSkillPoints?: boolean;
|
|
17
16
|
skillPointsToNextLevel: number;
|
|
17
|
+
skillPointsForCurrentLevel: number;
|
|
18
18
|
atlasJSON: any;
|
|
19
19
|
atlasIMG: any;
|
|
20
20
|
buffAndDebuff?: number;
|
|
@@ -26,6 +26,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
26
26
|
level,
|
|
27
27
|
skillPoints: currentSkillPoints,
|
|
28
28
|
skillPointsToNextLevel,
|
|
29
|
+
skillPointsForCurrentLevel,
|
|
29
30
|
texturePath,
|
|
30
31
|
showSkillPoints = true,
|
|
31
32
|
atlasIMG,
|
|
@@ -33,8 +34,8 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
33
34
|
|
|
34
35
|
buffAndDebuff,
|
|
35
36
|
}) => {
|
|
36
|
-
// Skill points needed to start the current level
|
|
37
|
-
const baseSkillPoints =
|
|
37
|
+
// Skill points needed to start the current level (passed from parent, calculated with correct formula)
|
|
38
|
+
const baseSkillPoints = skillPointsForCurrentLevel;
|
|
38
39
|
const calculateProgress = (): number => {
|
|
39
40
|
const totalPointsForLevelUp = Math.max(
|
|
40
41
|
1,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CharacterClass,
|
|
2
3
|
ISkill,
|
|
3
4
|
ISkillDetails,
|
|
4
|
-
|
|
5
|
+
getSPForLevelExponential,
|
|
6
|
+
getSkillConstants,
|
|
5
7
|
getXPForLevel,
|
|
6
8
|
} from '@rpg-engine/shared';
|
|
7
9
|
import React from 'react';
|
|
@@ -12,6 +14,7 @@ import { SkillProgressBar } from './SkillProgressBar';
|
|
|
12
14
|
|
|
13
15
|
export interface ISkillContainerProps {
|
|
14
16
|
skill: ISkill;
|
|
17
|
+
characterClass: CharacterClass;
|
|
15
18
|
onCloseButton: () => void;
|
|
16
19
|
atlasJSON: any;
|
|
17
20
|
atlasIMG: any;
|
|
@@ -86,6 +89,7 @@ const skillNameMap: SkillMap = {
|
|
|
86
89
|
export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
87
90
|
onCloseButton,
|
|
88
91
|
skill,
|
|
92
|
+
characterClass,
|
|
89
93
|
atlasIMG,
|
|
90
94
|
atlasJSON,
|
|
91
95
|
scale,
|
|
@@ -110,6 +114,13 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
110
114
|
continue;
|
|
111
115
|
}
|
|
112
116
|
|
|
117
|
+
// Get the skill constants for this skill and character class
|
|
118
|
+
const { A, b, c } = getSkillConstants(key, characterClass);
|
|
119
|
+
|
|
120
|
+
// Calculate SP thresholds using exponential formula
|
|
121
|
+
const skillPointsForCurrentLevel = getSPForLevelExponential(skillDetails.level, A, b, c);
|
|
122
|
+
const skillPointsToNextLevel = getSPForLevelExponential(skillDetails.level + 1, A, b, c);
|
|
123
|
+
|
|
113
124
|
output.push(
|
|
114
125
|
<SkillProgressBar
|
|
115
126
|
key={key}
|
|
@@ -117,9 +128,8 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
117
128
|
bgColor={skillCategoryColor}
|
|
118
129
|
level={skillDetails.level || 0}
|
|
119
130
|
skillPoints={Math.round(skillDetails.skillPoints) || 0}
|
|
120
|
-
skillPointsToNextLevel={
|
|
121
|
-
|
|
122
|
-
}
|
|
131
|
+
skillPointsToNextLevel={skillPointsToNextLevel}
|
|
132
|
+
skillPointsForCurrentLevel={skillPointsForCurrentLevel}
|
|
123
133
|
texturePath={value}
|
|
124
134
|
atlasIMG={atlasIMG}
|
|
125
135
|
atlasJSON={atlasJSON}
|
|
@@ -154,6 +164,9 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
154
164
|
skillPointsToNextLevel={
|
|
155
165
|
Math.round(getXPForLevel(skill.level + 1)) || 0
|
|
156
166
|
}
|
|
167
|
+
skillPointsForCurrentLevel={
|
|
168
|
+
Math.round(getXPForLevel(skill.level)) || 0
|
|
169
|
+
}
|
|
157
170
|
texturePath={'swords/broad-sword.png'}
|
|
158
171
|
atlasIMG={atlasIMG}
|
|
159
172
|
atlasJSON={atlasJSON}
|