Skip to main content

wowlab_engine_content/hooks/assassination_rogue/
fatebound.rs

1use wowlab_engine_combat::ResourceOps as _;
2use wowlab_engine_combat::HookCtx;
3use wowlab_engine_rng::proc_chance;
4
5use crate::{
6    generated::specs::assassination_rogue::{
7        AURA_FATEBOUND_COIN_HEADS, AURA_FATEBOUND_COIN_TAILS, AURA_FATEBOUND_LUCKY_COIN,
8        AURA_LUCKY_COIN_COUNTER, EFFECT, HERO,
9    },
10    hooks::shared::rogue::{self, FateboundBinding, FateboundConfig, FateboundIds, COIN_FAIR_ODDS},
11};
12
13use super::{config::sin_config, poisons::proc_poisons};
14
15fn config(ctx: &HookCtx<'_>) -> FateboundConfig {
16    let config = sin_config(ctx);
17
18    FateboundConfig {
19        hand_of_fate_cp: config.hand_of_fate_cp,
20        matching_odds: COIN_FAIR_ODDS + COIN_FAIR_ODDS * config.mean_streak_odds,
21        lucky_coin_odds: config.lucky_coin_odds,
22        controlled_chaos_streak: config.controlled_chaos_streak,
23        rush_energy: config.rush_energy,
24        rush_energy_edge: config.rush_energy_edge,
25        lucky_coin_flips: config.lucky_coin_flips,
26        has_edge_case: config.has_edge_case,
27    }
28}
29
30pub(super) const BINDING: FateboundBinding = FateboundBinding {
31    config,
32    ids: FateboundIds {
33        heads: AURA_FATEBOUND_COIN_HEADS,
34        tails: AURA_FATEBOUND_COIN_TAILS,
35        lucky_coin: AURA_FATEBOUND_LUCKY_COIN,
36        lucky_coin_counter: AURA_LUCKY_COIN_COUNTER,
37        tails_damage_effect: EFFECT::FATEBOUND_COIN_TAILS_DMG,
38        tails_damage_spell: HERO::FATEBOUND::SPELL::FATEBOUND_COIN_TAILS,
39    },
40    on_tails: proc_poisons,
41};
42
43pub(super) fn overflowing_purse(ctx: &mut HookCtx<'_>) {
44    let local = sin_config(ctx);
45
46    if local.hand_of_fate_cp <= 0.0
47        || ctx.last_secondary_spent() < local.hand_of_fate_cp
48        || local.overflowing_extra_coins == 0
49        || !proc_chance(ctx.rng(), local.overflowing_chance)
50    {
51        return;
52    }
53
54    let fatebound = BINDING.resolve(ctx);
55
56    for _ in 0..local.overflowing_extra_coins {
57        rogue::flip_coin(ctx, fatebound, true);
58    }
59}