# Wave Eval Ratio

Grammar — Eval ratio of the specified wave waveRef against enemies within range range
FlagsNative | Function

Returns the eval ratio of the specified wave against enemies within the specified range.

# Arguments

  • wave — Wave
  • fixed — Range

Returns — int

native int AIWaveEvalRatio(wave w, fixed range);

Category: AI Advanced / Waves / Functions

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:60

        ", units="      + IntToString(AIWaveUnitCount(w))               +
        ", state="      + WaveStateName(AIWaveState(w))                 +
        ", ratio="      + IntToString(AIWaveEvalRatio(w, c_evalRange))  +
        ", combat="     + IntToString(AIWaveGetTimeInCombat(w))         +
        ", safe="       + IntToString(AIWaveGetTimeSinceCombat(w))      +

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:71

//--------------------------------------------------------------------------------------------------
void AIDefendSelfWithWave (int player, wave w) {
    int eval = AIWaveEvalRatio(w, c_evalDefendRange);
    int staticPercent = AILastWaveEvalStaticRatio();
    int neededEval = 50;

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:102

//--------------------------------------------------------------------------------------------------
void AIDefendAllyWithWave (int player, wave w) {
    int eval = AIWaveEvalRatio(w, c_evalDefendRange);
    int neededEval = 30;

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:249

        }
    }
    else if (AIWaveEvalRatio(w, c_evalHarassRange) < 100) {
        if (state != c_waveStateRetreat) {
DebugAIPlayerWave(player, "set divert = retreat to harass point");

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:357

    waveAtck = AIWaveGet(player, c_waveAttack);
    countAtck = AIWaveUnitCount(waveAtck);
    evalAtck = AIWaveEvalRatio(waveAtck, c_evalRange);
    if (countAtck > 0 && evalAtck < 90) {
        return false;

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:671

            // retreat logic
            time = AIWaveGetTimeInCombat(w);
            eval = AIWaveEvalRatio(w, c_evalRange);
            if (eval >= 75 && eval <= 85 && time <= 3) { // when not fighting and only a little weak
                if (AIGetFlag(player, e_flagsRunScared)) { // need to add check for ranges & max eval

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:698


    else if (state == e_attackState_DropAttack) {        
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval < 60) { // need to add check for can we retreat successfully
            AISetAttackState(player, e_attackState_DropRetreat);

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:711


    else if (state == e_attackState_Scared) {
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval > 90) { // turn and fight when strong
            AISetAttackState(player, e_attackState_Attack);

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:190

        ", units="      + IntToString(AIWaveUnitCount(w))               +
        ", state="      + WaveStateName(AIWaveState(w))                 +
        ", ratio="      + IntToString(AIWaveEvalRatio(w, c_evalRange))  +
        ", combat="     + IntToString(AIWaveGetTimeInCombat(w))         +
        ", safe="       + IntToString(AIWaveGetTimeSinceCombat(w))      +

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:201

//--------------------------------------------------------------------------------------------------
void AIDefendWithWave (int player, wave w) {
    int eval = AIWaveEvalRatio(w, c_evalDefendRange);
    int staticPercent = AILastWaveEvalStaticRatio();
    int neededEval = 50;

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:338

        }
    }
    else if (AIWaveEvalRatio(w, c_evalHarassRange) < 100) {
        if (state != c_waveStateRetreat) {
DebugAIPlayerWave(player, "set divert = retreat to harass point");

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:440

    waveAtck = AIWaveGet(player, c_waveAttack);
    countAtck = AIWaveUnitCount(waveAtck);
    evalAtck = AIWaveEvalRatio(waveAtck, c_evalRange);
    if (countAtck > 0 && evalAtck < 90) {
        return false;

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:757

            // retreat logic
            time = AIWaveGetTimeInCombat(w);
            eval = AIWaveEvalRatio(w, c_evalRange);
            if (eval >= 75 && eval <= 85 && time <= 3) { // when not fighting and only a little weak
									DebugAI("case1");

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:791


    else if (state == e_attackState_DropAttack) {        
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval < 60) { // need to add check for can we retreat successfully
            AISetAttackState(player, e_attackState_DropRetreat);

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:804


    else if (state == e_attackState_Scared) {
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval > 90) { // turn and fight when strong
            AISetAttackState(player, e_attackState_Attack);