mail[Wesnoth-commits] r33647 - in /trunk/data/ai/formula: patrol.fai scouting_eval.fai


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by dragonking on March 14, 2009 - 19:09:
Author: dragonking
Date: Sat Mar 14 19:09:06 2009
New Revision: 33647

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33647&view=rev
Log:
New faifile and some fixes to current one.

Added:
    trunk/data/ai/formula/patrol.fai
Modified:
    trunk/data/ai/formula/scouting_eval.fai

Added: trunk/data/ai/formula/patrol.fai
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/ai/formula/patrol.fai?rev=33647&view=auto
==============================================================================
--- trunk/data/ai/formula/patrol.fai (added)
+++ trunk/data/ai/formula/patrol.fai Sat Mar 14 19:09:06 2009
@@ -1,0 +1,40 @@
+faifile 'patrol.fai'
+
+def patrol_move(me)
+    if( me.vars.next_step = me.loc,
+        set_unit_var('next_step',
+            me.vars.waypoints[ me.vars.next_step ],
+            me.loc
+        ),
+        move_partial(
+            me.loc,
+            shortest_path( me.loc, me.vars.next_step )[0]
+        )
+    );
+
+if( me.movement_left = 0,
+    end_turn,
+    if(attack,
+        attack,
+        patrol_move(me)
+    )
+)
+
+where attack = if( path_to, 
+                       if(path_to.size <= me.vars.guard_radius, 
+                               attack( me.loc, path_to.last, 
closest_unit.loc ), 
+                               0 
+                       ),
+                       0
+               )
+               
+where path_to = if( closest_unit, 
+                       shortest_path( me.loc, closest_unit.loc ),
+                       []
+               )
+
+where closest_unit = choose(
+                       enemy_units, 'unit',
+                       -distance_between(me.vars.next_step, unit.loc)
+               )
+faiend

Modified: trunk/data/ai/formula/scouting_eval.fai
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/ai/formula/scouting_eval.fai?rev=33647&r1=33646&r2=33647&view=diff
==============================================================================
--- trunk/data/ai/formula/scouting_eval.fai (original)
+++ trunk/data/ai/formula/scouting_eval.fai Sat Mar 14 19:09:06 2009
@@ -2,14 +2,14 @@
 
 if(me.loc = my_leader.loc,
        -5,
-if(size(shroud) = 0, 
+if( size(shroud) = 0, 
        -5,
-if(size(enemies_in_range) != 0,
+if( size(enemies_in_range) != 0,
        -5,
-if(me.total_movement > 5, 
+if( me.total_movement > 5, 
        50, 
        -5))))
-where enemies_in_range = 
filter(unit_moves(me.loc),units_can_reach(enemy_moves, self)),
-      shroud   = find_shroud(),
+where enemies_in_range = filter( enemy_units, 'enemy', distance_between( 
me.loc, enemy.loc ) < me.total_movement),
+      shroud   = find_shroud()
 
 faiend




Related Messages


Powered by MHonArc, Updated Sat Mar 14 19:20:29 2009