CS代考 package dungeonmania.entities.enemies;

package dungeonmania.entities.enemies;

import java.util.List;
import java.util.Random;

Copyright By PowCoder代写 加微信 powcoder

import java.util.stream.Collectors;

import dungeonmania.Game;
import dungeonmania.map.GameMap;
import dungeonmania.util.Position;

public class ZombieToast extends Enemy {
public static final double DEFAULT_HEALTH = 5.0;
public static final double DEFAULT_ATTACK = 6.0;
private Random randGen = new Random();

public ZombieToast(Position position, double health, double attack) {
super(position, health, attack);

public void move(Game game) {
Position nextPos;
GameMap map = game.getMap();
List pos = getPosition().getCardinallyAdjacentPositions();
.filter(p -> map.canMoveTo(this, p)).collect(Collectors.toList());
if (pos.size() == 0) {
nextPos = getPosition();
game.getMap().moveTo(this, nextPos);
nextPos = pos.get(randGen.nextInt(pos.size()));
game.getMap().moveTo(this, nextPos);

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com