-
Notifications
You must be signed in to change notification settings - Fork 0
/
Grass.java
33 lines (27 loc) · 1.08 KB
/
Grass.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import javafx.scene.paint.Color;
import java.util.List;
public class Grass extends Plant {
Grass(MyField[][] fields, List<Organism> organisms) {
super(fields, 0, 0, Color.GREEN, "Grass", organisms);
}
Grass(MyField[][] fields, List<Organism> organisms, int posX, int posY) {
super(fields, 0, 0, Color.GREEN, "Grass", organisms, posX, posY);
}
Grass(MyField[][] fields, List<Organism> organisms, int posX, int posY, int str, int init, String name, Color color, boolean toDelete, int cooldown, int age) {
super(fields, organisms, str, init, color, name, posX, posY, toDelete, age, cooldown);
}
@Override
void action() {
if (generator.nextInt(20) == 0) {
MyField childField = getEmptyNearbyFieldForSpreadingPlant();
if (childField != null) {
organisms.add(new Grass(fields, organisms, childField.getX(), childField.getY()));
announcements += (name + " spreads over\n");
}
}
}
@Override
int reflectedAttack(Organism opponent) {
return 0;
}
}