Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this using Java please! Thank you. CSE 205: Object Oriented Programming Assignment 3 Overvievw In this assignment you will write a

I need help with this using Java please! Thank you.
image text in transcribed
image text in transcribed
image text in transcribed
CSE 205: Object Oriented Programming Assignment 3 Overvievw In this assignment you will write a program that will sim- Node Attack Heal QuickAttack Actor BattleEngineAs Okay, breathe! Everything will be fine. There are a lot of parts to this, but most of them are actually very short Your goal is to write a small engine for running through events that occur in combat in a game. This itself isn't a big deal, but there's some complications. For example, when someone is killed their actions for the rest of the turn should be removed, otherwise you'll have dead people attacking you. Other actions may always go first while others will always go last. These will have to properly prioritized. The requirements here will list out all critical aspects of each class, but may not explicitly state everything that is required. If a class has a name variable, and another class uses that name for something then you should be able to infer that a getName method is needed. Requirements Your program must do the following in order to receive full credit on this assignment. 1. Write a new class called Actor which represents a single fighter in combat. a. All Actors have a name, and a current amount of health. b. Define a constant STARTINGHEALTH which is equal to 100 c. The Actor constructor should take a name and set the current health to the constant. d. Other classes will need to know this Actors name and if they are dead. i. At what point would someone die in combat? 2. Provide a method that allows this Actor to take damage. This should take an int parameter and reduce their health by that much. In order to save space, this will also function as your healing method a. b. i. If the parameter is negative, subtracting it from your health would increase ii. An Actor cannot have more health than STARTINGHEALTH 3. Define an abstract class called BattleEvent which represents an action being taken by an Actor a. I will need an owner and a target b. It will also need an amount of damage it does and a priority c. Provide the signature for an abstract void method called doEvent which takes no i. These are both Actors i. Both of these should be an int. More on priority later 4. Write a class called Node which represents a node in a linked list. It will need a pointer to the next node in the last as well as the BattleEvent it will be holding in the list. It will also nced the methods common to a linked list node a. b. Write a class called BattleEngine which is the actual linked list. 5. For fun, and to see where this sort of thing can be helpful, make all variables and methods in this class static a. i. Remember that you won't want to make the variables inside your methods static, only the ones that would normally be instance variables. b. Like all linked lists, the one variable this class really needs is the head Node. 6. Start with three common methods for linked lists: a. b. c. isEmpty count print, which will print the contents of the list (if any) in order 7. Write a method called executeNext a. b. c. This method runs the next event (if any) in the list. Run doEvent on the head Node (actually do the action Remove the head Node from the list (that action has been done so now it's no longer queued) Return the Actor that was the target of the action d. i. If there was no action to execute, return null 8. Write a void method called remove which takes an Actor as a parameter This method needs to remove all Nodes in the list whose events either target, or are owned by the given Actor. a. i. This Actor has died, so he shouldn't be attacking anyone and hitting him is just rude. 9. Write a void method called add which takes a BattleEvent and adds it to the list Here's the issue, BattleEvents with a lower priority value need to be placed BEFORE higher ones. a. i. So, an event with a priority of -1 would come before one with a value of 0. i. Events of the same priority are added in order as normal. ii So, if the first event added is by Actor One has a priority of 0, the second is added by Actor Two has a priority of 0, and the third is added by Actor Three and has a priority of-1, then the final order in which the Actor would take their action would be: Three, One, Two

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago

Question

Define Management or What is Management?

Answered: 1 week ago