Skip to content

RandomChanceCondition ​

Inherits: EntityCondition < Condition < Resource

Checks if a random roll succeeds based on percentage chance. Supports multiple RNG modes including pity timers for bad luck protection.

Properties ​

floatchance_percent50.0
RngModerng_modeRngMode.PURE_RANDOM
floatpity_increase_percent5.0
floatmax_pity_chance100.0
intmax_failures5

Variables ​

intconsecutive_failures0

Methods ​

boolevaluate( argument: Variant = null )
floatget_current_chance()
voidreset_pity_timer()
Stringget_description()
Stringget_function_description()

Enumerations ​

enum RngMode ​

The options of rng mode: pure random, pity timer, streak breaker, weighted streak.

  • PURE_RANDOM = 0 - Each roll is independent (original behavior)
  • PITY_TIMER = 1 - Chance increases after each failure
  • STREAK_BREAKER = 2 - Guarantees success after X failures
  • WEIGHTED_STREAK = 3 - Combines pity timer with guaranteed success

Property descriptions ​

float chance_percent = 50.0 ​

The chance of success, in percent

RngMode rng_mode = RngMode.PURE_RANDOM ​

How luck is smoothed out: pure random, a growing chance after failures, or a guaranteed success after a streak of failures

Pity Timer Settings

float pity_increase_percent = 5.0 ​

How much to increase chance per failure (only for PITY_TIMER and WEIGHTED_STREAK)

float max_pity_chance = 100.0 ​

Maximum chance the pity timer can reach

Streak Breaker Settings

int max_failures = 5 ​

Maximum failures before guaranteed success (only for STREAK_BREAKER and WEIGHTED_STREAK)

Variable descriptions ​

int consecutive_failures = 0 ​

Internal state - tracks consecutive failures for this specific condition instance

Method descriptions ​

bool evaluate( argument: Variant = null ) ​

Is the condition met?

float get_current_chance() ​

Get current effective chance (for debugging/UI)

void reset_pity_timer() ​

Reset the failure counter (useful for combat state transitions)

String get_description() ​

A short text about what the condition checks.

String get_function_description() ​

The sentence the editor shows for the condition, with {placeholders} for its values.