1 ! Z-Tornado - Two player weather action game
3 ! Tornado is copyright (C) 2000-2002 Oliver Feiler
4 ! http://www.lionking.org/~kiza/linux/tornado
5 ! Inform version copyright (c) 2003 Sophie Frühling (sfruehling@aon.at)
7 ! This program is free software; you can redistribute it and/or modify
8 ! it under the terms of the GNU General Public License as published by
9 ! the Free Software Foundation; either version 3 of the License, or
10 ! (at your option) any later version.
12 ! This program is distributed in the hope that it will be useful,
13 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ! GNU General Public License for more details.
17 ! You should have received a copy of the GNU General Public License
18 ! along with this program; if not, write to the Free Software
19 ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ! (The AI is called Erwin for unknown reasons.)
23 ! The new improved AI (for the old, non-improved version, have a look at
26 ! Choose snow randomly from time to time.
27 if (random(5) == 1) return 'S';
28 ! If the cloud is right above the enemy house and it has >75%
29 ! then we strike with lightning to do most damage.
30 ! If the cloud is close to the enemy house and it has >75%
31 ! then we strike with tornado.
32 ! If the cloud is far away from the enemy house
33 ! then we strike with hail.
34 ! If the place where we would like to hit is covered with snow
35 ! then we use rain to get rid of it.
37 if (((CountDestroyed(' ', house2_x, house2_y, 17, 10) - SPACES) < 25)
40 else if (((CountDestroyed(' ', house2_x, house2_y, 17, 10) - SPACES) < 25)
43 else if (CountSnow(house2_x, house2_y, 17, 10) > 5)
48 if (((CountDestroyed(' ', house1_x, house1_y, 17, 10) - SPACES) < 25)
51 if (((CountDestroyed(' ', house1_x, house1_y, 17, 10) - SPACES) < 25)
54 else if (CountSnow(house1_x, house1_y, 17, 10) > 5)
62 ! For lightning, we don't need to aim and can return immediately
63 if (input == 'L') return 0;
64 ! In case of snow, we aim at our own house
68 return (Abs(windspeed * 20) + (-3 - cloud_x)) / 20;
70 return (-Abs(windspeed * 20) + (-3 - cloud_x)) / 20;
73 return (Abs(windspeed * 20) + (69 - cloud_x)) / 20;
75 return (-Abs(windspeed * 20) + (60 - cloud_x)) / 20;
78 ! Otherwise, we aim at the opponent's house
81 return (Abs(windspeed * 20) + (69 - cloud_x)) / 20;
83 return (-Abs(windspeed * 20) + (60 - cloud_x)) / 20;
86 return (Abs(windspeed * 20) + (-3 - cloud_x)) / 20;
88 return (-Abs(windspeed * 20) + (-3 - cloud_x)) / 20;