static-cleanup #21
@@ -5,7 +5,7 @@ import Job.Miner;
|
||||
import Terrain.Biome;
|
||||
|
||||
public class DigAction implements Action {
|
||||
Biome biome;
|
||||
final Biome biome;
|
||||
public DigAction(Biome biome) {
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ public abstract class Attack {
|
||||
private static final double DEFAULT_ENERGY_COST = 5d;
|
||||
private static final double DEFAULT_DAMAGE = 5d;
|
||||
|
||||
private String name;
|
||||
private double energyCost;
|
||||
private double damage;
|
||||
private final String name;
|
||||
private final double energyCost;
|
||||
private final double damage;
|
||||
|
||||
public Attack() {
|
||||
name = DEFAULT_NAME;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Entity implements Positionable {
|
||||
protected String name;
|
||||
protected final String name;
|
||||
protected Position position;
|
||||
private static final List<Entity> entities = new ArrayList<Entity>();
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package Entity;
|
||||
|
||||
|
||||
public interface Movable {
|
||||
void moveTo(Position position);
|
||||
boolean canMoveTo(Position position);
|
||||
|
||||
@@ -27,9 +27,9 @@ public class Player extends Entity implements Movable, Actor, InventoryHolder, H
|
||||
protected Job job;
|
||||
protected Position position = new Position(0,0);
|
||||
protected Inventory inventory= new Inventory();
|
||||
protected List<Spell> spells = new LinkedList<>();
|
||||
protected List<String> conditions = new LinkedList<>();
|
||||
protected List<Equipment> equipments = new ArrayList<>();
|
||||
protected final List<Spell> spells = new LinkedList<>();
|
||||
protected final List<String> conditions = new LinkedList<>();
|
||||
protected final List<Equipment> equipments = new ArrayList<>();
|
||||
public Player(String name, Job job) {
|
||||
super(name);
|
||||
this.job = job;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package Item;
|
||||
|
||||
public class AttributeModifier {
|
||||
private int maxHpMod;
|
||||
private int maxMpMod;
|
||||
private int strMod;
|
||||
private int magicStrMod;
|
||||
private int defMod;
|
||||
private int magicDefMod;
|
||||
private final int maxHpMod;
|
||||
private final int maxMpMod;
|
||||
private final int strMod;
|
||||
private final int magicStrMod;
|
||||
private final int defMod;
|
||||
private final int magicDefMod;
|
||||
|
||||
public AttributeModifier(int maxHpMod, int maxMpMod, int strMod, int magicStrMod, int defMod, int magicDefMod) {
|
||||
this.maxHpMod = maxHpMod;
|
||||
|
||||
@@ -2,8 +2,8 @@ package Item;
|
||||
|
||||
public class BodyArmour extends EquipmentType{
|
||||
|
||||
private String name;
|
||||
private AttributeModifier modifiers;
|
||||
private final String name;
|
||||
private final AttributeModifier modifiers;
|
||||
|
||||
public BodyArmour(String name, AttributeModifier modifiers) {
|
||||
this.name = name;
|
||||
|
||||
@@ -5,11 +5,11 @@ import Job.Job;
|
||||
|
||||
public class Equipment implements Item {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private EquipmentType equipmentType;
|
||||
private Job equipable;
|
||||
private int slot;
|
||||
private final String id;
|
||||
private final String name;
|
||||
private final EquipmentType equipmentType;
|
||||
private final Job equipable;
|
||||
private final int slot;
|
||||
|
||||
public Equipment(String id, String name, EquipmentType equipmentType, Job equipable, int slot) {
|
||||
this.id = id;
|
||||
|
||||
@@ -2,8 +2,8 @@ package Item;
|
||||
|
||||
public class MageHat extends EquipmentType{
|
||||
|
||||
private String name;
|
||||
private AttributeModifier modifiers;
|
||||
private final String name;
|
||||
private final AttributeModifier modifiers;
|
||||
|
||||
public MageHat(String name, AttributeModifier modifiers) {
|
||||
this.name = name;
|
||||
|
||||
@@ -6,7 +6,7 @@ import Shared.Levelable;
|
||||
public abstract class Job implements Levelable {
|
||||
protected int level;
|
||||
protected int experience;
|
||||
protected String name;
|
||||
protected final String name;
|
||||
|
||||
Job(String name) {
|
||||
this.name = name;
|
||||
|
||||
@@ -6,7 +6,7 @@ import Terrain.Biome;
|
||||
|
||||
|
||||
public class Miner extends Job {
|
||||
InventoryHolder actor;
|
||||
final InventoryHolder actor;
|
||||
|
||||
public Miner(InventoryHolder actor) {
|
||||
super("Miner");
|
||||
|
||||
@@ -14,7 +14,7 @@ public class DigActionTest {
|
||||
var player = mock(Player.class);
|
||||
when(player.getJob()).thenReturn(mockMiner);
|
||||
var biome = mock(Biome.class);
|
||||
var action = new DigAction(biome);
|
||||
var action = new DigAction(Biome.COAST);
|
||||
action.execute(player);
|
||||
verify(mockMiner, times(1)).dig(biome);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import Item.AttributeModifier;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class EquipmentTest {
|
||||
private Knight knight = new Knight();
|
||||
private Wizard wizard = new Wizard();
|
||||
private final Knight knight = new Knight();
|
||||
private final Wizard wizard = new Wizard();
|
||||
private Player defaultWizard(){
|
||||
return new Player("name", wizard);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ class PlayerTest {
|
||||
var inventory = mock(Inventory.class);
|
||||
var player = new Player("abc", job, inventory);
|
||||
assertThat(player, instanceOf(Player.class));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user