-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement relative stat caps for "highest stat" trinket procs #1313
Conversation
weights requests. These additional calculated values don't show up in the stat weights menu and can therefore be confusing to users, and should also be unnecessary since the auto-Reforge code already infers school-specific weights when missing. On branch feral Changes to be committed: modified: ui/core/components/stat_weights_action.tsx
of Khaz'goroth to proc a desired Stat. On branch feral Changes to be committed: modified: ui/core/components/suggest_reforges_action.tsx modified: ui/core/proto_utils/gear.ts
ui/core/proto_utils/gear.ts
Outdated
@@ -163,6 +163,13 @@ export class Gear extends BaseGear { | |||
.includes(itemId); | |||
} | |||
|
|||
hasTrinketFromOptions(itemIds: number[]): boolean { | |||
return this.getTrinkets() | |||
.filter(t => !!t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nicer way of doing this would be:
.filter((t): t is EquippedItem => !!t)
So you don't have to say t!.item.id
in the map but you just handle the type guard better
continue; | ||
} | ||
|
||
const trinketId = trinket!.item.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trinket!
is the !
needed as you null check above?
// If a highest Stat constraint is to be enforced, then update the associated | ||
// coefficient if applicable. | ||
if (this.relativeStatCap) { | ||
this.relativeStatCap!.updateCoefficients(coefficients, stat, amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just do: this.relativeStatCap?.updateCoefficients(coefficients, stat, amount);
so it will only execute when it's defined. Otherwise the !
is not needed since you null check in the if.
const constraints = new Map<string, Constraint>(); | ||
|
||
for (const slot of gear.getItemSlots()) { | ||
constraints.set(ItemSlot[slot], lessEq(1)); | ||
} | ||
|
||
if (this.relativeStatCap) { | ||
const statsWithoutBaseMastery = baseStats.addStat(Stat.StatMasteryRating, -this.player.getBaseMastery() * Mechanics.MASTERY_RATING_PER_MASTERY_POINT); | ||
this.relativeStatCap!.updateConstraints(constraints, gear, statsWithoutBaseMastery); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, the !
shouldn't be needed due to the null check in the if`
On branch auto_reforge Changes to be committed: modified: ui/core/components/suggest_reforges_action.tsx modified: ui/core/proto_utils/gear.ts
No description provided.