SU Memo template 2 ECS Battle Arena (v1.0.0) Specification The aim of this coursework is to construct a simple simulation of a battle arena. This arena will admit students and they will form a team to...

Can it be done by Saturday at 16 GMT?


SU Memo template 2 ECS Battle Arena (v1.0.0) Specification The aim of this coursework is to construct a simple simulation of a battle arena. This arena will admit students and they will form a team to battle different teams of monsters. You are not required to have prior knowledge in gaming to complete this coursework. Your task is to implement the specification as written. In some cases, specific names are defined or specific properties given for classes. This is mainly to ensure that we can easily read your code, and find the parts that are most relevant to the marking scheme. You will not gain marks for deviating from the specification in order to increase the realism of the simulation. In fact, it may cost you marks and make it harder to assess what you have written. In some cases, we wish to know that you can use specific Java constructs, so if it specifies an ArrayList then we want to see you use an ArrayList. There might be other ways of implementing the same feature but we are trying to assess your ability to use specific constructs. Where the specification is less explicit in the way something is implemented (for example, by omitted what data types to use) you are free to make your own choices but will be assessed on how sensible those choices are. Comments in your code should explain the choices you have made. An FAQ will be kept on the notes pages of answers that we give to questions about the coursework. If issues are found with the specification it will be revised if necessary. If questions arise as to how certain aspects might be implemented then suggestions of approaches may be made but these will be suggestions only and not defined parts of the specification. How the ECS Battle Arena works For this coursework you are expected to follow the specification of the students, teams, guilds, and the battle arena as set out below. This will not correspond exactly to a real student, teams, and definitely not monsters nor battle arena in reality but we have chosen particular aspects for you to model that help you to demonstrate your Java programming. The battle arena simulates the battles between teams of students and teams of monsters. A list of characters participated in our simulation are listed in Table 1. The columns list the base attributes, i.e., hit points, attack, defence, speed, and knowledge points of the different characters. • Hit points – the character’s hit points determining the character strength. A character’s is alive when their hit points is positive. We will often use HP as a short-hand for hit points. • Attack – the character’s attacker power. The more attack power a character has, the more damage that the character will deal to the enemy when attacking. • Defence – the character’s defence power. The more defence power a character has, the less damage that the character will receive from the enemy when being attacked. • Speed – the character’s speed. A character with a higher speed will have the turn to make their move before a character with a lower speed. ECS Battle Arena Image from vecteezy.com https://secure.ecs.soton.ac.uk/student/wiki/w/COMP1202/Coursework 3 • Knowledge points – the character’s required knowledge points to use their special ability. Notice that knowledge points are only relevant for students. We will often use KP as a short-hand for knowledge points in this document. We will explain how the base attributes contribute to the characters’ ability later. There are a number of concepts, people, and procedures that contribute to this simulation. For our purposes these include: Students: The different students that join the Guild and fight against the monsters. Monsters: The monsters that challenge the student guild. Teams: A battle in the system happens between two teams, formed by a maximum of 5 characters (students or monsters). Guilds: A guild is formed by a group of students and student teams can be created from the guild members to battle the monster teams. Table 1. Base attributes for different characters The next sections will take you through the construction of the various required concepts. You are recommended to follow this sequence of development as it will allow you to slowly add more functionality and complexity to your final simulation. The first few steps will provide more detailed information to get you started. It is important that you conform to the specification given. If properties and methods are written in red then they are expected to appear that way for the test harness and our marking harnesses to work properly. Part 1 – The Character and Team classes Characters The first class you will need to create is a class that represents a Character. The properties for the Character class that you will need to define are: • name – this is the unique name of the character, • baseHP, baseAtk, baseDef, baseSpd – this is the base hit points, attack, defence, speed of the character. • level – the character current level. A character starts from Level 1. A character’s attributes are based on their level and base attributes. Define these as you think appropriate, and create a constructor that initialises them with the following signature. Character Hit Points Attack Defence Speed Knowledge Points Computer Science (CS) 7 6 6 6 4 Computer Science with Artificial Intelligence (AI) 6 7 7 5 3 Computer Science with Cyber Security (Cyber) 7 7 5 6 6 Software Engineering (SE) 8 5 8 4 10 Minion 5 5 5 5 -- Boss 8 7 8 7 -- 4 Character(String name, int baseHP, int baseAtk, int baseDef, int baseSpd) Define accessor methods • getName() – returns the name of the character • getMaxHP(), getAttack(), getDefence(), getSpeed() – return the maximum hit points, the attack, the defence, the speed for the character (taken into account the base attributes and the character current level) accordingly. The attributes are computed according to the following formula. Round(baseAtt * (level^1.2)) Where baseAtt represent the base hit points, base attack, base defence, base speed accordingly. “Round” is the mathematical integer rounding function. • getTargetEP() – returns the required target experience points (EP) for the character to gather in the current level to go to the next level. The attribute is computed according to the following formula. Round(10 * (level^1.5)) Now define the following additional properties: • currentHP – the current hit points of the character. Initially, this should be the same as the character maximum HP. • currentEP – the current experience points of the character. Define the accessor and mutator methods • getHP(), getEP() – return the current HP, EP of the character accordingly. • increaseHP(int amount), decreaseHP(int amount) – increases/decreases the current HP of the character. Ensure that the current HP of the character is non-negative and no more than the maximum HP for the character. • increaseEP(int amount) – increases the current EP of the character. If the EP reaches the target experience points, the character will level up. In this case, the level of the character is increased by 1, and the current EP resets to 0. If the character is alive, i.e., their current HP is none 0, it resets to the maximum HP (corresponding to the new character level). Otherwise, i.e., if their HP is 0, it stays as 0 (this case can happen when the EP is gained from being attacked). Teams The second class you will need to create is to represent a team. The properties of a team are: • name – this is the name of the team. • members – the members of the team, this is a collection of characters. Define name as you think appropriate, and use an ArrayList to represent the members of a team. Create a constructor Team(String name) that initialises them. Implement the following getter and setter methods. • getName() – returns the name of the team • Character[] getMembers() – returns the members of the team as an array of Characters. • addMember(Character member) – add a new member to the team. The method returns an int indicates the status of the operation as follows. o the member is already in the team, returns -1 o the team is full, i.e., already has 5 members, the member is not added and returns -2 o returns the size of the team after the member has been added. Extend the Character class with appropriate properties, a setter method setTeam(Team team) for setting the team for the character, and a getter method getTeam() for returning the current team for the character. You can have any additional properties and methods for your classes as you wish. 5 BY THIS STAGE you should have a Character class, and a Team class connected to the Character class. Figure 1. Characters and Teams You can now test your Character and Team classes by creating a main method and to create some objects of these classes. You can call increaseEP() method on the Character objects and check how their status changes. You can call addMembers() method on the Team objects and check its return status in different situations. Part 2 – The Different Classes for Students The first step in this part is to create is a class that represents a Student. The Student class will be the basis for the students in different programmes. Create a Student class that inherits from the Character class. The properties that you will need to define for Students are: • maxKP – the maximum knowledge points for the student. • currentKP – the current knowledge points for the student. This must be non- negative and no more than the student’s maximum knowledge point. The student can use their special abilities when their knowledge points reach the maximum. Define these as you think appropriate, and create a constructor that initialises them. In particular, define a construct with the following signature. Student(String name, int baseHP, int baseAtk, int baseDef, int baseSpd, int maxKP) The Student class will also need to define some methods: • increaseKP(int amount) – increases the knowledge point for the character. • javaProgramming(Character enemy) – uses the Java Programming skill on the enemy. The following actions will be carried out. o The character’s EP is
Dec 10, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here