develop #1
@@ -1,17 +1,26 @@
|
|||||||
package org.project.item.armors;
|
package org.project.item.armors;
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
import org.project.entity.Entity;
|
||||||
public abstract class Armor {
|
import org.project.item.Item;
|
||||||
|
|
||||||
|
public abstract class Armor implements Item {
|
||||||
private int defense;
|
private int defense;
|
||||||
private int maxDefense;
|
private int maxDefense;
|
||||||
private int durability;
|
private int durability;
|
||||||
private int maxDurability;
|
private int maxDurability;
|
||||||
|
|
||||||
private boolean isBroke;
|
private boolean isBroke;
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
public Armor(int defense, int durability) {
|
public Armor(int id, String name, int defense, int durability) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
this.defense = defense;
|
this.defense = defense;
|
||||||
this.durability = durability;
|
this.durability = durability;
|
||||||
|
this.maxDefense = maxDefense;
|
||||||
|
this.maxDurability = maxDurability;
|
||||||
|
this.isBroke = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkBreak() {
|
public void checkBreak() {
|
||||||
@@ -21,11 +30,11 @@ public abstract class Armor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: (BONUS) UPDATE THE REPAIR METHOD
|
|
||||||
public void repair() {
|
public void repair() {
|
||||||
isBroke = false;
|
isBroke = false;
|
||||||
defense = maxDefense;
|
defense = maxDefense;
|
||||||
durability = maxDurability;
|
durability = maxDurability;
|
||||||
|
System.out.println("🔨 " + name + " has been repaired!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDefense() {
|
public int getDefense() {
|
||||||
@@ -39,4 +48,20 @@ public abstract class Armor {
|
|||||||
public boolean isBroke() {
|
public boolean isBroke() {
|
||||||
return isBroke;
|
return isBroke;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void use(Entity target)
|
||||||
|
{
|
||||||
|
System.out.println("🛡️ " + name + " is equipped!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
package org.project.item.armors;
|
package org.project.item.armors;
|
||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
import org.project.entity.Entity;
|
||||||
public class KnightArmor {
|
|
||||||
// TODO: DESIGN ARMOR'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
public class KnightArmor extends Armor{
|
||||||
|
|
||||||
|
public KnightArmor()
|
||||||
|
{
|
||||||
|
super(1, "Plate Armor", 15, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void use(Entity target) {
|
||||||
|
System.out.println("🛡️ You equipped the heavy Plate Armor! (High Defense)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,17 @@
|
|||||||
package org.project.item.armors;
|
package org.project.item.armors;
|
||||||
|
|
||||||
public class LeatherArmor {
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
public class LeatherArmor extends Armor{
|
||||||
|
|
||||||
|
public LeatherArmor()
|
||||||
|
{
|
||||||
|
super(3, "Light Leather", 8, 70);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void use(Entity target)
|
||||||
|
{
|
||||||
|
System.out.println("🗡️ You equipped the Light Leather. (Balanced Stats)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
package org.project.item.armors;
|
package org.project.item.armors;
|
||||||
|
|
||||||
public class Robe {
|
import org.project.entity.Entity;
|
||||||
|
|
||||||
|
public class Robe extends Armor{
|
||||||
|
public Robe()
|
||||||
|
{
|
||||||
|
super(2, "magic robe", 5, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void use(Entity target) {
|
||||||
|
System.out.println("🧙♂️ You equipped the Magic Robe. (Low Defense, High Magic Focus)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user