Skip to content

Instantly share code, notes, and snippets.

@spheenik
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spheenik/caa02067dd12e25d7bd4 to your computer and use it in GitHub Desktop.
Save spheenik/caa02067dd12e25d7bd4 to your computer and use it in GitHub Desktop.
get abilities and corresponding heros
Iterator<Entity> iter = match.getEntities().getAllByPredicate(new Predicate<Entity>() {
@Override
public boolean apply(Entity e) {
return e.getDtClass().instanceOf("DT_DOTABaseAbility");
}
});
while (iter.hasNext()) {
Entity ability = iter.next();
Integer ownerHandle = ability.getProperty("m_hOwnerEntity");
Entity hero = match.getEntities().getByHandle(ownerHandle);
// do something with the ability and the hero.
Integer abilityLevel = ability.getProperty("m_iLevel");
Integer manaCost = ability.getProperty("m_iManaCost");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment