# AILastAttackRatio
Flags —
Native
# Arguments
wave
— w
Returns — int
native int AILastAttackRatio(wave w);
# Related
Category: Unclassified
# Examples
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:573
int foodUsed;
if (AILastAttackRatio(w) >= 130) {
// if the last attack was successful (we killed a good bit more than we lost)
// then attack again as soon as we've gathered 30 units or it's been a short amount of time
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:583
}
}
else if (AILastAttackRatio(w) >= 90) {
// if the last attack was even (we did fight and we killed about as much as we lost)
// then wait to attack until we've regrouped a bit
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:662
bool enoughForce = false;
if (AILastAttackRatio(w) >= 120) {
// if the last attack was successful (we killed a good bit more than we lost)
// then attack again as soon as we've gathered 20 units or it's been a short amount of time
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:672
}
}
else if (AILastAttackRatio(w) >= 80) {
// if the last attack was even (we did fight and we killed about as much as we lost)
// then wait to attack until we've regrouped a bit