forked from SMUnlimited/AMAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HeroFleeRules.ai
43 lines (34 loc) · 3.84 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
40
41
42
43
// 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] > 5) and (hero_hp_loss[hn] > 0.4), ACTION_TP, 200, ACTION_ZEPPELIN_HOME, 150)
//call ActionRule(true, ACTION_TP, DistanceBetweenPoints_kd(home_location, GetUnitLoc(hero_unit[hn]))*0.006)
// Only here as a backup as getdensities may not totally be working correctly
call ActionRule(GetLocationNonCreepStrength(GetUnitX(hero_unit[hn]), GetUnitY(hero_unit[hn]), 1500) * 2 < army_strength[GetArmyOfUnit(hero_unit[hn])] , ACTION_TP, -100000)
call ActionRule(DistanceBetweenPoints_kd(home_location, GetUnitLoc(hero_unit[hn])) < 2000 and (hero_enemy_density[hn] > 1), ACTION_TP, -100)
call ActionRule(DistanceBetweenPoints_kd(home_location, GetUnitLoc(hero_unit[hn])) < 2000 and (hero_enemy_density[hn] < 1), ACTION_TP, -1000000)
call ActionRule(town_threatened, ACTION_TP, -100000)
//call ActionRule(DistanceBetweenPoints_kd(home_location, GetUnitLoc(hero_unit[hn])) < 2500, ACTION_TP, -1000000)
//call ActionRule( army_strength[GetArmyOfUnit(hero_unit[hn])] < teleport_army_min_strength ,ACTION_TP, -100)
//call ActionRule( army_strength[GetArmyOfUnit(hero_unit[hn])] < enemy_strength_sum, ACTION_TP, -1000000)
//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_dd(GetUnitLoc(nearest_neutral[hFountainID]),GetUnitLoc(hero_unit[hn])) > DistanceBetweenPoints_kd(home_location,GetUnitLoc(hero_unit[hn])), 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, 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 < 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 < 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, ACTION_TP, -1000000)
call ActionRule(healer == null, ACTION_HEALER, -1000000)