Skip to content

Commit 740e5f1

Browse files
committed
feat(rdc): Unbuffed attribute switch
1 parent b8b344f commit 740e5f1

File tree

3 files changed

+65
-15
lines changed

3 files changed

+65
-15
lines changed

react-discretize-components/src/character/Character/Character.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
position: relative;
55
z-index: 1;
66
}
7+
.switches {
8+
display: flex;
9+
gap: 1em;
10+
}
11+
.unbuffedInfo {
12+
position: absolute;
13+
bottom: 1em;
14+
right: 1em;
15+
transform: scale(1.5);
16+
}
717
.section {
18+
position: relative;
819
background-color: var(--rdc-character-background-color);
920
padding: 16px;
1021
margin-top: 12px;

react-discretize-components/src/character/Character/Character.stories.tsx

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,47 @@ export const Example: StoryObj<typeof Character> = {
2323
profession: 'Elementalist',
2424
specialization: 'Weaver',
2525
data: {
26-
Armor: 2514,
27-
Power: 3926,
28-
Precision: 2384,
29-
Toughness: 1243,
30-
Vitality: 1235,
31-
Ferocity: 1556,
26+
Power: 3860.1800000000003,
27+
Toughness: 1000,
28+
Vitality: 1297,
29+
Precision: 2122,
30+
Ferocity: 1760.74,
3231
'Condition Damage': 750,
3332
Expertise: 0,
34-
Concentration: 243,
33+
Concentration: 0,
34+
'Agony Resistance': 0,
35+
Armor: 2015,
36+
Health: 14615,
37+
'Critical Chance': 1.0342857142857143,
38+
'Critical Damage': 2.673826666666667,
3539
'Healing Power': 0,
36-
'Agony Resistance': 162,
37-
'Condition Duration': 0.456564,
38-
'Boon Duration': 0.1628776,
39-
'Critical Chance': 0.876767,
40-
'Critical Damage': 2.5373333333333337,
41-
Health: 13995,
40+
'Condition Duration': 0,
41+
'Boon Duration': 0,
4242
},
4343
},
44+
unbuffedAttributes: {
45+
profession: 'Elementalist',
46+
specialization: 'Weaver',
47+
data: {
48+
Power: 3290,
49+
Toughness: 1000,
50+
Vitality: 1297,
51+
Precision: 2122,
52+
Ferocity: 1618,
53+
'Condition Damage': 0,
54+
Expertise: 0,
55+
Concentration: 0,
56+
'Agony Resistance': 0,
57+
Armor: 2015,
58+
Health: 14615,
59+
'Critical Chance': 0.6342857142857142,
60+
'Critical Damage': 2.578666666666667,
61+
'Healing Power': 0,
62+
'Condition Duration': 0,
63+
'Boon Duration': 0,
64+
},
65+
info: 'Simulated unbuffed attributes are not exact and may not match ingame hero panel! For example, soulbeast\'s "with axe" and "with torch/dagger" buffs are both included, simulating a scenario which doesn\'t occur in either weapon set on some builds. Use with caution.',
66+
},
4467
armor: {
4568
helmAffix: 'Berserker',
4669
helmRuneId: 24836,

react-discretize-components/src/character/Character/Character.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import classes from './Character.module.css';
1818

1919
export interface CharacterProps {
2020
attributes: AttributesProps;
21+
unbuffedAttributes?: AttributesProps & { info?: string };
2122
assumedBuffs: AssumedBuffsProps;
2223
armor: ArmorProps;
2324
weapon: WeaponsProps;
@@ -37,6 +38,7 @@ export interface CharacterProps {
3738
}
3839
const Character = ({
3940
attributes,
41+
unbuffedAttributes,
4042
assumedBuffs,
4143
armor,
4244
weapon,
@@ -49,6 +51,7 @@ const Character = ({
4951
disableSwitch = false,
5052
}: CharacterProps) => {
5153
const [showInfusions, setShowInfusions] = React.useState(false);
54+
const [showUnbuffed, setShowUnbuffed] = React.useState(false);
5255

5356
const Section = ({
5457
children,
@@ -66,13 +69,19 @@ const Character = ({
6669
return (
6770
<>
6871
<div className={classes.top}>
69-
<div>
72+
<div className={classes.switches}>
7073
{!disableSwitch && (
7174
<Switch
7275
onChange={(e) => setShowInfusions(e.target.checked)}
7376
label="Show Infusions"
7477
/>
7578
)}
79+
{unbuffedAttributes && (
80+
<Switch
81+
onChange={(e) => setShowUnbuffed(e.target.checked)}
82+
label="Simulate Unbuffed"
83+
/>
84+
)}
7685
</div>
7786

7887
{assumedBuffs && (
@@ -106,7 +115,14 @@ const Character = ({
106115

107116
<div className={classes.side}>
108117
<Section>
109-
<Attributes {...attributes} />
118+
<Attributes
119+
{...((showUnbuffed && unbuffedAttributes) || attributes)}
120+
/>
121+
{showUnbuffed && unbuffedAttributes && unbuffedAttributes.info && (
122+
<div className={classes.unbuffedInfo}>
123+
<HelperIcon text={unbuffedAttributes.info} />
124+
</div>
125+
)}
110126
</Section>
111127

112128
<Section>

0 commit comments

Comments
 (0)