Dota 2 Item choice to optimise ehp

Last time we considered how we can use knowledge of the Dota 2 mechanics to build a nested function that can tell us how much effective hp (ehp) a hp (hp) and armour value (armour) combination will give a hero.

The formula to calculate the effective hp of a hero against right clicks can be calculated by:

# Remember? The hp multiplier is a constant described in a previous article.

ehp <- function(hp, armour){ hp * hp.multiplier(armour)
                         
}                 

Last time we considered how to compare two options of item progression to acheve optimal tankiness to right clicks. To achieve this we had to calculate the ehp of the hero before adding either of the choices to our inventory and then compare this to the new ehp of our hero after either item was added to our inventory.

# I have hidden some of the code from the previous article to avoid repitition.
# The sign of the the difference tells us which item was better; the platemail.
plate - vitality_booster
## [1] 160.4

We then compared the two differences; the larger change in ehp was deemed the best choice. Considering the cost of the item, was also relevant to the decision, so we divided the increase in ehp by the gold cost of the item, giving us the amount of ehp ‘bought’ per unit gold spent.

vitality_booster / 1100
## [1] 0.3090909
plate / 1400
## [1] 0.3574286

Let’s break it down:

  1. We need a function to calculate the increase in ehp provided by an item.
# Calculates the difference between current ehp and future ehp given purchase of an item that provides bonus item_hp or item_armour (e.g. platemail gives 0 item_hp and 10 item_armour).
ehp_difference <- function(hp, armour, item_hp = 0, item_armour = 0) {
  ehp(hp + item_hp, armour + item_armour) - ehp(hp, armour)
}
# Try this yourself for both the vitality booster and platemail example used in the previous article case study.
# What happens if you don't give an argument for item_hp when testing platemail? What does item_hp default to?
  1. We could divide the output of this function by the gold cost of the item.

  2. We should then visually check the size of the difference ourselves as items may come with other bonuses not accounted for by this ehp analysis.

# We can assign the ehp per unit gold for our two item choices to appropriate names (or objects in R).

vitality_booster <- ehp_per_gold(834, 6, item_hp = 250, item_armour = 0, gold = 1100)
platemail <- ehp_per_gold(834, 6, item_hp = 0, item_armour = 10, gold = 1400)

Take away message

You have some powerful functions at your disposal. I would recommend using this type of exploration reflectively (like Naga or TB) or proactively (like Oracle or Furi). Look at the enemy line up and while your waiting for the rune to spawn think about how your core items might best be supplemented with cost effective itemisation. Extra tank in the mid game may allow you to initiate and retreat with your life as an offlane clock playmaker.

Reflecting upon a loss, would an alternative build have allowed you to get off more damage or crowd control compared to that additional damage item? Was that shadow blade really worth it with potm already on your team? Did anyone on your team have a Basi?

Shiny app

To aid the reader I have converted this knowledge into an interactive ehp app that can be used on the fly using just your web browser.

Dota is hard.