Exemplo n.º 1
0
	@Override
	public void LoadContent() {
		super.LoadContent();
		super.bgTexture = Global.Load("SkillScreen");
		t2DButtonBack = Global.Load("ButtonCancel");
		t2DButtonPlay = Global.Load("ButtonConfirm");
		t2DTagReload = Global.Load("SkillFastReload");
		t2DTagAAGun = Global.Load("SkillAAGunner");
		t2DExtendedMag = Global.Load("SkillExtMag");
		t2DTagAim = Global.Load("SkillSniper");
		t2DTagOverRepair = Global.Load("SkillOverRepair");
		t2DTagFieldRepair = Global.Load("SkillFieldRepair");
		t2DTagLearning = Global.Load("SkillLearner");
		t2DTagGunner = Global.Load("SkillLeader");
		t2DTagArtillery = Global.Load("SkillArtillery");
		t2DTagBoost = Global.Load("SkillBoost");
		t2DSkillDetail = Global.Load("SkillDetailBox");
		t2DPreReqNotMet = Global.Load("PreReqNotMet");
		t2DBattleEngineer = Global.Load("BattleEngineer");
		t2DRifleman = Global.Load("Rifleman");
		maskSkill = Global.Load("MaskSkill");
		tagAAGun = new TagAAGun(t2DTagAAGun, new Vector2f(440f, 420f), 0f,
				Help.ButtonID.TagAAGun, 0);
		tagAim = new TagAim(t2DTagAim, new Vector2f(460f, 240f), 0f,
				Help.ButtonID.TagAim, 0);
		tagLearning = new TagLearning(t2DTagLearning, new Vector2f(327f, 367f),
				0f, Help.ButtonID.TagLearning, 0);
		tagGunner = new TagGunner(t2DTagGunner, new Vector2f(655f, 367f), 0f,
				Help.ButtonID.TagGunner, 0);
		tagOverRepair = new TagOverRepair(t2DTagOverRepair, new Vector2f(327f,
				196f), 0f, Help.ButtonID.TagOverRepair, 0);
		tagFieldRepair = new TagFieldRepair(t2DTagFieldRepair, new Vector2f(
				655f, 196f), 0f, Help.ButtonID.TagFieldRepair, 0);
		tagReloading = new TagReloading(t2DTagReload, new Vector2f(327f, 196f),
				0f, Help.ButtonID.TagReloading, 0);
		tagExtendedMag = new TagExtendedMag(t2DExtendedMag, new Vector2f(655f,
				196f), 0f, Help.ButtonID.TagExtendedMag, 0);
		tagArtillery = new TagArtillerySupport(t2DTagArtillery,
				this.pTagArtillery, 0f, Help.ButtonID.TagArtillery, 0);
		tagBoost = new TagBoost(t2DTagBoost, this.pTagBoost, 0f,
				Help.ButtonID.TagBoost, 0);
		super.buttonList.add(new Button(t2DButtonBack, new Vector2f(60f, 430f),
				0f, Help.ButtonID.Back, 20));
		this.buttonCancel = new Button(t2DButtonBack, new Vector2f(260f, 330f),
				0f, Help.ButtonID.No, 0);
		this.buttonConfirm = new Button(t2DButtonPlay,
				new Vector2f(530f, 330f), 0f, Help.ButtonID.Yes, 0);
		super.screenPause.LoadContent();
	}
Exemplo n.º 2
0
	@Override
	public void Update(GameTime gameTime) {
		super.Update(gameTime);
		if (!isInitialised) {
			this.Initialised();
		}
		if (this.iScreen == 0) {
			for (Button button : super.buttonList) {
				button.CheckPrerequisite(Help.currentBunker);
			}
		}
		this.iScreen++;
		if (this.tagSelected == null) {
			if (super.isTranAnimFinished) {
				if (super.buttonClicked.getButtonID() == Help.ButtonID.Back) {
					Help.currentGameState = Help.previousGameState;
					super.buttonClicked = null;
					this.iScreen = 0;
				} else if ((super.buttonClicked != this.buttonConfirm)
						&& (super.buttonClicked != this.buttonCancel)) {
					this.tagSelected = super.buttonClicked;
					super.buttonClicked.isEffectTaken = true;
					if (super.buttonClicked.isPrerequisiteMet
							&& (Help.AvailSkillPoint > 0)) {
						super.buttonList.add(this.buttonCancel);
						super.buttonList.add(this.buttonConfirm);
						this.isDetailShowing = true;
					} else {
						super.buttonList.add(this.buttonCancel);
						this.isDetailShowing = false;
					}
				}
				super.isTranAnimFinished = false;
			}
			if (super.mousePositionList.size() > 0) {
				super.mousePositionList.clear();
			}
			return;
		}
		if (!super.isTranAnimFinished) {
			if (super.mousePositionList.size() > 0) {
				super.mousePositionList.clear();
			}
			return;
		}
		switch (super.buttonClicked.getButtonID()) {
		case Yes:
			if (super.buttonClicked.isEffectTaken) {

				super.isTranAnimFinished = false;

				if (super.mousePositionList.size() > 0) {
					super.mousePositionList.clear();
				}
				return;
			}
			this.tagSelected.ApplyEffect(Help.currentBunker);
			Help.currentBunker.skillsGained.add(this.tagSelected);
			if (this.tagSelected.description.equalsIgnoreCase("AA Gun")) {
				Help.numSkill1++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Improve Accuracy")) {
				Help.numSkill2++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Learning")) {
				Help.numSkill3++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Free Gunner")) {
				Help.numSkill4++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Over Repair")) {
				Help.numSkill5++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Field Repair")) {
				Help.numSkill6++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Faster Reloading")) {
				Help.numSkill7++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Extended Magazine")) {
				Help.numSkill8++;
			} else if (this.tagSelected.description
					.equalsIgnoreCase("Artillery Support")) {
				Help.numSkill9++;
			} else if (this.tagSelected.description.equalsIgnoreCase("Boost")) {
				Help.numSkill10++;
			}
			break;

		case No:
			if (!super.buttonClicked.isEffectTaken) {
				this.isDetailShowing = false;
				super.buttonList.remove(this.buttonCancel);
				if (super.buttonList.contains(this.buttonConfirm)) {
					super.buttonList.remove(this.buttonConfirm);
				}
				this.tagSelected = null;
				super.buttonClicked.isEffectTaken = true;
			}
			super.isTranAnimFinished = false;

			if (super.mousePositionList.size() > 0) {
				super.mousePositionList.clear();
			}
			return;

		default:
			super.isTranAnimFinished = false;

			if (super.mousePositionList.size() > 0) {
				super.mousePositionList.clear();
			}
			return;
		}
		Help.AvailSkillPoint--;
		this.isDetailShowing = false;
		buttonList.subList(buttonList.size() - 2, buttonList.size()).clear();
		this.tagSelected = null;
		super.buttonClicked.isEffectTaken = true;
		for (Button button2 : super.buttonList) {
			button2.CheckPrerequisite(Help.currentBunker);
		}

	}
Exemplo n.º 3
0
  // this is the actual game thread start
  // it loops for each complete game played
  public void run() {
    while (true) {

      Screen ss = new Screen(this);
      ss.setBackground(new Color(0, 0, 0));
      ss.setLayout(new BorderLayout());
      {
        TitleScreen ts = new TitleScreen(this);
        ts.setBackground(new Color(0, 0, 0));
        ss.add("Center", ts);
      }
      MessagePanel mp = new MessagePanel(this);
      Game.messagepanel = mp;
      ss.add("South", mp);

      switchScreen(ss);

      repaint();

      if (!isapplet && gameFileFromCommandLine != null) {
        Game.message("Loading " + gameFileFromCommandLine + " game file...");
        final String ret = Game.tryToRestore(gameFileFromCommandLine);
        if (ret == null) {
          setupScreen();
          getScreen().mainLoop();
          continue;
        }

        Game.message("Load game failed: " + ret);
        Game.message("Press any key (except Tab) to continue");
        Game.getInput(false); // !!! not very good - this does not
        // recognize Tab key, for instance

      }

      Game.message("");
      Game.message(
          "Welcome to Tyrant. You are playing version " + Game.VERSION + ". Would you like to:");
      Game.message(" [a] Create a new character");
      Game.message(" [b] Load a previously saved game");
      Game.message(" [c] Play in debug mode");
      Game.message(" [d] QuickStart debug mode");
      Game.message(" [e] Edit a map");
      mp.repaint();

      // create lib in background
      Game.asynchronousCreateLib();

      char c = Game.getOption("abcdeQ");

      Game.setDebug(false);
      Game.visuals = true;

      if (c == 'b') {
        if (Game.restore()) {
          setupScreen();
          getScreen().mainLoop();
        }

      } else if (c == 'c') {
        // do hero creation
        Game.create();
        Thing h = createHero(true);
        if (h == null) continue;

        Game.setDebug(true);
        setupScreen();
        gameStart();

      } else if (c == 'e') {
        // Designer
        Game.message("");
        Game.message("Launching Designer...");
        mikera.tyrant.author.Designer.main(new String[] {"embedded"});
        continue;

      } else {

        Game.create();
        Thing h = createHero(true);

        if (h == null) continue;

        // first display starting info....
        InfoScreen l =
            new InfoScreen(
                this,
                "                                 Introduction\n"
                    + "\n"
                    + "Times are hard for the humble adventurer. Lawlessness has ravaged the land, and few can afford to pay for your services.\n"
                    + "\n"
                    + "After many weeks of travel, you find yourself in the valley of North Karrain. This region has suffered less badly from the incursions of evil, and you hear that some small towns are still prosperous. Perhaps here you can find a way to make your fortune.\n"
                    + "\n"
                    + "After a long day of travel, you see a small inn to the west. Perhaps this would be a good place to meet some and learn some more about these strange lands.\n"
                    + "\n"
                    + "                           [ Press a key to continue ]\n"
                    + "\n"
                    + "\n"
                    + "\n"
                    + "\n"
                    + "\n");

        l.setForeground(new Color(192, 160, 64));
        l.setBackground(new Color(0, 0, 0));
        switchScreen(l);
        Game.getInput();
        setupScreen();
        gameStart();

        // Debug mode should not start when pressing Enter!!
        // Game.create();
        // Game.setDebug(true);
        // createHero(false);
        // setupScreen();
        // gameStart();
      }
    }
  }
Exemplo n.º 4
0
	public final void Initialised() {
		switch (Help.profession) {
		case Rifleman:
			super.buttonList.add(tagAAGun);
			super.buttonList.add(tagAim);
			super.buttonList.add(tagLearning);
			super.buttonList.add(tagGunner);
			super.buttonList.add(tagReloading);
			super.buttonList.add(tagExtendedMag);
			break;

		case BattleEngineer:
			super.buttonList.add(tagAAGun);
			super.buttonList.add(tagAim);
			super.buttonList.add(tagLearning);
			super.buttonList.add(tagGunner);
			super.buttonList.add(tagOverRepair);
			super.buttonList.add(tagFieldRepair);
			break;

		case Commander:
			super.buttonList.add(tagAAGun);
			super.buttonList.add(tagAim);
			super.buttonList.add(tagLearning);
			super.buttonList.add(tagGunner);
			super.buttonList.add(tagArtillery);
			super.buttonList.add(tagBoost);
			break;
		default:
			break;
		}
		isInitialised = true;
	}
Exemplo n.º 5
0
  // creates a hero according to specified parameters
  public Thing createHero(boolean prompts) {
    long start = System.currentTimeMillis();
    String race = null;
    String profession = null;

    if (!prompts) {
      race = "human";
      profession = "fighter";
      Game.setDebug(true);
    }

    // get list of races
    String[] raceherostrings = Hero.heroRaces();
    String[] racedescriptions = Hero.heroRaceDescriptions();
    if (race == null) {
      DetailedListScreen ls =
          new DetailedListScreen("What race are you?", raceherostrings, racedescriptions);
      ls.setForeground(new Color(128, 128, 128));
      ls.setBackground(new Color(0, 0, 0));
      ls.bottomString = "Press a letter key to select your race";
      switchScreen(ls);
      while (true) {
        race = (String) ls.getObject();
        // Game.warn(race);
        if ((race != null) || Game.isDebug()) break;
      }
    }

    if (race == null) {
      // Debug mode only
      // have escaped, so choose randomly
      race = raceherostrings[Rand.r(raceherostrings.length)];
      String[] herostrings = Hero.heroProfessions(race);
      profession = herostrings[Rand.r(herostrings.length)];
    }

    // get list of possible prfessions
    String[] professionstrings = Hero.heroProfessions(race);
    String[] professiondescriptions = Hero.heroProfessionDescriptions(race);
    if (profession == null) {

      DetailedListScreen ls =
          new DetailedListScreen(
              "What is your profession?", professionstrings, professiondescriptions);
      ls.bottomString = "Press a letter key to select your profession";
      ls.setForeground(new Color(128, 128, 128));
      ls.setBackground(new Color(0, 0, 0));
      switchScreen(ls);

      while (profession == null) {
        profession = (String) ls.getObject();
      }
    }

    Thing h = Hero.createHero(prompts ? null : "QuickTester", race, profession);

    // hero name and history display
    String name = "QuickTester";
    if (prompts) {
      // setup screen to get name
      Screen ss = new Screen(this);
      ss.setBackground(new Color(0, 0, 0));
      ss.setLayout(new BorderLayout());
      {
        InfoScreen ts = new InfoScreen(this, h.getString("HeroHistory"));
        ts.setBackground(new Color(0, 0, 0));
        ss.add("Center", ts);
      }
      MessagePanel mp = new MessagePanel(this);
      Game.messagepanel = mp;
      ss.add("South", mp);

      switchScreen(ss);

      name = getHeroName(true);
      if (name == null) return null;
    }
    Hero.setHeroName(h, name);

    System.out.println((System.currentTimeMillis() - start) + "ms to createHero");
    return h;
  }