local U=require("\109\111\115\101\115")local e=require("\112\108\046\099\108\097\115\115")CDOTABaseAbility=e(CBaseEntity)local Q={level=0,MaxLevel=1}function CDOTABaseAbility._init(R,e)R:super(U.extend({},Q,e or{}))end function CDOTABaseAbility.GetAbilityName(U)return U.name end function CDOTABaseAbility.GetAbilityIndex(U)return U.index end function CDOTABaseAbility.SetAbilityIndex(e,U)e.index=U end function CDOTABaseAbility.GetDuration(U)return U.AbilityDuration end function CDOTABaseAbility.GetMaxLevel(U)return U.MaxLevel end function CDOTABaseAbility.GetLevel(U)return U.level end function CDOTABaseAbility.SetLevel(e,U)e.level=U end function CDOTABaseAbility.UpgradeAbility(e,U)if e:CanAbilityBeUpgraded()then e:SetLevel(e:GetLevel()+1)end end function CDOTABaseAbility.CanAbilityBeUpgraded(U)if U.AbilityBehavior:match("\068\079\084\065\095\065\066\073\076\073\084\089\095\066\069\072\065\086\073\079\082\095\078\079\084\095\076\069\065\082\078\065\066\076\069")then return ABILITY_NOT_LEARNABLE end if U.AbilityBehavior:match("\068\079\084\065\095\065\066\073\076\073\084\089\095\066\069\072\065\086\073\079\082\095\072\073\068\068\069\078")then return ABILITY_CANNOT_BE_UPGRADED_NOT_UPGRADABLE end if U.level==U.MaxLevel then return ABILITY_CANNOT_BE_UPGRADED_AT_MAX end return ABILITY_CAN_BE_UPGRADED end function CDOTABaseAbility.GetSpecialValueFor(Q,e)return U.path(Q,"\115\112\101\099\105\097\108",e)end function CDOTABaseAbility.EndCooldown(U) end
local m = require("moses")
local class = require("pl.class")

-- selene: allow(incorrect_standard_library_use)
CDOTABaseAbility = class(CBaseEntity)

local DEFAULTS = { level = 0, MaxLevel = 1 }

function CDOTABaseAbility:_init(attributes)
  self:super(m.extend({}, DEFAULTS, attributes or {}))
end

function CDOTABaseAbility:GetAbilityName()
  return self.name
end

function CDOTABaseAbility:GetAbilityIndex()
  return self.index
end

function CDOTABaseAbility:SetAbilityIndex(i)
  self.index = i
end

function CDOTABaseAbility:GetDuration()
  return self.AbilityDuration
end

function CDOTABaseAbility:GetMaxLevel()
  return self.MaxLevel
end

function CDOTABaseAbility:GetLevel()
  return self.level
end

function CDOTABaseAbility:SetLevel(level)
  self.level = level
end

function CDOTABaseAbility:UpgradeAbility(_supressSpeech)
  if self:CanAbilityBeUpgraded() then
    self:SetLevel(self:GetLevel() + 1)
  end
end

function CDOTABaseAbility:CanAbilityBeUpgraded()
  if self.AbilityBehavior:match("DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE") then
    return ABILITY_NOT_LEARNABLE
  end

  if self.AbilityBehavior:match("DOTA_ABILITY_BEHAVIOR_HIDDEN") then
    return ABILITY_CANNOT_BE_UPGRADED_NOT_UPGRADABLE
  end

  if self.level == self.MaxLevel then
    return ABILITY_CANNOT_BE_UPGRADED_AT_MAX
  end

  return ABILITY_CAN_BE_UPGRADED
end

function CDOTABaseAbility:GetSpecialValueFor(key)
  return m.path(self, "special", key)
end

function CDOTABaseAbility:EndCooldown() end
