Class StylePolicy
java.lang.Object
privbot.mechanics.StylePolicy
Which combat style to fight in against an opponent's protection prayer.
The core of ElorinPvP PvPPolicy's style choice (a style their overhead blocks is never chosen) plus
AutoPvP StylePreferenceRoll's weighted pick among the styles that remain. Feed blocked from
OverheadWatch.blockedSet(int) so a one-tick flick does not change the established block. This method rolls
on every call; retain the chosen style separately if it should persist across ticks.
Pure; no client reads, any thread.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CombatStylechoose(Set<CombatStyle> available, Set<CombatStyle> blocked, Map<CombatStyle, Integer> weights, Random random) Picks an available style that is not blocked, weighted.
-
Method Details
-
choose
public static CombatStyle choose(Set<CombatStyle> available, Set<CombatStyle> blocked, Map<CombatStyle, Integer> weights, Random random) Picks an available style that is not blocked, weighted.- Candidates are
availableminusblocked, inCombatStyledeclaration order (so a seededrandomgives the same pick whatever set implementation is passed). - A style's weight is
weights.get(style); missing (or nullweights) is 1, negative is 0. When every candidate weighs 0 the pick is even. - When every available style is blocked, or none is available, it returns null: the caller decides what to do. This method never picks a blocked style.
- Parameters:
available- the styles the plugin can fight in now; null is noneblocked- the styles their prayer blocks; null is noneweights- relative preference per style; null is equalrandom- the source of the roll; null usesThreadLocalRandom
- Candidates are
-