Skip to main content

wowlab_engine_content/hooks/outlaw_rogue/
procs.rs

1use wowlab_engine_combat::DamageOps as _;
2use wowlab_engine_combat::ResourceOps as _;
3use wowlab_engine_combat::AuraOps as _;
4use wowlab_engine_combat::{DamageFlags, HookCtx, MasteryCtx};
5use wowlab_engine_rng::proc_chance;
6
7use crate::generated::specs::outlaw_rogue::AURA_OPPORTUNITY;
8
9use super::{config::outlaw_config, roll_the_bones::rtb_tier};
10
11const OPPORTUNITY_BASE_CHANCE: f64 = 0.30;
12const OPPORTUNITY_RTB_BONUS: f64 = 0.20;
13const INSTANT_POISON_CHANCE: f64 = 0.30;
14
15pub(super) fn opportunity_chance(ctx: &HookCtx<'_>) -> f64 {
16    let mut chance = OPPORTUNITY_BASE_CHANCE;
17
18    if rtb_tier(ctx) >= 1 {
19        chance += OPPORTUNITY_RTB_BONUS;
20    }
21
22    chance
23}
24
25pub(super) fn proc_main_gauche(ctx: &mut HookCtx<'_>) {
26    let chance = ctx.action_proc_chance(
27        crate::generated::specs::outlaw_rogue::DAMAGE_EFFECT::MAIN_GAUCHE_MASTERY_COEF.action(),
28    );
29
30    if !proc_chance(ctx.rng(), chance) {
31        return;
32    }
33
34    let coef = ctx.effect_ap_coefficient(crate::generated::specs::outlaw_rogue::DAMAGE_EFFECT::MAIN_GAUCHE_DAMAGE)
35        + ctx.effect_points(crate::generated::specs::outlaw_rogue::DAMAGE_EFFECT::MAIN_GAUCHE_MASTERY_COEF);
36
37    ctx.deal_damage_ap(crate::generated::specs::outlaw_rogue::DAMAGE_REPORTED::MAIN_GAUCHE, coef, DamageFlags::PHYSICAL);
38}
39
40pub(super) fn proc_instant_poison(ctx: &mut HookCtx<'_>) {
41    if proc_chance(ctx.rng(), INSTANT_POISON_CHANCE) {
42        let coef = ctx.effect_ap_coefficient(crate::generated::specs::outlaw_rogue::DAMAGE_EFFECT::INSTANT_POISON_DAMAGE);
43
44        ctx.deal_damage_ap(
45            crate::generated::specs::outlaw_rogue::DAMAGE_REPORTED::INSTANT_POISON_DAMAGE,
46            coef,
47            DamageFlags::empty(),
48        );
49    }
50}
51
52pub(super) fn proc_melee_hit(ctx: &mut HookCtx<'_>) {
53    proc_main_gauche(ctx);
54    proc_instant_poison(ctx);
55}
56
57pub(super) fn apply_opportunity(ctx: &mut HookCtx<'_>) {
58    let cfg = outlaw_config(ctx);
59
60    ctx.apply_aura_n(
61        AURA_OPPORTUNITY,
62        1 + i32::try_from(cfg.fan_the_hammer_extra).unwrap_or(i32::MAX),
63    );
64    let deal_fate = cfg.deal_fate_cp;
65
66    if deal_fate > 0.0 {
67        ctx.gain_secondary_resource(deal_fate);
68    }
69}
70
71/// Keeps Main Gauche out of the global damage multiplier path.
72#[must_use]
73pub(crate) const fn mastery(_ctx: &MasteryCtx<'_>) -> f64 {
74    1.0
75}