This commit is contained in:
Luca Carnegie
2019-05-31 23:50:38 -04:00
7 changed files with 87 additions and 10 deletions

View File

@@ -1,8 +1,8 @@
Enemy Name: Henry Pellatt
Description: The owner of the Castle
Starting Room: Apple Hallway
Starting Room: Billiard Room
Damage Given: 25
Loot: Crowbar
Loot: Point
Enemy Name: Lady Pellatt
Description: The wife to the owner of the Castle
Starting Room: Lady Pellatt's Bedroom

View File

@@ -114,7 +114,7 @@ Room name: Sir Henry Mill Pellatt's Bathroom
Room Description: You are now in Sir Henry Mill Pellatt's Bathroom. The floor mat is still quite wet.<br>Perhaps someone just took a shower. A half-empty shaving cream bottle lies on the counter, along with a toothbrush and some toothpaste.
Locked: false
Boarded: false
Items: Shavingcream, Toothbrush, Toothpaste
Items: Shavingcream, Toothbrush, Toothpaste, Bandage
Riddler:
Exit Rooms: N-Sir Henry Mill Pellatt's Bedroom
@@ -122,7 +122,7 @@ Room name: Linen Closet
Room Description: A whiff of lavender-scented laundry detergent enters your nostrils as you step into<br>a dark room. Ah, you must be in the Linen Closet. No one really comes in here other than the servants. I'm pretty sure Sir Pellatt and<br>Lady Pellatt don't even know this room exists.
Locked: false
Boarded: false
Items: Clothes
Items: Clothes, Bandage
Riddler:
Exit Rooms: E-Sir Henry Mill Pellatt's Bedroom, W-Guest Bedroom, S-Willow Bedroom
@@ -202,7 +202,7 @@ Room name: Supply Closet
Room Description: You are in the Supply Closet. A mop, bucket and a few towels lay on the ground. The space is quite small<br>and can only hold around 3 people. Nothing interesting seems to be happening in here.
Locked: false
Boarded: false
Items:Mop,Bucket,Towels
Items:Mop,Bucket,Towels, Robes
Riddler:
Exit Rooms: E-Silver Stairs (1st Floor), S-Kitchen, N-Serving and Breakfast Room

View File

@@ -70,3 +70,5 @@ lightbulb, item
craft, verb
batteringram, item
ladypellatt, enemy
use, verb
bandage, item

View File

@@ -36,7 +36,7 @@ public class Combat {
System.out.println("You missed!");
}else if(rand<0.15) {
}else if(rand<0.20) {
enemy.setHealth(enemy.getHealth()-object.getDamage()*1.5);
if(enemy.getHealth() < 0)
enemy.setHealth(0);
@@ -68,11 +68,13 @@ public class Combat {
}
else if(rand<0.1) {
System.out.println(enemy.getName() + " missed!");
}else if(rand < 0.15) {
}else if(rand < 0.20) {
player.setHealth(player.getHealth()-enemy.getDamage()*1.5);
if(player.getHealth() < 0)
player.setHealth(0);
System.out.println(enemy.getName() + " hit you with a critical hit, doing " + enemy.getDamage()*1.5 + " damage! Your health is now " + player.getHealth() + "%");
System.out.println("You are now bleeding.");
player.setBleeding(true);
}
else {
player.setHealth(player.getHealth()-enemy.getDamage());

View File

@@ -9,6 +9,7 @@ public class Player extends Entity{
private ArrayList<Item> inventory = new ArrayList<Item>();
private final int INVENTORY_CAPACITY = 120;
private int currentInventoryWeight;
private boolean isBleeding;
public Player() {
super(100.0, 100.0);
@@ -40,10 +41,18 @@ public class Player extends Entity{
}
public void eat() {
health+=5;
health+=25;
if(health > 100.0) {
health = 100.0;
}
}
public void setBleeding(boolean bleeding) {
this.isBleeding = bleeding;
}
public boolean getBleeding() {
return isBleeding;
}
}

View File

@@ -236,17 +236,39 @@ class Game {
for (int i = 0; i < player.getInventory().size(); i++) {
currentRoom.addItem(player.getInventory().get(i));
player.removeFromInventory(player.getInventory().get(i));
i--;
}
currentRoom = masterRoomMap.get("CIRCLE_ROOM");
System.out.println(
"Poof! You looked pretty banged up there, so I brought you back to the circle room. Your items are where you died.");
player.setHealth(100.0);
player.setBleeding(false);
try {
currentCombat.getEnemy().setHealth(100.0);
currentCombat = null;
}
}
}
}catch (Exception e) {
}
}
}
}
if(player.getBleeding()) {
player.setHealth(player.getHealth()-2);
System.out.println("You are bleeding. Find, and use bandages to stop bleeding.");
System.out.println("Your health is now " + player.getHealth() + "%");
}
if(player.getHealth() <= 0) {
for (int i = 0; i < player.getInventory().size(); i++) {
currentRoom.addItem(player.getInventory().get(i));
player.removeFromInventory(player.getInventory().get(i));
i--;
}
currentRoom = masterRoomMap.get("CIRCLE_ROOM");
System.out.println(
"Poof! You looked pretty banged up there, so I brought you back to the circle room. Your items are where you died.");
player.setHealth(100.0);
player.setBleeding(false);
}
Command command = parser.getCommand();
finished = processCommand(command);
}
@@ -603,6 +625,8 @@ class Game {
} else {
System.out.println("You do not have that weapon!");
}
}else {
System.out.println("Attack with what?");
}
}
break;
@@ -651,6 +675,37 @@ class Game {
System.out.println("Craft what?");
}
break;
case "use":
if(command.hasItem()) {
Class<?> clazz;
Item object;
try {
clazz = Class.forName(
"com.bayviewglen.zork.Items." + command.getItem().substring(0, 1).toUpperCase().trim()
+ command.getItem().substring(1).trim());
Constructor<?> ctor = clazz.getConstructor();
object = (Item) ctor.newInstance();
if(!object.equals(new Bandage()))
throw new Exception();
boolean hasBandage = false;
for(Item i : player.getInventory()) {
if(i.equals(new Bandage())) {
hasBandage = true;
}
}
if(hasBandage) {
System.out.println("You are no longer bleeding.");
player.setBleeding(false);
player.removeFromInventory(new Bandage());
}else {
System.out.println("You do not have a bandage!");
}
}catch (Exception e) {
System.out.println("You cannot use that item!");
}
}else {
System.out.println("Use what?");
}
default:
return false;
}

View File

@@ -0,0 +1,9 @@
package com.bayviewglen.zork.Items;
public class Bandage extends CraftableItem{
public Bandage() {
super(98, "Bandage", "A bandage to stop bleeding", false, 100, 1);
super.addMaterial(new Robes());
}
}