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. If not, see <https://www.gnu.org/licenses/>.
20 ! (The AI is called Erwin for unknown reasons.)
22 ! The new improved AI (for the old, non-improved version, have a look at
25 ! Choose snow randomly from time to time.
26 if (random(5) == 1) return 'S';
27 ! If the cloud is right above the enemy house and it has >75%
28 ! then we strike with lightning to do most damage.
29 ! If the cloud is close to the enemy house and it has >75%
30 ! then we strike with tornado.
31 ! If the cloud is far away from the enemy house
32 ! then we strike with hail.
33 ! If the place where we would like to hit is covered with snow
34 ! then we use rain to get rid of it.
36 if (((CountDestroyed(' ', house2_x, house2_y, 17, 10) - SPACES) < 25)
39 else if (((CountDestroyed(' ', house2_x, house2_y, 17, 10) - SPACES) < 25)
42 else if (CountSnow(house2_x, house2_y, 17, 10) > 5)
47 if (((CountDestroyed(' ', house1_x, house1_y, 17, 10) - SPACES) < 25)
50 if (((CountDestroyed(' ', house1_x, house1_y, 17, 10) - SPACES) < 25)
53 else if (CountSnow(house1_x, house1_y, 17, 10) > 5)
61 ! For lightning, we don't need to aim and can return immediately
62 if (input == 'L') return 0;
63 ! In case of snow, we aim at our own house
67 return (Abs(windspeed * 20) + (-3 - cloud_x)) / 20;
69 return (-Abs(windspeed * 20) + (-3 - cloud_x)) / 20;
72 return (Abs(windspeed * 20) + (69 - cloud_x)) / 20;
74 return (-Abs(windspeed * 20) + (60 - cloud_x)) / 20;
77 ! Otherwise, we aim at the opponent's house
80 return (Abs(windspeed * 20) + (69 - cloud_x)) / 20;
82 return (-Abs(windspeed * 20) + (60 - cloud_x)) / 20;
85 return (Abs(windspeed * 20) + (-3 - cloud_x)) / 20;
87 return (-Abs(windspeed * 20) + (-3 - cloud_x)) / 20;