-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmor.java
More file actions
30 lines (25 loc) · 1009 Bytes
/
Armor.java
File metadata and controls
30 lines (25 loc) · 1009 Bytes
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
package game;
import java.util.List;
import java.util.ArrayList;
public class Armor extends Item {
public static List<Armor> armorList = new ArrayList<>();
public int protection_value;
public String equipSlot; // Head, Chest, Leg, Feet
public static void armorReg(Armor armorToReg) {
armorList.add(armorToReg);
Item.itemReg(armorToReg);
}
//currentHp, each armor piece, damage being done
public int calculateDamageReduction(Creature attacker, Integer damage, Creature defender) {
Item attackersWeapon = attacker.ON_HAND;
int totalDamage = damage + Weapon.calculateAtk(attacker, (Weapon) attackersWeapon);
int defendersProtectValue = defender.getIntProtectValue(defender);
int actualDamage = defendersProtectValue - totalDamage;
return actualDamage;
}
public Armor(String displayName, Item[] recipe, int protection_value, String equipSlot) {
super(displayName, recipe);
this.protection_value = protection_value;
this.equipSlot = equipSlot;
}
}