Gamelib/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/Character.java

62 lines
2.0 KiB
Java
Raw Normal View History

2021-04-29 14:45:18 +00:00
package uulm.teamname.marvelous.gamelibrary.entities;
2021-04-29 14:45:18 +00:00
import uulm.teamname.marvelous.gamelibrary.IntVector2;
/** Represents a playable character inside a match. */
public class Character extends Entity {
/** The name of the character */
public final String name;
/** The hp stat of the character */
public final Stat hp;
/** The mp stat of the character */
public final Stat mp;
/** The ap stat of the character */
public final Stat ap;
/** The ranged attack range of the character */
public final int attackRange;
/** The ranged attack damage of the character */
public final int rangedDamage;
/** The melee attack damage of the character */
public final int meleeDamage;
/** The {@link Inventory} of the character */
public final Inventory inventory = new Inventory();
/**
* Constructs a new {@link Character} with an empty inventory.
* @param id The {@link EntityID} of the character
* @param position The position of the character
* @param name The name of the character
* @param hp The maximum hp of the character
* @param mp The maximum mp of the character
* @param ap The maximum ap of the character
* @param attackRange The ranged attack range of the character
* @param rangedDamage The ranged damage of the character
* @param meleeDamage The melee damage of the character
*/
public Character(EntityID id, IntVector2 position, String name, int hp, int mp, int ap, int attackRange, int rangedDamage, int meleeDamage) {
super(id, position);
this.name = name;
this.hp = new Stat(StatType.HP, hp);
this.mp = new Stat(StatType.MP, mp);
this.ap = new Stat(StatType.AP, ap);
this.attackRange = attackRange;
this.rangedDamage = rangedDamage;
this.meleeDamage = meleeDamage;
}
/**
* Checks if the character is still alive.
* @return Whether or not the characters hp is greater than 0
*/
public boolean isAlive() {
return hp.getValue() > 0;
}
}