This commit is contained in:
jslightham
2019-06-01 02:05:37 -04:00
parent f937a017cd
commit d941264ec1
6 changed files with 26 additions and 2 deletions

View File

@@ -1,7 +1,10 @@
package com.bayviewglen.zork.Entities.Enemies;
import com.bayviewglen.zork.Entities.Entity;
/*
* This is the enemy class, which extends the entity class.
* The enemy class is instantiated in the initiate enemies method of the game class, and stores information such as damage given, name, description, room, loot, and whether or not it is blinded.
*/
public class Enemy extends Entity{
private int damageGiven;
private String name;
@@ -11,6 +14,7 @@ public class Enemy extends Entity{
private boolean blinded;
public Enemy(){
// Call super constructor to store health and hunger.
super(100.0, 100.0);
damageGiven = 10;
blinded = false;

View File

@@ -6,6 +6,10 @@ import java.lang.reflect.Constructor;
import java.util.ArrayList;
public class Player extends Entity{
/*
* Player class that extends the main entity class.
* Takes care of inventory and health of the player as well as bleeding status.
*/
private ArrayList<Item> inventory = new ArrayList<Item>();
private final int INVENTORY_CAPACITY = 120;
private int currentInventoryWeight;

View File

@@ -1,6 +1,9 @@
package com.bayviewglen.zork.Entities;
public class Riddle {
/*
* A simple riddle object that stores a question, and the answer to that question that is used in the riddler class.
*/
private String question;
private String answer;

View File

@@ -2,6 +2,11 @@ package com.bayviewglen.zork.Entities;
import com.bayviewglen.zork.Items.Item;
public class Riddler extends Entity {
/*
* Create the riddler character, which is an entity.
* Holds a riddle, and has an item as a prize.
* Riddlers are instantiated by the room loading method at the begining of the game class.
*/
Riddle riddle;
String message;
Item prize;

View File

@@ -1,13 +1,17 @@
package com.bayviewglen.zork.Items;
import java.util.ArrayList;
/*
* Extends the item class, and is extended by all items that can be crafted.
* Stores the items required to craft the specific item.
*/
public class CraftableItem extends Item{
private ArrayList<Item> materials;
public CraftableItem(int id, String name, String description, boolean isConsumable, int health, int weight) {
super(id, name, description, isConsumable, health, weight);
materials = new ArrayList<Item>();
}
// override the isCraftable method from the item class, stating that craftable items are craftable.
public boolean isCraftable() {
return true;
}

View File

@@ -1,6 +1,10 @@
package com.bayviewglen.zork.Items;
public class Item {
/*
* The main class that all items, and types of items extend.
* Items are their own classes due to the way that they are used in this game, created and destroyed multiple times.
*/
private int id;
private String name;
private String description;