monster #20

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

View File

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

View File

@ -1,3 +1,5 @@
package Monster;
public enum Attacks {
CHILL(3, 2);

View File

@ -1,3 +1,5 @@
package Monster;
public enum Biomes {
GRASSLAND, MOUNTAIN, COAST, FOREST //Är inte fäst vid dessa
}

View File

@ -1,3 +1,5 @@
package Monster;
import Entity.Player;
public interface CanAttack {

View File

@ -1,3 +1,5 @@
package Monster;
import Entity.Position;
//Är detta ett ok namn?
public interface CanMove {

View File

@ -1,3 +1,5 @@
package Monster;
import Entity.*;
public abstract class Monster implements CanMove {

View File

@ -1,3 +1,5 @@
package Monster;
import Entity.Position;
import java.util.*;

View File

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

View File

@ -1,3 +1,5 @@
package Monster;
import Entity.Player;
import Entity.Position;
import java.util.*;

View File

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

View File

@ -1,2 +0,0 @@
public class Troll extends Monster implements CanMove, CanAttack {
}

View File

@ -1,10 +1,7 @@
import Action.*;
import Character.*;
import Combat.*;
import Entity.*;
import Inventory.*;
import Job.*;
import Shared.*;
import Monster.Attacks;
import Monster.MovementPatterns;
import Monster.Shade;
import org.junit.jupiter.api.*;
@ -13,7 +10,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 +62,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() {