Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifiers #46

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 49 additions & 4 deletions agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,57 @@ def is_unit_attacking_unit(unit_attacker, unit_target):
# Otherwise, the unit is not attacking the target, and there are no incoming projectiles.
return 0.

def is_invulnerable(unit):
for mod in unit.modifiers:
if mod.name == "modifier_invulnerable":
def has_modifier(hUnit, mod_list):
for mod in hUnit.modifiers:
if mod.name in mod_list:
return True
return False

def is_invulnerable(hUnit):
return has_modifier(hUnit, ['modifier_invulnerable'])

def is_made_visibile(hUnit):
vision_list = [
"modifier_item_dustofappearance",
"modifier_bounty_hunter_track",
"modifier_slardar_amplify_damage",
"modifier_bloodseeker_thirst_vision"
]
made_visibile = has_modifier(hUnit, vision_list)
# NOTE - this does not account for possible Sentry wards in area or Truesight Gem on nearby unit
return made_visibile

def has_dot(hUnit): # check for Damage over Time (DoT) on unit
# TODO (nostrademous) - check this list for completeness
dot_list = [
"modifier_abyssal_underlord_firestorm_burn",
"modifier_axe_battle_hunger",
"modifier_brewmaster_fire_permanent_immolation",
"modifier_dazzle_poison_touch",
"modifier_disruptor_thunder_strike",
"modifier_doom_bringer_scorched_earth_effect",
"modifier_doom_bringer_infernal_blade_burn",
"modifier_doom_bringer_doom",
"modifier_dragon_knight_corrosive_breath_dot",
"modifier_earth_spirit_magnetize",
"modifier_ember_spirit_searing_chains",
"modifier_huskar_burning_spear_debuff",
"modifier_ice_blast",
"modifier_item_urn_damage",
"modifier_jakiro_dual_breath_burn",
"modifier_jakiro_liquid_fire_burn",
"modifier_ogre_magi_ignite",
"modifier_phoenix_fire_spirit_burn",
"modifier_silencer_curse_of_the_silent",
"modifier_venomancer_poison_sting",
"modifier_viper_corrosive_skin",
"modifier_viper_poison_attack",
"modifier_viper_viper_strike_slow",
"modifier_warlock_shadow_word",
"modifier_maledict"
]
return has_modifier(hUnit, dot_list)

class Player:

END_STATUS_TO_TEAM = {
Expand Down Expand Up @@ -531,7 +576,7 @@ def unit_matrix(unit_list, hero_unit, only_self=False, max_units=16):
norm_distance = (distance / MAP_HALF_WIDTH) - 0.5

# Get the direction where the unit is facing.
facing_sin = math.sin(unit.facing * (2 * math.pi) / 360)
facing_sin = math.sin(unit.facing * (2 * math.pi) / 360)
facing_cos = math.cos(unit.facing * (2 * math.pi) / 360)

# Calculates normalized boolean value [-0.5 or 0.5] of if unit is within
Expand Down