我需要RPG型库存的帮助......(JAVA)

时间:2016-04-14 09:40:43

标签: java

在你减去投票之前,我甚至无法理解如何做到这一点。

如何创建一个.java或类,您可以将其他类中的文本添加到其中以存储信息MID-EXECUTION?

从技术上讲,我正在努力实现的是基于文本的RPG的库存系统,它可以说,“嘿,你有一把剑!”并且“剑”出现在库存中。你可以输入“INVENTORY”并查看“你有1X剑”。它不能是println因为我需要播放器随时可以访问它。

我在网上搜索过,没有任何结果。 我该如何进一步处理?

以下代码将显示我当前的库存系统,以及需要修复的原因:

    import java.util.Scanner;

    public class Class
    {

    public static void main(String[] args)
    {
        String choice;
        Scanner scan = new Scanner(System.in);
        System.out.println("COPYRIGHT 2016 HARBNGER STUDIOS\nTYPE AN 'option' TO GO TO THAT LOCATION\n\nSTART: You awake in a broken-down alabaster\nhouse with no knowledge of who\nyou are or where you came from. You are hungry and\ncold, and there is no food nor flammable material\nnearby. You decide to go look for some.\nWhich direction do you want to head? (options: NORTH, SOUTH, EAST, WEST)");
        choice = scan.nextLine();{

            if(choice.equals("NORTH")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--                JAN 16, 2644\n\nI FOUND THIS HANDHELD TERMINAL LOG. FIGURED I'D\nPUT IT TO SOME USE.\n\nI TRAVELED NORTH TO A RUN-DOWN VILLAGE. CARCASSES EVERYWHERE.\nNO SURVIVORS. I WONDER WHAT HAPPENED HERE.\nI LOOTED THE BODIES, TALOS BLESS MY SOUL. I FOUND A PISTOL\nAND SOME GAUZE. I CAN VIEW MY INVENTORY, HIT THE ROAD, OR LINGER AROUND.\n\n(options: INVENTORY1,ROAD,LINGER)");
            }   else if(choice.equals("SOUTH")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--                JAN 16, 2644\n\nI FOUND THIS HANDHELD TERMINAL LOG FIGURED I'D\nPUT IT TO SOME USE. TODAY IS, ACCORDING TO THIS, THE 15TH OF JAN, 2644\n\nI TRAVELED SOUTH AND STOPPED AT AN ABANDONED\nOUTPOST. IT HAS SOME SUPPLIES. I PICKED\nUP A PISTOL AND SOME NANITE SYRINGES. I CAN CHECK\nMY INVENTORY, MOVE FARTHER SOUTH, OR EXPLORE.\n\n(options: INVENTORY3,FARTHER,EXPLORE)");
            }   else if(choice.equals("WEST")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--                JAN 16, 2644\n\nI FOUND THIS HANDHELD TERMINAL LOG FIGURED I'D\nPUT IT TO SOME USE. TODAY IS, ACCORDING TO THIS, THE 15TH OF JAN, 2644.\n\nI TRAVELED WEST AND FOUND AN ABANDONED SHACK.\nSHOULD I SEARCH IT FOR LOOT OR MOVE ON?\n\n(options: SEARCH,MOVE)");
            }if(choice.equals("EAST")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--                JAN 16, 2644\n\nI FOUND THIS HANDHELD TERMINAL LOG FIGURED I'D\nPUT IT TO SOME USE. TODAY IS, ACCORDING TO THIS, THE 15TH OF JAN, 2644.\n\nI TRAVELED EAST AND STOPPED BY A DIRTY STREAM.\nIT'S FILLED WITH GARBAGE, BUT THERE ARE ALSO PLASTIC BOTTLES.\nSHOULD I FILL THEM WITH WATER OR MOVE ON?\n\n(options: FILL,MOVE)");}}
            choice = scan.nextLine();

            //North Diologue Options
            if(choice.equals("INVENTORY1")){
            System.out.println("\n\n\n\n--INVENTORY--\n\n1X PISTOL (12/12)\n\n3X GAUZE (HEALS FOR 120)\n\n(options: ROAD,LINGER)");
            }   else if(choice.equals("ROAD")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--\n\nI HOPPED ON THE ROAD. SAW SOME DESTROYED\nSKYSCRAPERS. WONDER WHAT HAPPENED TO THESE PEOPLE.\nI FOUND AN ABANDONED GAS STATION WITH SOME FOOD. IT HAS\nCLEAN WATER AS WELL, SO I MIGHT AS WELL FILL\nUP.\nI NOTICED A TERMINAL IN THE CORNER OF THE\nSHOP. MAYBE IT CAN HELP ME FIND ITEMS,\nLOCATIONS, OR CIVILIZATION.\nSHOULD I CHECK THE TERMINAL OR LEAVE?\n\n(options: TERMINAL,LEAVE)");
            }   else if(choice.equals("LINGER")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--\n\nI STAYED FOR ABOUT 4 HOURS OR SO. GATHERED AN AXE\nAND SOME WOOD.\nJUST HEARD SOME GUNSHOTS. BETTER GET MOVING BEFORE WE\nFIND TROUBLE. I CAN CHECK MY INVENTORY, DITCH THE SCENE, OR\nSTAY, AND HOPE THE GUNNERS ARE FRIENDLY.\n\n(options: INVENTORY2,DITCH,STAY)");
            //South Diologue Options
            }   else if(choice.equals("INVENTORY3")){
            System.out.println("\n\n\n\n--INVENTORY--\n\n1X PISTOL (12/12)\n\n2X NANITE SYRINGE (HEALS FOR 200)\n\n(options: FARTHER,EXPLORE)");
            }   else if(choice.equals("EXPLORE")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--\n\nI WANDERED OFF FROM THE OUTPOST, AND I BELIEVE\nI LOST IT. IT'S A LITTLE PAST FIVE O'CLOCK. THERE ARE SOME\nGUNSHOTS NEARBY, HIDING IN AN ABANDONED SHACK.\n\nTHE SHACK KEEPS ME HIDDEN AS A LARGE ROBOT ROLLED PAST. THE SHACK,\nMEANWHILE, HAS SOME NICE SUPPLIES. HOWEVER, IF I SEARCH\nIT, I MAY NOT BE READY FOR THE NIGHT.\n\n(options: SEARCH,MOVE)");
            }   else if(choice.equals("FARTHER")){
            System.out.println("\n\n\n\n--TERMINAL_LOG--\n\nI WANDERED FURTHER ON DOWN SOUTH. IT GETS A LITTLE COLDER EACH TIME I SEE A DEAD CARCASS. THEY ARE LITERALLY LAYING EVERYWHERE. I'M COMING UP TO A LARGE MOUNTAINOUS AREA. IF I ATTEMPT TO CLIMB IT, I MAY NOT BE PREPARED FOR THE NIGHT. I CAN, HOWEVER, SEARCH FOR A TEMPORARY SHELTER AND MAYBE SOME FOOD AND WATER. WHICH SHOULD I DO?\n\n(options: CLIMB,FORAGE)");}
            choice = scan.nextLine();
    }
}

请注意“Inventory1”和“Inventory3。”

一旦玩家接触到我的方法,如果他们知道库存号码,他们就可以用最好的武器和装甲跳过游戏。

感谢您的帮助。我很感激。

0 个答案:

没有答案