Skip to content
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

Merged
merged 4 commits into from
Jan 19, 2025

Conversation

NerdEgghead
Copy link
Contributor

No description provided.

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
@@ -163,6 +163,13 @@ export class Gear extends BaseGear {
.includes(itemId);
}

hasTrinketFromOptions(itemIds: number[]): boolean {
return this.getTrinkets()
.filter(t => !!t)
Copy link
Contributor

@1337LutZ 1337LutZ Jan 19, 2025

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;
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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
@NerdEgghead NerdEgghead merged commit 33c755e into master Jan 19, 2025
2 checks passed
@NerdEgghead NerdEgghead deleted the auto_reforge branch January 19, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants