mail[Wesnoth-commits] r33683 - in /trunk/data/campaigns/Legend_of_Wesmere: ai/patrol.fai scenarios/16_The_Chief_must_die_utils.cfg


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

Header


Content

Posted by dragonking on March 15, 2009 - 16:49:
Author: dragonking
Date: Sun Mar 15 16:49:47 2009
New Revision: 33683

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33683&view=rev
Log:
Partol formula and syntax update for scenario 16

Added:
    trunk/data/campaigns/Legend_of_Wesmere/ai/patrol.fai
Modified:
    
trunk/data/campaigns/Legend_of_Wesmere/scenarios/16_The_Chief_must_die_utils.cfg

Added: trunk/data/campaigns/Legend_of_Wesmere/ai/patrol.fai
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Legend_of_Wesmere/ai/patrol.fai?rev=33683&view=auto
==============================================================================
--- trunk/data/campaigns/Legend_of_Wesmere/ai/patrol.fai (added)
+++ trunk/data/campaigns/Legend_of_Wesmere/ai/patrol.fai Sun Mar 15 16:49:47 
2009
@@ -1,0 +1,40 @@
+fai '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,
+    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/campaigns/Legend_of_Wesmere/scenarios/16_The_Chief_must_die_utils.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Legend_of_Wesmere/scenarios/16_The_Chief_must_die_utils.cfg?rev=33683&r1=33682&r2=33683&view=diff
==============================================================================
--- 
trunk/data/campaigns/Legend_of_Wesmere/scenarios/16_The_Chief_must_die_utils.cfg
 (original)
+++ 
trunk/data/campaigns/Legend_of_Wesmere/scenarios/16_The_Chief_must_die_utils.cfg
 Sun Mar 15 16:49:47 2009
@@ -55,13 +55,14 @@
         name=_ "Odrun"
         side=7
         x,y=25,4
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(25,4)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -70,13 +71,14 @@
         name=_ "Gragul"
         side=7
         x,y=16,29
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(16,29)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -85,13 +87,14 @@
         name=_ "Kardur"
         side=7
         x,y=10,20
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(10,20)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -100,13 +103,14 @@
         name=_ "Muhtr"
         side=7
         x,y=13,25
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(13,25)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
     [unit]
         type=Goblin Pillager
@@ -114,13 +118,14 @@
         name=_ "Kartrog"
         side=7
         x,y=22,27
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(22,27)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
     [unit]
         type=Wolf Rider
@@ -128,13 +133,14 @@
         name=_ "Griul"
         side=7
         x,y=12,29
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(12,29)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
     [unit]
         type=Goblin Knight
@@ -142,13 +148,14 @@
         name=_ "Sdrul"
         side=7
         x,y=13,19
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(13,19)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -157,13 +164,14 @@
         name=_ "Etruw"
         side=7
         x,y=31,15
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(31,15)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -172,13 +180,14 @@
         name=_ "Utrub"
         side=7
         x,y=29,24
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(29,24)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -187,13 +196,14 @@
         name=_ "Bihlas"
         side=7
         x,y=5,21
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(5,21)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(25,4)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -359,13 +369,14 @@
         name=_ "Uhmit"
         side=7
         x,y=17,8
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(17,8)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(25,4) -> loc(16,15), loc(16,15) -> loc(25,4) ]
+               next_step="loc(17,8)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]
@@ -374,13 +385,14 @@
         name=_ "Mrat"
         side=7
         x,y=14,15
-        formula="if(attack, attack, move(me.loc, choose(unit_moves(me.loc), 
-distance_between(self, me.vars.guard_loc))))
-                       where attack = choose(filter(attacks, units = 
[me.loc] and distance_between(me.vars.guard_loc, target) <= 
me.vars.guard_radius and unit_at(target).side=me.vars.hostile_side-1 ), 
avg_damage_inflicted)"
-        [ai_vars]
-            guard_radius=5
-            guard_loc="loc(14,15)"
-            hostile_side=1
-        [/ai_vars]
+        [ai]
+            loop_formula="{campaigns/Legend_of_Wesmere/ai/patrol.fai}"
+            [vars]
+               guard_radius=3
+               waypoints=[ loc(14,15) -> loc(16,15), loc(16,15) -> 
loc(14,15) ]
+               next_step="loc(14,15)"
+            [/vars]
+        [/ai]
     [/unit]
 
     [unit]




Related Messages


Powered by MHonArc, Updated Sun Mar 15 18:00:31 2009