Skip to content
100 changes: 100 additions & 0 deletions Character
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
java.util.Random
java.until.ArrayList
public Class Character {

private int characterLocation;
ArrayList<String> numberList = new ArrayList<String>();

public void fightUser () {
if (chanceOfSurvival() == true){
//character dies, drops a treasure
super.inventory.add(//object)
}
//return to begining of game, you lost the fight
}
// if user does not decide to fight back
}
}

// when a character is at the spot where the knight is
private void knight () {
System.out.println("You have bumped into a knight in shining armor!");
System.out.println("You notice that it seems to be moving on its own a little... but you go to steal its helmet....");
System.out.println("When it grabs your arm! Do you A) talk to it or B) fight?");
if (scanner ans == a){
//you talk to it.. 50% chance it yells for the gaurd... if it does, 10% chance you are arrested on the spot
//if it does yell, you have a 25% chance to hide and succeed, 75% chance to escape and start over, and 10% chance the gaurd doesn't hear you
}
if (scanner ans == b) {
// check inventory
if (inventory.contains("Hammer")) {
if(chanceOfSurvival(2) == true) {
System.out.println("With your hammer, you had a haigher than half chance of winning");
System.out.println("You decide to valiantly battle this knight, hitting this thin sheet of human-shaped metal right where it hurts...");
System.out.println("And you win! Congrats. You can go about your theivery, but don't forget to add your new trophy to your sachel!");
//super.steal.object
}
// if it is false, die
System.out.println("you decided to fight without any weapons...?");
}
if (inventory.contains("Rope")) {
if(chanceOfSurvival(0) == true) {
System.out.println("");
}
System.out.println("you decided to fight without any weapons...?");
}
if (inventory.contains("Sword")) {
if(chanceOfSurvival(3) == true) {
System.out.println("");
}
System.out.println("you decided to fight without any weapons...?");
}
if (inventory.contains("Armor")) {
if(chanceOfSurvival(1) == true) {
System.out.println("");
}
System.out.println("you decided to fight without any weapons...?");
}
//else you try to fistfight
}


}
/*
* the chance of survival based off a non-changing number input
* @param number, the set number that helps determine chances
* @return a boolean t/f that shows survival of the user
*/
private boolean chanceOfSurvival (int number) {
// if input number 3
int randomNumber = rand.nextInt(10)
if (number == 3) {
if (randomNumber <= 9) {
return true;
}
return false;
}
// if input number 2
if (number == 2) {
if (randomNumber <= 7) {
return true;
}
return false;
}
// if inout number 1
if (number == 1) {
if (randomNumber <= 5) {
return true;
}
return false;
}
// if input number 0 very low chance
if (number == 0) {
if (randomNumber <= 1) {
return true;
}
return false;
}
System.out.println("need to input valid number");
}
}
114 changes: 114 additions & 0 deletions Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import java.util.Scanner;

public class Main {
//initializing objects
// objects which are sword, rope, hammer, armor

private static int playerPosx;
private static int playerPosy;

playerPosx = 0;
playerPosy = 0;

String[] objects = {"Sword", "Rope", "Armor", "Hammer"};
static String[][] midievalRoom = {
{"Door", "Blocked", "Blocked", "Blocked"},
{"Empty", "Empty", "Sword", "Blocked"},
{"Trap", "Empty", "Empty", "Blocked"},
{"Blocked", "Character", "Empty", "Door"}
};
// static String[][] jewelryRoom = {
// {"Door", "Blocked", "Blocked", "Blocked"},
// {"Empty", "Hammer", "Empty", "Empty"},
// {"Trap", "Empty", "Empty", "Rope"},
// {"Blocked", "Blocked", "Blocked", "Door"}
// };
// static String[][] paintingRoom = {
// {"Door", "Character", "Blocked", "Trap"},
// {"Empty", "Trap", "Rope", "Trap"},
// {"Empty", "Empty", "Empty", "Sword"},
// {"Hammer", "Empty", "Trap", "Door"}
};
public static void getSpot(int x, int y) {
// Check if coordinates are within the map bounds
String[][] medievalRoom;
if (x >= 0 && x < medievalRoom.length && y >= 0 && y < medievalRoom[0].length) {
Main.checkRoom(medievalRoom[x][y]);
} else {
System.out.println("Coordinates out of bounds.");
}

/*/
how do I get this to pin point the specific coordinates and then
have it read whatever is in the coordinates
*/

public static void playerGo(String direction){
if(direction.contains("forward")){
if(playerPosy++ < 3 ){
playerPosy = playerPosy++;
checkRoom(midievalRoom[playerPosx][playerPosy]);
}
}
if(direction.contains("backward")){
if(playerPosy-- > 0){
playerPosy = playerPosy--;
checkRoom(midievalRoom[playerPosx][playerPosy]);
}
}
if(direction.contains("left")){
if(playerPosx++ < 3){
playerPosx = playerPosx++;
checkRoom(midievalRoom[playerPosx][playerPosy]);
}
}
if(direction.contains("right")){
if(playerPosx-- < 0){
playerPosx = playerPosx--;
checkRoom(midievalRoom[playerPosx][playerPosy]);
}
}
}

public static void checkRoom(String coordinates){
if(String[][].equals("Blocked") == true){
Room.roomBlocked(true);
}
if(String[][].equals("Empty") == true){
Room.roomEmpty(true);
}
if(String[][].equals("Trap") == true){
Room.roomTrap(true);
}
if(String[][].equals("Door") == true){
Room.roomDoor(true);
}
if(String[][].equals("Charcter") == true){
//vharcter class
}
else{
User.

}

}

public static void main(String[] args) {

int x = 1;
int y = 2;
String spot = getSpot(x, y);
System.out.println("Spot at coordinates (" + x + ", " + y + "): " + spot);

Scanner gameScanner = new Scanner(System.in); // Create a Scanner object
System.out.println("Hello! Welcome to Escape the Museum! Where would you like to go?");
System.out.println("HINT: You can use the verb 'go' to move and specify the direction: forward, right, left, backward");

String inpuString = gameScanner.nextLine(); // Read user input
System.out.println(); // Output user input
}
}



}
12 changes: 12 additions & 0 deletions Map.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import java.util.ArrayList;

public class Map {

private ArrayList<ArrayList<ArrayList<String>>> Map;
private int x;
private int y;
private String place;



}
30 changes: 30 additions & 0 deletions Museum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
public class Museum {

private String name;
private int nRooms;

public Museum(String name, int nRooms) {
if (name != null) { this.name = name; }
if (nRooms < 1){
throw new RuntimeException("Cannot construct a building with fewer than 1 floor.");
}
this.nRooms = nRooms;
}
public String getName() {
return this.name;
}

public int getFloors() {
return this.nRooms;
}

public String toString() {
return this.name + " is a " + this.nRooms + " story building.";
}

//check location
public static void main(String[] args) {
Museum fordHall = new Museum("Ford Hall", 4);
System.out.println(fordHall);
}
}
31 changes: 31 additions & 0 deletions Room.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import java.util.ArrayList;

public class Room extends Museum{
private String name;
private ArrayList<Character> characters;
private Map matrix;

public Room(String name, int nFloors, ArrayList<Character> characters, Map matrix) {
super(name, nFloors);
this.name = name;
this.characters = characters;
this.matrix = null;

}
public static String roomBlocked(boolean isBlocked){
return "Sorry, this space is blocked, try moving somewhere else!";
}

public static String roomEmpty(boolean isEmpty){
return "This space is empty, keep going!";
}

public static String roomTrap(boolean isTrap){
// make it so that their coordinates reset back to the front of the room
return "Oh no! It's a trap. You just reset in the game. Back to square one!";
}
public static String roomDoor(boolean isDoor){
// make it so they have an option of what room they wish to enter
return "Looks like you're at a door! What room do you want to enter?";
}
}
99 changes: 99 additions & 0 deletions User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import java.util.ArrayList;

import javax.sound.sampled.SourceDataLine;

// initialize in main for objects and coordinates and anything that will be used across files

public class User {
public String userName;
public String whereAreYou;
ArrayList<String> inventory = new ArrayList<String>();
ArrayList<String> sachel = new ArrayList<String>();

public void take() {
if (//object is there to take//) {
if (//inventory.size() == 0)//) {
inventory.add(//object);
//object must be deleted from coordinates//
}
System.out.println("You already have an object in your inventory... you can only have one!");
}
System.out.println("There is currently nothing to take!");
}

public void steal() {
if (//object is there to take//) {
if (//object is not already in the list) {
if (//object is smth to be stolen) {
sachel.add(//object);
}
System.out.println("You can't steal this object, try taking it!");
}
System.out.println("You already have an object in your inventory... you can only have one!");
}
System.out.println("There is currently nothing to take!");
}

public void drop() {
if (//inventory.size() == 0 //) {
System.out.println("You have successfully dropped" + object + "!");
// object added to new coordinates
}
System.out.println("There is nothing to pick up!");
}

public void inventory() {
System.out.println("You currently have"+ inventory +"in your inventory");
}

/* user can fight any creatures */
public void fight() {
if (//user near creature) {
if (creature == knight) {
if (//inventory != 0) {
if (inventory.contains(sword)) {
System.out.println("You fight");
// 95% chance of winning, else you die
}
if (inventory.contains(rope)) {
System.out.println("You fight");
// 50% chance of winning
}
if (inventory.contains(hammer)) {
System.out.println("You fight");
// 75% chance of winning
}
// else its armor
System.out.println("You fight");
// does not do much for you, 30% chance, all it does is protect you
}
System.out.println("You cannot fight" + creature "you have nothing to fight it with!");
System.out.println("If you want to keep fighting with your bare hands... type FIGHT!");
System.out.println("...but the odds are not in your favor...");
// scanner? make it a 25%
// put position back to starting... die?
}
if (creature == painting) {
// all the painting is, is annoying and loud
if (//inventory != 0) {
if (inventory.contains(sword)) {
System.out.println("You slice up the painting");
}
if (inventory.contains(rope)) {
// you do not win, rope vs a painting = stupid
}
if (inventory.contains(hammer)) {
// brutal... but ok
}
// else its armor
// you also lose bc armor vs painting does nothing

}
}
// if you have nothing to fight the painting with, you can just take it
// off the wall and place it face down on the ground, shutting it up
}
System.out.println("There is nothing to fight here!");
}

}