Skip to content

Commit

Permalink
Merge pull request #840 from wowsims/feature/mage-display-stat-talents
Browse files Browse the repository at this point in the history
[MAGE] Display stat talents
  • Loading branch information
1337LutZ authored Jul 13, 2024
2 parents 5329b32 + e4979b6 commit 2b4a5f6
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 90 deletions.
21 changes: 2 additions & 19 deletions ui/hunter/beast_mastery/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { BeastMasteryHunter_Rotation, HunterStingType } from '../../core/proto/h
import * as AplUtils from '../../core/proto_utils/apl_utils';
import { Stats } from '../../core/proto_utils/stats';
import * as HunterInputs from '../inputs';
import { sharedHunterDisplayStatsModifiers } from '../shared';
import * as BMInputs from './inputs';
import * as Presets from './presets';

Expand Down Expand Up @@ -62,25 +63,7 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecBeastMasteryHunter, {
Stat.StatMastery,
],
modifyDisplayStats: (player: Player<Spec.SpecBeastMasteryHunter>) => {
let stats = new Stats();
//stats = stats.addStat(Stat.StatMeleeCrit, player.getTalents().lethalShots * 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);

const rangedWeapon = player.getEquippedItem(ItemSlot.ItemSlotRanged);
if (rangedWeapon?.enchant?.effectId == 3608) {
stats = stats.addStat(Stat.StatMeleeCrit, 40);
}
if (rangedWeapon?.enchant?.effectId == 4176) {
stats = stats.addStat(Stat.StatMeleeHit, 88);
}
if (player.getRace() == Race.RaceDwarf && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeGun) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
if (player.getRace() == Race.RaceTroll && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeBow) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
return {
talents: stats,
};
return sharedHunterDisplayStatsModifiers(player);
},
defaults: {
// Default equipped gear.
Expand Down
21 changes: 2 additions & 19 deletions ui/hunter/marksmanship/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { HunterStingType, MarksmanshipHunter_Rotation } from '../../core/proto/h
import * as AplUtils from '../../core/proto_utils/apl_utils';
import { Stats } from '../../core/proto_utils/stats';
import * as HunterInputs from '../inputs';
import { sharedHunterDisplayStatsModifiers } from '../shared';
import * as MMInputs from './inputs';
import * as Presets from './presets';
const SPEC_CONFIG = registerSpecConfig(Spec.SpecMarksmanshipHunter, {
Expand Down Expand Up @@ -60,25 +61,7 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecMarksmanshipHunter, {
Stat.StatMastery,
],
modifyDisplayStats: (player: Player<Spec.SpecMarksmanshipHunter>) => {
let stats = new Stats();
//stats = stats.addStat(Stat.StatMeleeCrit, player.getTalents().lethalShots * 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);

const rangedWeapon = player.getEquippedItem(ItemSlot.ItemSlotRanged);
if (rangedWeapon?.enchant?.effectId == 3608) {
stats = stats.addStat(Stat.StatMeleeCrit, 40);
}
if (rangedWeapon?.enchant?.effectId == 4176) {
stats = stats.addStat(Stat.StatMeleeHit, 88);
}
if (player.getRace() == Race.RaceDwarf && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeGun) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
if (player.getRace() == Race.RaceTroll && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeBow) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
return {
talents: stats,
};
return sharedHunterDisplayStatsModifiers(player);
},

defaults: {
Expand Down
28 changes: 28 additions & 0 deletions ui/hunter/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { StatMods } from '../core/components/character_stats';
import * as Mechanics from '../core/constants/mechanics';
import { Player } from '../core/player';
import { ItemSlot, Race, RangedWeaponType, Spec, Stat } from '../core/proto/common';
import { Stats } from '../core/proto_utils/stats';

export const sharedHunterDisplayStatsModifiers = (
player: Player<Spec.SpecBeastMasteryHunter> | Player<Spec.SpecMarksmanshipHunter> | Player<Spec.SpecSurvivalHunter>,
): StatMods => {
let stats = new Stats();

const rangedWeapon = player.getEquippedItem(ItemSlot.ItemSlotRanged);
if (rangedWeapon?.enchant?.effectId == 3608) {
stats = stats.addStat(Stat.StatMeleeCrit, 40);
}
if (rangedWeapon?.enchant?.effectId == 4176) {
stats = stats.addStat(Stat.StatMeleeHit, 88);
}
if (player.getRace() == Race.RaceDwarf && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeGun) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
if (player.getRace() == Race.RaceTroll && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeBow) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
return {
talents: stats,
};
};
21 changes: 2 additions & 19 deletions ui/hunter/survival/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { HunterStingType, SurvivalHunter_Rotation } from '../../core/proto/hunte
import * as AplUtils from '../../core/proto_utils/apl_utils';
import { Stats } from '../../core/proto_utils/stats';
import * as HunterInputs from '../inputs';
import { sharedHunterDisplayStatsModifiers } from '../shared';
import * as SVInputs from './inputs';
import * as Presets from './presets';

Expand Down Expand Up @@ -52,25 +53,7 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecSurvivalHunter, {
Stat.StatMastery,
],
modifyDisplayStats: (player: Player<Spec.SpecSurvivalHunter>) => {
let stats = new Stats();
//stats = stats.addStat(Stat.StatMeleeCrit, player.getTalents().lethalShots * 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);

const rangedWeapon = player.getEquippedItem(ItemSlot.ItemSlotRanged);
if (rangedWeapon?.enchant?.effectId == 3608) {
stats = stats.addStat(Stat.StatMeleeCrit, 40);
}
if (rangedWeapon?.enchant?.effectId == 4176) {
stats = stats.addStat(Stat.StatMeleeHit, 88);
}
if (player.getRace() == Race.RaceDwarf && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeGun) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
if (player.getRace() == Race.RaceTroll && rangedWeapon?.item.rangedWeaponType == RangedWeaponType.RangedWeaponTypeBow) {
stats = stats.addStat(Stat.StatMeleeCrit, 1 * Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE);
}
return {
talents: stats,
};
return sharedHunterDisplayStatsModifiers(player);
},

defaults: {
Expand Down
15 changes: 4 additions & 11 deletions ui/mage/arcane/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { APLRotation } from '../../core/proto/apl';
import { Faction, IndividualBuffs, PartyBuffs, Race, Spec, Stat } from '../../core/proto/common';
import { StatCapType } from '../../core/proto/ui';
import { Stats } from '../../core/proto_utils/stats';
import { sharedMageDisplayStatsModifiers } from '../shared';
import * as ArcaneInputs from './inputs';
import * as Presets from './presets';

Expand All @@ -34,17 +35,9 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecArcaneMage, {
Stat.StatSpellHaste,
Stat.StatMastery,
],
// modifyDisplayStats: (player: Player<Spec.SpecArcaneMage>) => {
// let stats = new Stats();

// if (player.getTalentTree() === 0) {
// stats = stats.addStat(Stat.StatSpellHit, player.getTalents().arcaneFocus * 1 * Mechanics.SPELL_HIT_RATING_PER_HIT_CHANCE);
// }

// return {
// talents: stats,
// };
// },
modifyDisplayStats: (player: Player<Spec.SpecArcaneMage>) => {
return sharedMageDisplayStatsModifiers(player);
},

defaults: {
// Default equipped gear.
Expand Down
15 changes: 4 additions & 11 deletions ui/mage/fire/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { APLRotation } from '../../core/proto/apl';
import { Faction, IndividualBuffs, PartyBuffs, Race, Spec, Stat } from '../../core/proto/common';
import { StatCapType } from '../../core/proto/ui';
import { Stats } from '../../core/proto_utils/stats';
import { sharedMageDisplayStatsModifiers } from '../shared';
import * as FireInputs from './inputs';
import * as Presets from './presets';

Expand All @@ -34,17 +35,9 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecFireMage, {
Stat.StatSpellHaste,
Stat.StatMastery,
],
// modifyDisplayStats: (player: Player<Spec.SpecFireMage>) => {
// let stats = new Stats();

// if (player.getTalentTree() === 0) {
// stats = stats.addStat(Stat.StatSpellHit, player.getTalents().arcaneFocus * 1 * Mechanics.SPELL_HIT_RATING_PER_HIT_CHANCE);
// }

// return {
// talents: stats,
// };
// },
modifyDisplayStats: (player: Player<Spec.SpecFireMage>) => {
return sharedMageDisplayStatsModifiers(player);
},

defaults: {
// Default equipped gear.
Expand Down
15 changes: 4 additions & 11 deletions ui/mage/frost/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { PlayerClasses } from '../../core/player_classes';
import { APLRotation } from '../../core/proto/apl';
import { Debuffs, Faction, IndividualBuffs, PartyBuffs, Race, RaidBuffs, Spec, Stat } from '../../core/proto/common';
import { Stats } from '../../core/proto_utils/stats';
import { sharedMageDisplayStatsModifiers } from '../shared';
import * as FrostInputs from './inputs';
import * as Presets from './presets';

Expand Down Expand Up @@ -41,17 +42,9 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecFrostMage, {
Stat.StatMP5,
Stat.StatMastery,
],
// modifyDisplayStats: (player: Player<Spec.SpecFrostMage>) => {
// let stats = new Stats();

// if (player.getTalentTree() === 0) {
// stats = stats.addStat(Stat.StatSpellHit, player.getTalents().arcaneFocus * 1 * Mechanics.SPELL_HIT_RATING_PER_HIT_CHANCE);
// }

// return {
// talents: stats,
// };
// },
modifyDisplayStats: (player: Player<Spec.SpecFrostMage>) => {
return sharedMageDisplayStatsModifiers(player);
},

defaults: {
// Default equipped gear.
Expand Down
13 changes: 13 additions & 0 deletions ui/mage/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { StatMods } from '../core/components/character_stats';
import * as Mechanics from '../core/constants/mechanics';
import { Player } from '../core/player';
import { Spec, Stat } from '../core/proto/common';
import { Stats } from '../core/proto_utils/stats';

export const sharedMageDisplayStatsModifiers = (player: Player<Spec.SpecArcaneMage> | Player<Spec.SpecFireMage> | Player<Spec.SpecFrostMage>): StatMods => {
let stats = new Stats();
stats = stats.addStat(Stat.StatSpellCrit, player.getTalents().piercingIce * 1 * Mechanics.SPELL_CRIT_RATING_PER_CRIT_CHANCE);
return {
talents: stats,
};
};

0 comments on commit 2b4a5f6

Please sign in to comment.