Skip to content

Commit

Permalink
uh ig combat works
Browse files Browse the repository at this point in the history
  • Loading branch information
Panda248 committed May 22, 2022
1 parent c0bc91b commit 349aeb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
13 changes: 9 additions & 4 deletions src/entities/units/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.newdawn.slick.*;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.state.StateBasedGame;
import playerdata.PlayerStats;
import playerdata.characters.PlayableCharacter;
import playerdata.characters.Sigur;
import util.DrawUtilities;
Expand All @@ -40,6 +41,7 @@ public PlayerState getState() {
protected Arte move;
protected int queue;
protected PlayableCharacter character;
protected PlayerStats stats;
// Abbreviations: LVL, EXP, HP, ATK, DEF, CR, CD, EATK, EDEF, AFF

public Player(Coordinate pos) throws SlickException {
Expand All @@ -51,6 +53,7 @@ public Player(Coordinate pos) throws SlickException {
this.sheet = new SpriteSheet("res/experimentalCharacter.png", 256, 512);
this.sprite = sheet.getSprite(0,0);
this.character = new Sigur();
this.stats = new PlayerStats();
this.arteDeck = new ArrayList<>();
for(int i = 0; i < 20; i++) {
arteDeck.add(new SonicSlash(character));
Expand Down Expand Up @@ -95,6 +98,7 @@ public void update(StateBasedGame sbg, Unit u, Game g) throws SlickException {
this.position.updatePosition(dx,dy);
this.dx = 0;
this.dy = 0;
this.stats.level=this.character.getLevel();
if(getHitBox().intersects(u.getHitBox()) && Game.time >= Game.battleCooldown) {
sbg.enterState(Main.BATTLE_ID);
}
Expand Down Expand Up @@ -187,20 +191,21 @@ public void battleRender(Graphics g, float plrX, float plrY) {

public void gainExp(int amount) {
this.character.gainExp(amount);
this.stats.exp+=amount;
}
public void gainMoney(int amount) {
this.character.gainMoney(amount);
this.stats.gold+=amount;
}

public int getExp() {
return this.character.getExp();
return this.stats.exp;
}
public int getMoney() {
return this.character.getMoney();
return this.stats.gold;
}

public int getLevel() {
return this.character.getLevel();
return this.stats.level;
}

@Override
Expand Down
9 changes: 1 addition & 8 deletions src/playerdata/characters/PlayableCharacter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public abstract strictfp sealed class PlayableCharacter extends PlayerData implements Serializable permits Sigur, Phaedra {

// PlayableCharacter is a data class. It will only be used to store characters' playerdata and will only be instantiated once per character.
protected int level, exp, money, maxExp;
protected int level, exp, maxExp;

protected int health;
protected int attack;
Expand All @@ -35,17 +35,13 @@ public int getExp() {
return exp;
}

public int getMoney() {
return money;
}

protected PlayableCharacter() {
// Default character constructor
health = 1;
attack = 1;
this.level = 1;
this.exp = 0;
this.money = 0;
this.maxExp = Constants.LevelingConstants.MAX_EXP(1);
}

Expand All @@ -61,9 +57,6 @@ public void gainExp(int amount) {
this.exp+= amount;

}
public void gainMoney(int amount) {
this.money+= amount;
}



Expand Down

0 comments on commit 349aeb8

Please sign in to comment.