monster #20

Merged
viud3133 merged 39 commits from monster into equipments 2025-10-30 12:05:40 +01:00
4 changed files with 19 additions and 4 deletions
Showing only changes of commit 1dbfdb9e9f - Show all commits

View File

@ -1,2 +0,0 @@
public class Bäckahäst extends Monster implements CanMove, CanAttack {
}

6
src/main/java/Nixie.java Normal file
View File

@ -0,0 +1,6 @@
public abstract class Nixie extends Monster implements CanMove, CanAttack {
public Nixie() {
super(0,0,Monster.DEFAULT_POSITION);
}
}

View File

@ -1,2 +1,6 @@
public class Troll extends Monster implements CanMove, CanAttack {
public abstract class Troll extends Monster implements CanMove, CanAttack {
public Troll() {
super(0,0,Monster.DEFAULT_POSITION);
}
}

View File

@ -13,7 +13,7 @@ import java.util.*;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.*;
public class MonsterTest {
@ -65,6 +65,13 @@ public class MonsterTest {
assertThat(legalDestinations, hasItem(defaultShade.getPosition()));
}
@Test
void shade_wont_move_to_same_position_as_player() {
Position destination = new Position(1, 1);
when(defaultPlayer.getPosition()).thenReturn(destination);
assertThat(defaultShade.moveTo(destination), equalTo(false));
}
@Test
void monster_cannot_do_anything_when_out_of_energy() {