Implement Items interface and weapon classes
This commit is contained in:
@@ -5,7 +5,4 @@ import org.project.entity.Entity;
|
||||
public interface Item {
|
||||
void use(Entity target);
|
||||
|
||||
/*
|
||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Bite is used by Vampire
|
||||
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class Bite extends Weapon {
|
||||
|
||||
private static final int damage = 16;
|
||||
|
||||
public Bite() {
|
||||
super(damage, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// BoneClub is used by Skeleton
|
||||
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class BoneClub extends Weapon {
|
||||
|
||||
private static final int damage = 14;
|
||||
|
||||
public BoneClub() {
|
||||
super(damage, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Dagger is used by Goblin
|
||||
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class Dagger extends Weapon {
|
||||
|
||||
private static final int damage = 12;
|
||||
|
||||
public Dagger() {
|
||||
super(damage, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// DualDagger is used by Assassin
|
||||
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class DualDagger extends Weapon {
|
||||
|
||||
private static final int damage = 30;
|
||||
private static final int manaCost = 15;
|
||||
|
||||
public DualDagger() {
|
||||
super(damage, manaCost);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Flame is used by Dragon
|
||||
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class Flame extends Weapon {
|
||||
|
||||
private static final int damage = 36;
|
||||
|
||||
public Flame() {
|
||||
super(damage, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Maggic Staff is used by Wizard
|
||||
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class MagicStaff extends Weapon {
|
||||
|
||||
private static final int damage = 28;
|
||||
private static final int manaCost = 16;
|
||||
|
||||
public MagicStaff() {
|
||||
super(damage, manaCost);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +1,14 @@
|
||||
// Sword is used by Knight
|
||||
|
||||
package org.project.item.weapons;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
public class Sword extends Weapon {
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public class Sword {
|
||||
/*
|
||||
THIS IS AN EXAMPLE OF A WEAPON DESIGN.
|
||||
*/
|
||||
|
||||
int abilityCharge;
|
||||
private static final int damage = 34;
|
||||
private static final int manaCost = 15;
|
||||
|
||||
public Sword() {
|
||||
// TODO: DESIGN SWORD'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
||||
super(damage, manaCost);
|
||||
}
|
||||
|
||||
// TODO: (BONUS) UPDATE THE UNIQUE ABILITY
|
||||
public void uniqueAbility(ArrayList<Entity> targets) {
|
||||
abilityCharge += 2;
|
||||
for (Entity target : targets) {
|
||||
target.takeDamage(getDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package org.project.item.weapons;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.Item;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public abstract class Weapon {
|
||||
public abstract class Weapon implements Item {
|
||||
private int damage;
|
||||
private int manaCost;
|
||||
|
||||
/*
|
||||
TODO: ADD OTHER REQUIRED AND BONUS ATTRIBUTES
|
||||
*/
|
||||
|
||||
public Weapon(int damage, int manaCost) {
|
||||
this.damage = damage;
|
||||
@@ -29,7 +26,5 @@ public abstract class Weapon {
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user