Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The retreat control seems to lack some judgment #305

Closed
jzy-chitong56 opened this issue May 13, 2024 · 0 comments
Closed

The retreat control seems to lack some judgment #305

jzy-chitong56 opened this issue May 13, 2024 · 0 comments

Comments

@jzy-chitong56
Copy link
Contributor

jzy-chitong56 commented May 13, 2024

This avoids the distance of the main hero's position, but does not determine the distance between the main army's position and the starting point

Meanwhile, in hero micro operation missions, emergency TP is code controlled. Can emergency TP also be opened for SetGroupsFlee,Simultaneously close isfleeing

if not desperation_assault and ((CaptainRetreating() and isfleeing) or town_threatened) then     //((major_hero == null or not UnitAlive(major_hero)) and ver_heroes) or  then  //attack_running and
    call Trace("===Retreat control ended===")
    set break_attack = attack_running
    set retreat_controlled = false
    call SetGroupsFlee(true)
    if major_hero != null and UnitAlive(major_hero) and DistanceBetweenPoints_kd(home_location, GetUnitLoc(major_hero)) < 1250 then
      set isfleeing = false     // home so no need to be retreating. Also prevents bug in the captainretreating condition
    endif
    return
endif

new

  if not desperation_assault and ((CaptainRetreating() and isfleeing) or town_threatened or CaptainIsHome()) then     //((major_hero == null or not UnitAlive(major_hero)) and ver_heroes) or  then  //attack_running and
    call Trace("===Retreat control ended===")
    set break_attack = attack_running
    set retreat_controlled = false
    call SetGroupsFlee(true)
    if CaptainIsHome() or (major_hero != null and UnitAlive(major_hero) and DistanceBetweenPoints_kd(home_location, GetUnitLoc(major_hero)) < 1250) or (main_army >= 0 and army_loc[main_army] != null and DistanceBetweenPoints(home_location, army_loc[main_army]) < 1250) then
      set isfleeing = false     // home so no need to be retreating. Also prevents bug in the captainretreating condition
      call SetGroupsFlee(false)
    endif
    return
  endif
SMUnlimited added a commit that referenced this issue May 20, 2024
Another case of hardcoded AI conflicting with AMAI logic.

Retreat Control will now protect own towns first over allied towns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants