Some changes to recruitment test scenario

now it is defaultAI vs formula recruitment + defaultAI
This commit is contained in:
Bartek Waresiak 2008-07-28 00:14:13 +00:00
parent 36bb0ae608
commit 1f77afe070
2 changed files with 29 additions and 7 deletions

View file

@ -10,14 +10,29 @@ def highest_value( input_map )
choose( input_map, value ).value;
def change_numbers_to_percents( input_map )
map( input_map, (value*100) / highest_value(input_map) );
map( input_map,
(value*100) / highest_value(input_map)
);
def add_number_to_values( input_map, number )
map( input_map,
value + number
);
#make sure we have only positive values in a map #
def make_positive_only( input_map )
if( lowest_value( input_map ) < 0, map( input_map, value + abs(lowest_value( input_map ))), input_map );
if( lowest_value( input_map ) < 0,
add_number_to_values(
input_map,
abs(lowest_value(input_map))
),
input_map
);
def sumarize_maps_values( map_A, map_B )
map( map_A + map_B, value + map_A[key]);
map( map_A + map_B,
value + map_A[key]
);
#===== Evaluation how good unit is on a map ===== #
@ -101,7 +116,7 @@ def abilities_weights()
['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];
def weapon_specials_weights()
[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30, 'firststrike' -> 10, 'poison' -> 25 ];
[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 50 ,'charge' -> 30 ,'drains' -> 30, 'firststrike' -> 10, 'poison' -> 25 ];
def apply_abilities_weights( units_map )
map( units_map, value + (value*max(map( get_unit_type( key ).abilities, 'ability', abilities_weights()[ability] )))/100 );
@ -135,5 +150,12 @@ def unit_chooser(ai*,unit_map)
# ========== Main formula section ========== #
[recruit(unit_chooser(self,recruitment_list_builder(eval(self),apply_abilities_weights(apply_weapon_specials_weights(evaluate_attackers(self))),apply_abilities_weights(apply_weapon_specials_weights(evaluate_defenders(self)))))),
if( teams[my_side].gold>20, [], fallback('human')) ]
if(my_leader.loc = loc(11,23),
if( teams[my_side].gold>20,
recruit(unit_chooser(self,recruitment_list_builder(eval(self),apply_abilities_weights(apply_weapon_specials_weights(evaluate_attackers(self))),apply_abilities_weights(apply_weapon_specials_weights(evaluate_defenders(self)))))),
fallback('default') ),
if(vars.check = turn,
[set_var('check', 0), fallback('default')],
[set_var('check', turn), move(my_leader.loc, nearest_keep(my_leader.loc))])
)

View file

@ -46,7 +46,7 @@ Gs^Fp , Gs^Fp , Wwf , Wwf , Mm , Rd
canrecruit=1
recruit=Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Thunderer,Thief,Poacher,Footpad
gold=100
controller=human
controller=ai
[/side]
[side]