comments
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package com.bayviewglen.zork.Entities.Enemies;
|
package com.bayviewglen.zork.Entities.Enemies;
|
||||||
|
|
||||||
import com.bayviewglen.zork.Entities.Entity;
|
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{
|
public class Enemy extends Entity{
|
||||||
private int damageGiven;
|
private int damageGiven;
|
||||||
private String name;
|
private String name;
|
||||||
@@ -11,6 +14,7 @@ public class Enemy extends Entity{
|
|||||||
private boolean blinded;
|
private boolean blinded;
|
||||||
|
|
||||||
public Enemy(){
|
public Enemy(){
|
||||||
|
// Call super constructor to store health and hunger.
|
||||||
super(100.0, 100.0);
|
super(100.0, 100.0);
|
||||||
damageGiven = 10;
|
damageGiven = 10;
|
||||||
blinded = false;
|
blinded = false;
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import java.lang.reflect.Constructor;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Player extends Entity{
|
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 ArrayList<Item> inventory = new ArrayList<Item>();
|
||||||
private final int INVENTORY_CAPACITY = 120;
|
private final int INVENTORY_CAPACITY = 120;
|
||||||
private int currentInventoryWeight;
|
private int currentInventoryWeight;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.bayviewglen.zork.Entities;
|
package com.bayviewglen.zork.Entities;
|
||||||
|
|
||||||
public class Riddle {
|
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 question;
|
||||||
private String answer;
|
private String answer;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ package com.bayviewglen.zork.Entities;
|
|||||||
import com.bayviewglen.zork.Items.Item;
|
import com.bayviewglen.zork.Items.Item;
|
||||||
|
|
||||||
public class Riddler extends Entity {
|
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;
|
Riddle riddle;
|
||||||
String message;
|
String message;
|
||||||
Item prize;
|
Item prize;
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
package com.bayviewglen.zork.Items;
|
package com.bayviewglen.zork.Items;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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{
|
public class CraftableItem extends Item{
|
||||||
private ArrayList<Item> materials;
|
private ArrayList<Item> materials;
|
||||||
public CraftableItem(int id, String name, String description, boolean isConsumable, int health, int weight) {
|
public CraftableItem(int id, String name, String description, boolean isConsumable, int health, int weight) {
|
||||||
super(id, name, description, isConsumable, health, weight);
|
super(id, name, description, isConsumable, health, weight);
|
||||||
materials = new ArrayList<Item>();
|
materials = new ArrayList<Item>();
|
||||||
}
|
}
|
||||||
|
// override the isCraftable method from the item class, stating that craftable items are craftable.
|
||||||
public boolean isCraftable() {
|
public boolean isCraftable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.bayviewglen.zork.Items;
|
package com.bayviewglen.zork.Items;
|
||||||
|
|
||||||
public class Item {
|
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 int id;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
|||||||
Reference in New Issue
Block a user