SMUnlimited / AMAI

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

StrengthHandicap ,GetRace and getPlayerStrength need avoid neutral players #428

Open jzy-chitong56 opened 1 week ago

jzy-chitong56 commented 1 week ago

neutral players no need check Strength Handicap, race and Player Strength , These data cannot be referenced

now , I simply dealt with race

function GetRace takes player p returns integer
  local integer i = GetPlayerId(p)
  if i < PLAYERAGGRESSIVE then
    return player_race[i]
  endif
  return 0
endfunction

function GetRaceAggression takes unit target returns integer
  if GetPlayerId(GetOwningPlayer(target)) < PLAYERAGGRESSIVE then
    return race_aggression[Max((GetRace(GetOwningPlayer(target)) - 1) * tiernum + tier - 1,0)]
  endif
  return 0
endfunction

function SetChatVarsAttack takes unit u returns nothing
  local player p = GetOwningPlayer(u)
  if GetPlayerId(p) < PLAYERAGGRESSIVE then
    call SetChatVar("TargetRace", race_name[player_race[GetPlayerId(p)]])
    call SetChatVar("TargetColor", ColorText(GetPlayerColor(p)))
    call SetChatVarR("TargetStrength", GetPlayerStrength(p))
  endif
  set p = null
endfunction
SMUnlimited commented 5 days ago

This would make them safer if they do get used, but these are not currently used for non main player/ai units.