-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWarrior.java
More file actions
39 lines (34 loc) · 1.29 KB
/
Copy pathWarrior.java
File metadata and controls
39 lines (34 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.example.entities.characters;
//import java.lang.Character;
//Class used to implement the Warrior character class
public class Warrior extends Character {
public Warrior(String name, int currentExperience, int level) {
super(name,currentExperience,currentExperience,5,2,3,200,75);
this.imuneFire = true;
this.currentLevel = level;
}
//Method used to receive damage
@Override
public void receiveDamage(int damage) {
//Secondary atributes lower damage
damage -= this.dexterityLevel * 2;
damage -= this.charismaLevel;
if (damage < 0) {
damage = 0;
}
this.currentHealth -= damage;
if (this.currentHealth <= 0) {
this.currentHealth = 0;
}
}
//Method used to deal damage
@Override
public int getDamage() {
//Main atribute affects damage
return 5 + this.strengthLevel * 5;
}
@Override
public String toString() {
return "Warrior stats : Name : " + this.name + " Level : " + this.currentLevel + " Experience : " + this.currentExperience + "/" + this.currentLevel*10 + " Damage : " + this.getDamage() + " Health : " + this.getCurrentHealth() + " Mana : " + this.getCurrentMana();
}
}