shavingcream blindness
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
Enemy Name: Henry_Pellatt
|
Enemy Name: Henry Pellatt
|
||||||
Description: The owner of the Castle
|
Description: The owner of the Castle
|
||||||
Starting Room: Circle Room
|
Starting Room: Circle Room
|
||||||
Damage Given: 25
|
Damage Given: 25
|
||||||
@@ -3,7 +3,7 @@ Room Description: You are in a circular room. The windows to the east are covere
|
|||||||
Locked: false
|
Locked: false
|
||||||
Boarded: false
|
Boarded: false
|
||||||
Items:Lockpick,Milk
|
Items:Lockpick,Milk
|
||||||
Riddler: "Hello there. My name is Kevin and I am Sir Pellatt's butler. I understand that my master<comma><br>Sir Pellatt has wrongfully imprisoned you. If you answer my riddle<comma> I can give you something to<br>help you with your escape - nothing comes for free you know!", "What goes moo?", "Cows", ShavingCream
|
Riddler: "Hello there. My name is Kevin and I am Sir Pellatt's butler. I understand that my master<comma><br>Sir Pellatt has wrongfully imprisoned you. If you answer my riddle<comma> I can give you something to<br>help you with your escape - nothing comes for free you know!", "What goes moo?", "Cows", Shavingcream
|
||||||
Exit Rooms: W-Apple Hallway
|
Exit Rooms: W-Apple Hallway
|
||||||
|
|
||||||
Room name: Apple Hallway
|
Room name: Apple Hallway
|
||||||
|
|||||||
@@ -44,4 +44,7 @@ swallow, eat
|
|||||||
absorb, eat
|
absorb, eat
|
||||||
drink, eat
|
drink, eat
|
||||||
i, inventory
|
i, inventory
|
||||||
|
henry, henrypellatt
|
||||||
|
pellatt, henrypellatt
|
||||||
|
shaving, shavingcream
|
||||||
|
cream, shavingcream
|
||||||
@@ -40,7 +40,7 @@ book, item
|
|||||||
socks, item
|
socks, item
|
||||||
painting, item
|
painting, item
|
||||||
notebook, item
|
notebook, item
|
||||||
shaving cream, item
|
shavingcream, item
|
||||||
toothbrush, item
|
toothbrush, item
|
||||||
toothpaste, item
|
toothpaste, item
|
||||||
milk, item
|
milk, item
|
||||||
|
|||||||
@@ -3,15 +3,17 @@ package com.bayviewglen.zork;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
import com.bayviewglen.zork.Entities.Entity;
|
import com.bayviewglen.zork.Entities.Entity;
|
||||||
|
import com.bayviewglen.zork.Entities.Player;
|
||||||
import com.bayviewglen.zork.Entities.Enemies.Enemy;
|
import com.bayviewglen.zork.Entities.Enemies.Enemy;
|
||||||
import com.bayviewglen.zork.Items.Item;
|
import com.bayviewglen.zork.Items.Item;
|
||||||
|
import com.bayviewglen.zork.Items.Shavingcream;
|
||||||
|
|
||||||
public class Combat {
|
public class Combat {
|
||||||
private Entity player;
|
private Player player;
|
||||||
private Enemy enemy;
|
private Enemy enemy;
|
||||||
// if turn is 0 it is player's turn, if 1 it is enemy's turn
|
// if turn is 0 it is player's turn, if 1 it is enemy's turn
|
||||||
private int turn;
|
private int turn;
|
||||||
public Combat(Entity player, Enemy enemy) {
|
public Combat(Player player, Enemy enemy) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.enemy = enemy;
|
this.enemy = enemy;
|
||||||
}
|
}
|
||||||
@@ -25,7 +27,12 @@ public class Combat {
|
|||||||
object = (Item) ctor.newInstance();
|
object = (Item) ctor.newInstance();
|
||||||
|
|
||||||
double rand = Math.random();
|
double rand = Math.random();
|
||||||
if(rand<0.1) {
|
if(object.equals(new Shavingcream())) {
|
||||||
|
System.out.println("You blinded " + enemy.getName());
|
||||||
|
player.removeFromInventory(new Shavingcream());
|
||||||
|
enemy.setBlinded(true);
|
||||||
|
}
|
||||||
|
else if(rand<0.1) {
|
||||||
System.out.println("You missed!");
|
System.out.println("You missed!");
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +58,15 @@ public class Combat {
|
|||||||
|
|
||||||
public double enemyAttack() {
|
public double enemyAttack() {
|
||||||
double rand = Math.random();
|
double rand = Math.random();
|
||||||
if(rand<0.1) {
|
if(enemy.getBlinded()) {
|
||||||
|
if(rand <0.4) {
|
||||||
|
System.out.println(enemy.getName() + " is no longer blinded!");
|
||||||
|
enemy.setBlinded(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
System.out.println(enemy.getName() + " is blinded!");
|
||||||
|
}
|
||||||
|
else if(rand<0.1) {
|
||||||
System.out.println(enemy.getName() + " missed!");
|
System.out.println(enemy.getName() + " missed!");
|
||||||
}else if(rand < 0.15) {
|
}else if(rand < 0.15) {
|
||||||
player.setHealth(player.getHealth()-enemy.getDamage()*1.5);
|
player.setHealth(player.getHealth()-enemy.getDamage()*1.5);
|
||||||
|
|||||||
@@ -7,15 +7,18 @@ public class Enemy extends Entity{
|
|||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private String room;
|
private String room;
|
||||||
|
private boolean blinded;
|
||||||
|
|
||||||
public Enemy(){
|
public Enemy(){
|
||||||
super(100.0, 100.0);
|
super(100.0, 100.0);
|
||||||
damageGiven = 10;
|
damageGiven = 10;
|
||||||
|
blinded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enemy(int damageGiven){
|
public Enemy(int damageGiven){
|
||||||
super(100.0, 100.0);
|
super(100.0, 100.0);
|
||||||
this.damageGiven = damageGiven;
|
this.damageGiven = damageGiven;
|
||||||
|
blinded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
@@ -45,4 +48,10 @@ public class Enemy extends Entity{
|
|||||||
public int getDamage() {
|
public int getDamage() {
|
||||||
return this.damageGiven;
|
return this.damageGiven;
|
||||||
}
|
}
|
||||||
|
public boolean getBlinded() {
|
||||||
|
return blinded;
|
||||||
|
}
|
||||||
|
public void setBlinded(boolean blinded) {
|
||||||
|
this.blinded = blinded;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ class Game {
|
|||||||
if(command.hasItem()) {
|
if(command.hasItem()) {
|
||||||
boolean has = false;
|
boolean has = false;
|
||||||
for(Item i : player.getInventory()) {
|
for(Item i : player.getInventory()) {
|
||||||
if(i.getName().toLowerCase().equals(command.getItem())) {
|
if(i.getName().toLowerCase().replaceAll("\\s+","").equals(command.getItem())) {
|
||||||
has = true;
|
has = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -525,7 +525,7 @@ class Game {
|
|||||||
if(command.hasItem()) {
|
if(command.hasItem()) {
|
||||||
boolean has = false;
|
boolean has = false;
|
||||||
for(Item i : player.getInventory()) {
|
for(Item i : player.getInventory()) {
|
||||||
if(i.getName().toLowerCase().equals(command.getItem())) {
|
if(i.getName().toLowerCase().replaceAll("\\s+","").equals(command.getItem())) {
|
||||||
has = true;
|
has = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.bayviewglen.zork.Items;
|
package com.bayviewglen.zork.Items;
|
||||||
public class ShavingCream extends Item{
|
public class Shavingcream extends Item{
|
||||||
|
|
||||||
public ShavingCream(){
|
public Shavingcream(){
|
||||||
super(16, "Shaving Cream", "A can of shaving cream with foam still around the edge of the nozzle", false, 10, 1);
|
super(16, "Shaving Cream", "A can of shaving cream with foam still around the edge of the nozzle", false, 10, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user