static-cleanup #21
8
.idea/dictionaries/project.xml
generated
Normal file
8
.idea/dictionaries/project.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="project">
|
||||
<words>
|
||||
<w>deathmage</w>
|
||||
<w>thornmail</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
@@ -16,7 +16,7 @@ When implementing the features of the game we will apply the TDD-technique.
|
||||
RWRD implements common elements from roguelikes, and games in general.
|
||||
|
||||
### The player
|
||||
The player object is a representation of the user and it's agency in the game world
|
||||
The player object is a representation of the user, and it's agency in the game world
|
||||
|
||||
### Entity.Player
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
error: unknown option `-git'
|
||||
usage: git shortlog [<options>] [<revision-range>] [[--] <path>...]
|
||||
or: git log --pretty=short | git shortlog [<options>]
|
||||
|
||||
-c, --[no-]committer group by committer rather than author
|
||||
-n, --[no-]numbered sort output according to the number of commits per author
|
||||
-s, --[no-]summary suppress commit descriptions, only provides commit count
|
||||
-e, --[no-]email show the email address of each author
|
||||
-w[<w>[,<i1>[,<i2>]]] linewrap output
|
||||
--[no-]group <field> group by field
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package Action;
|
||||
|
||||
import Job.JobHolder;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class EPTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void select_spell_target_index_over_boundry() {
|
||||
public void select_spell_target_index_over_boundary() {
|
||||
Scanner testScanner = new Scanner(new ByteArrayInputStream("1\n2\n".getBytes()));
|
||||
wizard = new Wizard(testScanner);
|
||||
|
||||
@@ -143,11 +143,11 @@ public class EPTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void select_spell_target_index_under_boundry() {
|
||||
public void select_spell_target_index_under_boundary() {
|
||||
Scanner testScanner = new Scanner(new ByteArrayInputStream("1\n0\n".getBytes()));
|
||||
wizard = new Wizard(testScanner);
|
||||
|
||||
Player player = new Player("Alfon", wizard);
|
||||
Player player = new Player("Alfons", wizard);
|
||||
player.setMana(50);
|
||||
|
||||
OffensiveDamageSpell fireball = new OffensiveDamageSpell("Fireball", 20, 1, 15);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class InterestingTests {
|
||||
Scanner testScanner = new Scanner(new ByteArrayInputStream("1\n1\n".getBytes()));
|
||||
wizard = new Wizard(testScanner);
|
||||
|
||||
Player player = new Player("Alfon", wizard);
|
||||
Player player = new Player("Alfons", wizard);
|
||||
player.setMana(50);
|
||||
|
||||
OffensiveStatusSpell poisonSpray = new OffensiveStatusSpell("poisonSpray", 20, 1, "Poison");
|
||||
@@ -50,7 +50,7 @@ public class InterestingTests {
|
||||
wizard = new Wizard(testScanner);
|
||||
Position position = new Position(1,1);
|
||||
|
||||
Player player = new Player("Alfon", wizard);
|
||||
Player player = new Player("Alfons", wizard);
|
||||
Player player2 = new Player("Bob", wizard);
|
||||
player.setMana(50);
|
||||
player2.moveTo(position);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Action.DigAction;
|
||||
import Entity.Player;
|
||||
import Inventory.Inventory;
|
||||
import Job.Miner;
|
||||
@@ -10,7 +9,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class MinerTest {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class MonsterTest {
|
||||
|
||||
@@ -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