CommonSleepUntilTargetDead
- Parameters
target unitreform boolean- comment
- patch
1.00
- Source
- common.ai (raise an issue to discuss on Github or submit a PR)
- return type
nothing- Source code
function CommonSleepUntilTargetDead takes unit target, boolean reform returns nothing loop exitwhen CaptainRetreating() exitwhen CaptainReadinessHP() <= 40 exitwhen not UnitAlive(target) exitwhen UnitInvis(target) and not IsUnitDetected(target,ai_player) if not TownThreatened() then call AttackMoveKill(target) endif call SuicideSleep(3) if reform and sleep_seconds < -40 then if CaptainInCombat(true) then set sleep_seconds = sleep_seconds + 5 else set sleep_seconds = 0 call FormGroup(1,false) endif endif endloop endfunction