Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Most of class had finished and i only provide the correct code of RPG class and Caster package Characters; //this package is too long and
Most of class had finished and i only provide the correct code of RPG class and Caster
package Characters; //this package is too long and i can not provide on chegg, just keep the name of the Attack when writing code import Attacks.Attack; import java.awt.*; import java.util.ArrayList; public abstract class RPGCharacter { private String name; private int maxHP; private Point position; protected int currentHP; protected int intellect; protected int strength; protected ArrayList attackList = new ArrayList(); public RPGCharacter(String name,int intellect,int strength, int maxHP, Point position){ this.name=name; this.maxHP=maxHP; this.intellect=intellect; this.strength=strength; this.position=position; currentHP = maxHP; } public int getCurrentHP(){ return currentHP; } public Point getPosition(){ return position; } public int getMaxHP(){ return maxHP; } public String getName(){ return name; } public void move(int x, int y){ position.move(position.x + x,position.y + y); } public boolean takeDamage(int amount) { if (this.currentHP-amount= this.maxHP){ currentHP = maxHP; return true; } else { currentHP += amount; return false; } } public abstract int attack(RPGCharacter character,int index); public String getAttacks(){ This is the method need help return ""; } public String toString(){ this is the method need help } }
Caster class
package Characters; import Attacks.Attack; import java.awt.*; public abstract class Caster extends RPGCharacter{ private int maxMana; private int currentMana; public Caster(String name, int intellect, int maxHP, Point position,int maxMana) { super(name, intellect, 1, maxHP, position); this.currentMana=maxMana; } public int getCurrentMana(){ return currentMana; } @Override public int attack(RPGCharacter character, int index) { this is the class need help, most of things i wrote maybe incorrect complete this by the imgage
int result = 0; if (attackList.size() this is the toString need help return ; } }
This is the priest extend caster
RPGCharacter -name: String - maxHP: int - position : Point #currentHP: int #intellect: int #strenght: int #attackList : ArrayListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started