-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathHeroFleeRules.ai
39 lines (34 loc) · 3.6 KB
/
HeroFleeRules.ai
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Initial Proirity Rules
call ActionRule3(true, ACTION_FOUNTAIN, 40, ACTION_ZEPPELIN_FOUNTAIN, 45, ACTION_DO_NOTHING, -10)
call ActionRule2(true, ACTION_MANA_FOUNTAIN, 5, ACTION_MOONWELLS, 30)
call ActionRule2(true, ACTION_GO_HOME, 25, ACTION_ZEPPELIN_HOME, 35)
call ActionRule2(true, ACTION_TP, 50, ACTION_HEALER, 8)
//call ActionRule2(true, ACTION_GO_HOME, (1 - hero_hp[hn])*20, ACTION_ZEPPELIN_HOME, (1 - hero_hp[hn])*30)
//call ActionRule2(true, ACTION_TP, (1 - hero_hp[hn])*15, ACTION_ZEPPELIN_FOUNTAIN, (1 - hero_hp[hn])*25)
call ActionRule2(hero_hp_loss[hn] > 0.5, ACTION_TP, 40, ACTION_ZEPPELIN_HOME, 15)
call ActionRule2((hero_enemy_density[hn] > 2.5) and (hero_hp_loss[hn] > 0.4), ACTION_TP, 200, ACTION_ZEPPELIN_HOME, 150)
call ActionRule(hero_enemy_density[hn] > 2.5 and DistanceBetweenPoints(hero_dir[hn],hero_loc[hn]) <= 225, ACTION_TP, 200)
//call ActionRule(true, ACTION_TP, DistanceBetweenPoints(home_location, l)*0.006)
call ActionRule(DistanceBetweenPoints(home_location, l) < 2000 and (hero_enemy_density[hn] > 1), ACTION_TP, -100)
call ActionRule(DistanceBetweenPoints(home_location, l) < 2000 and (hero_enemy_density[hn] < 1), ACTION_TP, -1000000)
call ActionRule(town_threatened, ACTION_TP, -100000) // town threatened handled outside of these rules
if armyOfHero >= 0 then
call ActionRule( army_strength[armyOfHero] < teleport_army_min_strength ,ACTION_TP, -10)
//call ActionRule( army_strength[armyOfHero] < enemy_strength_sum, ACTION_TP, -1000000)
endif
//call ActionRule3(true, ACTION_TP, (I2R(GetHeroLevel(hero_unit[hn]))*14)-20, ACTION_ZEPPELIN_HOME, I2R(GetHeroLevel(hero_unit[hn]))*8, ACTION_ZEPPELIN_FOUNTAIN, I2R(GetHeroLevel(hero_unit[hn]))*6)
// Rules of action failure
call ActionRule(not race_has_moonwells or TownCountDone(racial_farm) <= 0, ACTION_MOONWELLS,-1000000)
if nearest_neutral[hFountainID] != null then
call ActionRule(DistanceBetweenPoints_dk(GetUnitLoc(nearest_neutral[hFountainID]),l) > DistanceBetweenPoints(home_location,l), ACTION_MOONWELLS, 18) // Use moonwells if they closer than the fountain
else
call ActionRule(true,ACTION_MOONWELLS, 18)
endif
call ActionRule2(follow_zeppelin == null or IsUnitInGroup(follow_zeppelin, unit_rescueing), ACTION_ZEPPELIN_HOME, -1000000.0, ACTION_ZEPPELIN_FOUNTAIN, -1000000.0)
call ActionRule3(not race_use_fountain, ACTION_FOUNTAIN, -100.0, ACTION_ZEPPELIN_FOUNTAIN, -100.0, ACTION_MANA_FOUNTAIN, -100.0)
call ActionRule2(nearest_neutral[NEUTRAL_HEALING_FOUNTAIN] == null and nearest_neutral[NEUTRAL_POWER_FOUNTAIN] == null and nearest_neutral[NEUTRAL_HEAL_WARD] == null, ACTION_FOUNTAIN, -1000000, ACTION_ZEPPELIN_FOUNTAIN, -1000000)
call ActionRule(nearest_neutral[NEUTRAL_MANA_FOUNTAIN] == null and nearest_neutral[NEUTRAL_POWER_FOUNTAIN] == null, ACTION_MANA_FOUNTAIN, -1000000)
call ActionRule2(not neutral_available[hFountainID] or (neutral_guarded[hFountainID] and (not neutral_night_buy[hFountainID] or (daytime > 6 and daytime < 18))) or GetLocationNonCreepStrength(GetUnitX(nearest_neutral[hFountainID]), GetUnitY(nearest_neutral[hFountainID]), 1500) > 0 , ACTION_FOUNTAIN, -1000000.0, ACTION_ZEPPELIN_FOUNTAIN, -1000000.0)
call ActionRule(not neutral_available[mFountainID] or (neutral_guarded[mFountainID] and (not neutral_night_buy[mFountainID] or (daytime > 6 and daytime < 18))) or GetLocationNonCreepStrength(GetUnitX(nearest_neutral[mFountainID]), GetUnitY(nearest_neutral[mFountainID]), 1500) > 0 , ACTION_MANA_FOUNTAIN, -1000000.0)
call ActionRule(GetItemNumberOnUnit(tp_item, hero_unit[hn]) <= 0 or teleporting, ACTION_TP, -1000000)
call ActionRule(healer == null, ACTION_HEALER, -1000000)