Skip to content

Commit

Permalink
adjusts to level scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguinerarogue committed Jan 11, 2025
1 parent 40bfeda commit ff7897b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 44 deletions.
11 changes: 0 additions & 11 deletions ui/core/components/character_stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,4 @@ export class CharacterStats extends Component {
private shouldShowMeleeCritCap(player: Player<any>): boolean {
return [Spec.SpecEnhancementShaman, Spec.SpecRetributionPaladin, Spec.SpecRogue, Spec.SpecWarrior, Spec.SpecHunter].includes(player.spec);
}

/*private meleeCritCapDisplayString(player: Player<any>, _: Stats): string {
const playerCritCapDelta = player.getMeleeCritCap();
if (playerCritCapDelta === 0.0) {
return 'Exact';
}
const prefix = playerCritCapDelta > 0 ? 'Over by ' : 'Under by ';
return `${prefix} ${Math.abs(playerCritCapDelta).toFixed(2)}%`;
}*/
}
12 changes: 0 additions & 12 deletions ui/core/components/encounter_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,6 @@ class TargetPicker extends Input<Encounter, TargetProto> {
{ name: '62', value: 62 },
{ name: '61', value: 61 },
{ name: '60', value: 60 },
{ name: '53', value: 53 },
{ name: '52', value: 52 },
{ name: '51', value: 51 },
{ name: '50', value: 50 },
{ name: '43', value: 43 },
{ name: '42', value: 42 },
{ name: '41', value: 41 },
{ name: '40', value: 40 },
{ name: '28', value: 28 },
{ name: '27', value: 27 },
{ name: '26', value: 26 },
{ name: '25', value: 25 },
],
changedEvent: () => encounter.targetsChangeEmitter,
getValue: () => this.getTarget().level,
Expand Down
46 changes: 25 additions & 21 deletions ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ export interface MeleeCritCapInfo {
meleeCrit: number;
meleeHit: number;
expertise: number;
suppression: number;
glancing: number;
suppression: number;
debuffCrit: number;
hasOffhandWeapon: boolean;
meleeHitCap: number;
Expand Down Expand Up @@ -690,38 +690,41 @@ export class Player<SpecType extends Spec> {
}

getMeleeCritCapInfo(weapon: WeaponType, has2hWeapon: boolean): MeleeCritCapInfo {
let defenderDefense = 315.0; // Initializes at level 63 until UI is loaded
let targetLevel = 63; // Initializes at level 63 until UI is loaded
if (this.sim.encounter.targets) {
const targetlevel = this.sim.encounter?.primaryTarget.level;
defenderDefense = targetlevel * 5;
targetLevel = this.sim.encounter?.primaryTarget.level;
}
const suppression = 4.8;
const glancing = 40.0;
const levelDiff = targetLevel - Mechanics.MAX_CHARACTER_LEVEL;
const defenderDefense = targetLevel * 5;
const glancing = (1 + levelDiff) * 10.0;
const suppression = levelDiff === 3 ? levelDiff + 1.8 : levelDiff;

let weaponSkill = 300.0;
const meleeCrit = (this.currentStats.finalStats?.stats[Stat.StatMeleeCrit] || 0.0) / Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE;
const meleeHit = (this.currentStats.finalStats?.stats[Stat.StatMeleeHit] || 0.0) / Mechanics.MELEE_HIT_RATING_PER_HIT_CHANCE;
const expertise = (this.currentStats.finalStats?.stats[Stat.StatExpertise] || 0.0) / Mechanics.EXPERTISE_PER_QUARTER_PERCENT_REDUCTION / 4;
const hasOffhandWeapon = this.getGear().getEquippedItem(ItemSlot.ItemSlotOffHand)?.item.weaponType !== undefined;

const getWeaponSkillForWeaponType = (skill: PseudoStat) => this.currentStats.talentsStats?.pseudoStats[skill] || 0.0;

if (!has2hWeapon) {
switch (weapon) {
case WeaponType.WeaponTypeUnknown:
break;
case WeaponType.WeaponTypeAxe:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatAxesSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatAxesSkill);
break;
case WeaponType.WeaponTypeDagger:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatDaggersSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatDaggersSkill);
break;
case WeaponType.WeaponTypeFist:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatUnarmedSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatUnarmedSkill);
break;
case WeaponType.WeaponTypeMace:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatMacesSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatMacesSkill);
break;
case WeaponType.WeaponTypeSword:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatSwordsSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatSwordsSkill);
break;
}
}
Expand All @@ -730,26 +733,27 @@ export class Player<SpecType extends Spec> {
case WeaponType.WeaponTypeUnknown:
break;
case WeaponType.WeaponTypeAxe:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatTwoHandedAxesSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatTwoHandedAxesSkill);
break;
case WeaponType.WeaponTypeMace:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatTwoHandedMacesSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatTwoHandedMacesSkill);
break;
case WeaponType.WeaponTypeSword:
weaponSkill += this.currentStats.talentsStats?.pseudoStats[PseudoStat.PseudoStatTwoHandedSwordsSkill] || 0.0;
weaponSkill += getWeaponSkillForWeaponType(PseudoStat.PseudoStatTwoHandedSwordsSkill);
break;
}
}

const skillDiff = defenderDefense - weaponSkill;
// Due to warrior HS bug, hit cap for crit cap calculation ignores the 19% penalty
let meleeHitCap =
defenderDefense - weaponSkill <= 10
? 5.0 + (defenderDefense - weaponSkill) * 0.1
: 5.0 + (defenderDefense - weaponSkill) * 0.2 + (defenderDefense - weaponSkill - 10) * 0.2;
let meleeHitCap = skillDiff <= 10 ? 5.0 + skillDiff * 0.1 : 5.0 + skillDiff * 0.2 + (skillDiff - 10) * 0.2;
meleeHitCap = hasOffhandWeapon && this.spec !== Spec.SpecWarrior ? meleeHitCap + 19.0 : meleeHitCap + 0.0;

const dodgeCap = 5.0 + (defenderDefense - weaponSkill) * 0.1;
const parryCap = this.getInFrontOfTarget() ? 14.0 : 0;
const dodgeCap = 5.0 + skillDiff * 0.1;
let parryCap = 0.0;
if (this.getInFrontOfTarget()) {
parryCap = levelDiff === 3 ? 14.0 : 5.0 + skillDiff * 0.1; // 14% parry at +3 level and follows dodge scaling otherwise
}
const remainingMeleeHitCap = Math.max(meleeHitCap - meleeHit, 0.0);
const remainingDodgeCap = Math.max(dodgeCap - expertise, 0.0);
const remainingParryCap = Math.max(parryCap - expertise, 0.0);
Expand All @@ -774,8 +778,8 @@ export class Player<SpecType extends Spec> {
meleeCrit,
meleeHit,
expertise,
suppression,
glancing,
suppression,
debuffCrit,
hasOffhandWeapon,
meleeHitCap,
Expand Down

0 comments on commit ff7897b

Please sign in to comment.