-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f97d740
commit dd1f2e5
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
src/main/java/com/lapisberry/game/entities/characters/BaseCharacter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.lapisberry.game.entities.characters; | ||
|
||
import com.lapisberry.utils.Config; | ||
|
||
public abstract class BaseCharacter { | ||
// Fields | ||
private final String name; | ||
private final String abilityDescription; | ||
private final int rollPerTurn; | ||
private final int diceRequiredForPureMagic; | ||
private int hp; | ||
private int maxHp; | ||
private int rotPower; | ||
private int reRollLeft; | ||
private boolean isWantToUsePureMagic; | ||
|
||
// Constructor | ||
public BaseCharacter(String name, String abilityDescription, int hp) { | ||
this.name = name; | ||
this.abilityDescription = abilityDescription; | ||
this.rollPerTurn = Config.DEFAULT_ROLL_PER_TURN; | ||
this.diceRequiredForPureMagic = Config.DEFAULT_DICE_REQUIRED_FOR_PURE_MAGIC; | ||
this.hp = hp; | ||
this.maxHp = hp; | ||
this.rotPower = Config.DEFAULT_ROT_POWER; | ||
} | ||
|
||
// Getters Setters | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getAbilityDescription() { | ||
return abilityDescription; | ||
} | ||
|
||
public boolean isWantToUsePureMagic() { | ||
return isWantToUsePureMagic; | ||
} | ||
|
||
public void setWantToUsePureMagic(boolean wantToUsePureMagic) { | ||
isWantToUsePureMagic = wantToUsePureMagic; | ||
} | ||
|
||
public int getReRollLeft() { | ||
return reRollLeft; | ||
} | ||
|
||
public void setReRollLeft(int reRollLeft) { | ||
this.reRollLeft = reRollLeft; | ||
} | ||
|
||
public int getDiceRequiredForPureMagic() { | ||
return diceRequiredForPureMagic; | ||
} | ||
|
||
public int getRotPower() { | ||
return rotPower; | ||
} | ||
|
||
public void setRotPower(int rotPower) { | ||
this.rotPower = rotPower; | ||
} | ||
|
||
public int getMaxHp() { | ||
return maxHp; | ||
} | ||
|
||
public void setMaxHp(int maxHp) { | ||
this.maxHp = maxHp; | ||
} | ||
|
||
public int getHp() { | ||
return hp; | ||
} | ||
|
||
public void setHp(int hp) { | ||
this.hp = Math.max(0, Math.min(hp, maxHp)); | ||
} | ||
|
||
public int getRollPerTurn() { | ||
return rollPerTurn; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/lapisberry/game/entities/characters/Dummy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.lapisberry.game.entities.characters; | ||
|
||
public final class Dummy extends BaseCharacter { | ||
public Dummy() { | ||
super("Dummy", "I have no special ability", 10); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
package com.lapisberry.utils; | ||
|
||
public final class Config { | ||
// Application | ||
public static final int PORT = 1234; | ||
|
||
// Game | ||
public static final int DEFAULT_ROLL_PER_TURN = 3; | ||
public static final int DEFAULT_ROT_POWER = 0; | ||
public static final int DEFAULT_DICE_REQUIRED_FOR_PURE_MAGIC = 3; | ||
} |