-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDandelion.java
35 lines (29 loc) · 1.28 KB
/
Dandelion.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
34
35
import javafx.scene.paint.Color;
import java.util.List;
public class Dandelion extends Plant {
Dandelion(MyField[][] fields, List<Organism> organisms) {
super(fields, AllOrganisms.DANDELION.strength, AllOrganisms.DANDELION.initiation, AllOrganisms.DANDELION.color, AllOrganisms.DANDELION.name, organisms);
}
Dandelion(MyField[][] fields, List<Organism> organisms, int posX, int posY) {
super(fields, 0, 0, Color.YELLOW, "Dandelion", organisms, posX, posY);
}
Dandelion(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() {
for (int i = 0; i < 3; i++) {
if (generator.nextInt(20) == 0) {
MyField childField = getEmptyNearbyFieldForSpreadingPlant();
if (childField != null) {
organisms.add(new Dandelion(fields, organisms, childField.getX(), childField.getY()));
announcements += (name + " spreads over\n");
}
}
}
}
@Override
int reflectedAttack(Organism opponent) {
return 0;
}
}