equipments #22
@@ -1,8 +0,0 @@
|
||||
package Monster;
|
||||
|
||||
public abstract class Nixie extends Monster implements CanMove, CanAttack {
|
||||
|
||||
public Nixie() {
|
||||
super(0,0,Monster.DEFAULT_POSITION);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class Troll extends Monster implements CanMove, CanAttack {
|
||||
if (playerIsAtPosition(destination, world)) {
|
||||
return false;
|
||||
}
|
||||
if (tileHasWrongHabitat(position, world)) {
|
||||
if (tileHasWrongHabitat(destination, world)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -205,4 +205,16 @@ public class MonsterTest {
|
||||
assertThat(defaultTroll.moveTo(destination, world), equalTo(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
void troll_can_move_to_tile_within_its_habitat() {
|
||||
when(mockTile.getBiome()).thenReturn(Biomes.FOREST);
|
||||
Position destination = new Position(1, 3);
|
||||
|
||||
worldGenerator.randomWorldGeneration();
|
||||
World world = worldGenerator.getWorld();
|
||||
world.addTile(mockTile, destination);
|
||||
|
||||
assertThat(defaultTroll.moveTo(destination, world), equalTo(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user