SMUnlimited / AMAI

Advanced Melee Artificial Intelligence Mod For Warcraft 3
Other
210 stars 34 forks source link

can not understand AttackMoveKillAAM why need DoDistractionAttack and Attack #400

Closed jzy-chitong56 closed 1 month ago

jzy-chitong56 commented 1 month ago

can not understand , It feels unnecessary to do it at the same time maybe is

GetRandomInt(1,10) < 5   --  Distraction Attack and not Attack
GetRandomInt(1,10) > 4   --  not Distraction Attack and Attack
Attack done , but target alive or Retreating  --  Distraction Attack

If the previous waiting was for the advance troops to harass and the main force to attack again, 
it feels like it's not as good as when the main force enters the battle outside the target and a small number of units go ahead to execute

function AttackMoveKillAAM takes unit target returns nothing
  if target == null or not UnitAlive(target) then
    call Trace("Bad target passed to AttackMoveKillAAM")
    call Sleep(3 * sleep_multiplier)
    return
  endif
  set attack_running = true
  call DoAttackJobs()
  if distraction_group != 0 and GetOwningPlayer(target) != Player(PLAYER_NEUTRAL_AGGRESSIVE) and GetRandomInt(1,10) < 5 then
    if GetHarassGroupStrength(distraction_group) < GetOwnStrength() / 3 then
      call DoDistractionAttack(target)
    endif
  endif
  call AttackMoveKill(target)
  call ReformUntilTargetDeadAM(target, false)
  call Chat(C_Done)
  call SleepInCombatAM()
  call Trace("===Attack Fully Finished===")
  set attack_running = false
  call Sleep(2.5)
endfunction
SMUnlimited commented 1 month ago

Distraction attack is designed to distract a player to attack those units, so his main force can attack elsewhere.