HeroLib

HeroLib

2M Downloads

IsUsableP trying to check predicted resources that don't exist.

Zeldern opened this issue ยท 2 comments

commented

Below is an example of the costinfos for Heartstrike since type -2 doesn't exist IsUsableP errors for heartstrike. perhaps we should check for nil in the predcited resource map e.g.

if Player.PredictedResourceMap[CostInfo.type] ~= nil then

{ 
  [1] = { 
    ["hasRequiredAura"] = false,
    ["type"] = -2,
    ["name"] = HEALTH,
    ["cost"] = 0,
    ["minCost"] = 0,
    ["requiredAuraID"] = 202846,
    ["costPercent"] = 10,
    ["costPerSec"] = 0,
  },
  [2] = { 
    ["hasRequiredAura"] = false,
    ["type"] = 6,
    ["name"] = RUNIC_POWER,
    ["cost"] = -15,
    ["minCost"] = -15,
    ["requiredAuraID"] = 0,
    ["costPercent"] = 0,
    ["costPerSec"] = 0,
  },
  [3] = { 
    ["hasRequiredAura"] = false,
    ["type"] = 5,
    ["name"] = RUNES,
    ["cost"] = 1,
    ["minCost"] = 1,
    ["requiredAuraID"] = 0,
    ["costPercent"] = 0,
    ["costPerSec"] = 0,
  } ,
} 
commented

I will look into, although @EvanMichaels might step in there.

commented

Fixed by c5fad24
Although this cost type could be related to the health percentage only since the cost is 0 and instead it's costPercent. Right now we do support only the raw cost so while it would not throw an error, it would not be taken in account correctly.