Coder Social home page Coder Social logo

neu-cs5010-role-play-games's Introduction

Role Playing Games

Design

In many role-playing games, characters go into battle with some degree of attack and defense capabilities (represented as numerical values). These values are calculated based on the character's base attack/defense (those values don't change after initialization), plus “wearing” different articles of clothing to either increase performance (attack) or minimize damage inflicted by other characters (defense). In this assignment, you are to represent the following types of clothing.

  1. Head gear: These items go on the character’s head (hats/helmets/visors) and are only useful for defense.
  2. Hand gear: These items go on the character’s hands (gloves/swords/shield) and are only used for attack. Since you have 2 hands, you can have 2 of these items.
  3. Footwear: These items go on the character’s feet (boots/sneakers/hoverboard) and can be for attack or defense. Since you have 2 feet, you can have 2 of these items.

When the game starts out, the characters start with an attack power and a defense strength. As they go through the game, they can pick up new items to add to those two values. The following rules apply:

  • They cannot pick up more items that they can hold. This means that they are limited to:

    • One piece of head gear
    • Two pieces of footwear
    • Two pieces of hand gear
  • To be clever, when a character picks up two items of the same type, their names are combined, they make a new piece of footwear that combines the powers and name. The new name is the adjective from one item and the full name from the other. For instance, to combine

    • Scurrying Sandals -- defense strength: 1, attack strength 0
    • Happy HoverBoard -- defense strength: 3, attack strength 1

    You get

    • Scurrying, Happy HoverBoard -- defense strength: 4, attack strength 1
  • Only items of the same type have their names combined.

Create a design doc for the solution, with a test plan to test the design.

Development

Implement the class hierarchy that specified in previous part. Rather than creating a whole game, create a driver class that represents a battle. During a battle, two characters get total 10 possible items to choose from. This new class should:

  • Take two characters and a list of items as arguments to its constructor.

  • The two characters take turns to dress themself. Each turn, the character can only choose one item. After an item is chosen, it is removed from the following turns. The items should be chosen based on:

    • Rule 1: Prefer the type of item that the character has available slot for. For example, if the character already has 2 footwear, 1 hand gear and 1 helmet, the character should try to choose 1 more hand gear.
    • Rule 2: if rule 1 leads to multiple choices, pick the item has the highest attack strength.
    • Rule 3: If there is still a tie after Rule 1 and 2, pick the item has the highest defense strength.
    • Rule 4: if there is yet still a tie after Rule 1,2,3, pick a random one.
  • For each turn, Print out each character in the fight along with what they are wearing and their attack and defense strength

  • After all the 10 items are chosen, Print out who is the winner of the battle. The winner is determined by who has less damage after a battle. Damage is calculated by one's opponent's attack power minus that character's defense points. For example:

    • Player 1 has 8 attack points and 6 defense strength.
    • Player 2 has 4 attack points and 7 defense strength.
    • The battle ends with Player 1 having -2 units of damage and Player 2 having 1 unit of damage.
    • Player 1 wins.

    If there is a tie, it should be stated as such.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.