- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
void go(int c) {
int c1;
Point startPoint = Game.soldiers.soldier_array[c].SoldierView.getLocation();
int g = this.random.nextInt(5);
for (c1 = 0; c1 < Game.soldiers.soldier_array.length; ++c1) {
if (c1 == c) continue;
if (Game.soldiers.soldier_array[c].SoldierView.getX() == Game.soldiers.soldier_array[c1].SoldierView.getX() & Game.soldiers.soldier_array[c].SoldierView.getY() + Game.side_length == Game.soldiers.soldier_array[c1].SoldierView.getY() && !Game.soldiers.soldier_array[c].fraction.equals(Game.soldiers.soldier_array[c1].fraction)) {
g = 0;
}
if (Game.soldiers.soldier_array[c].SoldierView.getX() == Game.soldiers.soldier_array[c1].SoldierView.getX() & Game.soldiers.soldier_array[c].SoldierView.getY() - Game.side_length == Game.soldiers.soldier_array[c1].SoldierView.getY() && !Game.soldiers.soldier_array[c].fraction.equals(Game.soldiers.soldier_array[c1].fraction)) {
g = 1;
}
if (Game.soldiers.soldier_array[c].SoldierView.getX() + Game.side_length == Game.soldiers.soldier_array[c1].SoldierView.getX() & Game.soldiers.soldier_array[c].SoldierView.getY() == Game.soldiers.soldier_array[c1].SoldierView.getY() && !Game.soldiers.soldier_array[c].fraction.equals(Game.soldiers.soldier_array[c1].fraction)) {
g = 2;
}
if (!(Game.soldiers.soldier_array[c].SoldierView.getX() - Game.side_length == Game.soldiers.soldier_array[c1].SoldierView.getX() & Game.soldiers.soldier_array[c].SoldierView.getY() == Game.soldiers.soldier_array[c1].SoldierView.getY()) || Game.soldiers.soldier_array[c].fraction.equals(Game.soldiers.soldier_array[c1].fraction)) continue;
g = 3;
}
if (g == 0 && Game.soldiers.soldier_array[c].SoldierView.getY() < Game.side_length * Game.titles_line_length - Game.side_length) {
Game.soldiers.soldier_array[c].SoldierView.setLocation(Game.soldiers.soldier_array[c].SoldierView.getX(), Game.soldiers.soldier_array[c].SoldierView.getY() + Game.side_length);
}
if (g == 1 && Game.soldiers.soldier_array[c].SoldierView.getY() > 0) {
Game.soldiers.soldier_array[c].SoldierView.setLocation(Game.soldiers.soldier_array[c].SoldierView.getX(), Game.soldiers.soldier_array[c].SoldierView.getY() - Game.side_length);
}
if (g == 2 && Game.soldiers.soldier_array[c].SoldierView.getX() < Game.side_length * Game.titles_line_length - Game.side_length) {
Game.soldiers.soldier_array[c].SoldierView.setLocation(Game.soldiers.soldier_array[c].SoldierView.getX() + Game.side_length, Game.soldiers.soldier_array[c].SoldierView.getY());
}
if (g == 3 && Game.soldiers.soldier_array[c].SoldierView.getX() > 0) {
Game.soldiers.soldier_array[c].SoldierView.setLocation(Game.soldiers.soldier_array[c].SoldierView.getX() - Game.side_length, Game.soldiers.soldier_array[c].SoldierView.getY());
}
for (c1 = 0; c1 < Game.soldiers.soldier_array.length; ++c1) {
if (c1 == c || !(Game.soldiers.soldier_array[c1].SoldierView.getX() == Game.soldiers.soldier_array[c].SoldierView.getX() & Game.soldiers.soldier_array[c1].SoldierView.getY() == Game.soldiers.soldier_array[c].SoldierView.getY())) continue;
Game.soldiers.soldier_array[c].SoldierView.setLocation(startPoint);
if (Game.soldiers.soldier_array[c].fraction.equals(Game.soldiers.soldier_array[c1].fraction)) continue;
Game.soldiers.soldier_array[c].health-=Game.soldiers.soldier_array[c1].damage;
Game.soldiers.soldier_array[c1].health-=Game.soldiers.soldier_array[c].damage;
if (Game.soldiers.soldier_array[c].health <= 0) {
Game.soldiers.soldier_array[c].SoldierView.setLocation(0, - Game.side_length);
}
if (Game.soldiers.soldier_array[c1].health > 0) continue;
Game.soldiers.soldier_array[c1].SoldierView.setLocation(0, - Game.side_length);
}
}
gost 27.09.2015 18:20 # 0
3_14dar 27.09.2015 19:20 # 0
3.14159265 27.09.2015 21:01 # +7
Ну так иди напитон, 3_14dar!
3_14dar 27.09.2015 21:23 # 0
1024-- 27.09.2015 22:03 # +6
3_14dar 28.09.2015 00:08 # −2