From 349aeb8cf9fe07fa339a439e988951510f4f16f9 Mon Sep 17 00:00:00 2001 From: Panda248 Date: Sun, 22 May 2022 18:31:47 -0400 Subject: [PATCH] uh ig combat works --- src/entities/units/player/Player.java | 13 +++++++++---- src/playerdata/characters/PlayableCharacter.java | 9 +-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/entities/units/player/Player.java b/src/entities/units/player/Player.java index 8340d93..bcb3063 100644 --- a/src/entities/units/player/Player.java +++ b/src/entities/units/player/Player.java @@ -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; @@ -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 { @@ -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)); @@ -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); } @@ -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 diff --git a/src/playerdata/characters/PlayableCharacter.java b/src/playerdata/characters/PlayableCharacter.java index 7e74b30..4c35885 100644 --- a/src/playerdata/characters/PlayableCharacter.java +++ b/src/playerdata/characters/PlayableCharacter.java @@ -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; @@ -35,9 +35,6 @@ public int getExp() { return exp; } - public int getMoney() { - return money; - } protected PlayableCharacter() { // Default character constructor @@ -45,7 +42,6 @@ protected PlayableCharacter() { attack = 1; this.level = 1; this.exp = 0; - this.money = 0; this.maxExp = Constants.LevelingConstants.MAX_EXP(1); } @@ -61,9 +57,6 @@ public void gainExp(int amount) { this.exp+= amount; } - public void gainMoney(int amount) { - this.money+= amount; - }