Toto
This commit is contained in:
parent
d251457d66
commit
b42a5cd879
@ -7,6 +7,7 @@ import Person.PersonnageBattleSnow;
|
|||||||
import utils.Tuple;
|
import utils.Tuple;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class ComportementActionTirerBouleDeNeige implements ComportementAction {
|
public class ComportementActionTirerBouleDeNeige implements ComportementAction {
|
||||||
@ -25,8 +26,10 @@ public class ComportementActionTirerBouleDeNeige implements ComportementAction
|
|||||||
int size = persos.size();
|
int size = persos.size();
|
||||||
int item = new Random().nextInt(size);
|
int item = new Random().nextInt(size);
|
||||||
cible = persos.get(item);
|
cible = persos.get(item);
|
||||||
ArrayList<CaseAbstraite> voisins = (ArrayList<CaseAbstraite>) cible.getVoisins().values();
|
Collection<CaseAbstraite> voisinsArray = cible.getVoisins().values();
|
||||||
dest = voisins.get(new Random().nextInt(voisins.size()));
|
CaseAbstraite[] toto = new CaseAbstraite[0];
|
||||||
|
CaseAbstraite[] voisins = voisinsArray.toArray(toto);
|
||||||
|
dest = voisins[(new Random().nextInt(voisins.length))];
|
||||||
attack = true;
|
attack = true;
|
||||||
} else {
|
} else {
|
||||||
int size = cases.size();
|
int size = cases.size();
|
||||||
|
Loading…
Reference in New Issue
Block a user