CommonerQuest: Primitive Text Based JRPG

Show great programs you've built or found here
Post Reply
zaxschwartz@gmail.com
Posts: 9
Joined: Wed Feb 20, 2019 3:52 pm

CommonerQuest: Primitive Text Based JRPG

Post by zaxschwartz@gmail.com » Tue Feb 26, 2019 5:06 pm

One day, I though about the comment of how a D&D Cat can kill a level 1 commoner.
I've never checked or played, but whatever.
I then decided to make basically a random number generator to determine which would win, which eventually evolved into a moderately fledged game.
So...
Here it is.
What I've done:
1) Damage is randomly generated via a simulated dice of varying sides.
2)Multiple foes. Sort of.
3)Classes. Sort of.
4) Player can input name as well as attack choices.
4.5) Certain names have...interesting effects >:D. You can just read it, but try messing around and see what happens. Special names are not case-sensitive because I have the relevant string converted to lower case (but not the names themselves, as they are a separate variable).
I'm planning on 1. adding status effects to the game (which will affect damage dealt/received as a modifier, and fade gradually) and 2. make the game sort of default into a survival mode, where you will perpetually be barraged by a one on one foe fight of various types until you become rich and famous or something. Also a third tier of class changes, but that doesn't matter much until the other two are implemented.
Here's the code:
CommonerQuest V9

Code: Select all

import java.util.Scanner;
public class commonerQuest {
String attackNameNormal;
int dieCount;
int dieSide;
double accuracy;
double critLimit;
//Static Variable
static double foeCON=0.0;
static int foeCONUp=0;
static int winCount;
static int noHeals=0;
static String classType;
static String foeName;
static double foeHealth;
static double foeMaxHealth;
static double playerHealth;
static double playerMaxHealth;
	//Constructors
	public commonerQuest(String attackNameNormal, int dieCount, int dieSide, double accuracy, double critLimit)
	{
		//Normal Attack
		this.attackNameNormal=attackNameNormal;
		this.dieCount=dieCount;
		this.dieSide=dieSide;
		this.accuracy=accuracy;
		this.critLimit=critLimit;
	}
	public commonerQuest()
	{
		//Normal Attack
		this.attackNameNormal="<normal attack name>";
		this.dieCount=0;
		this.dieSide=0;
		this.accuracy=0.0;
		this.critLimit=0.0;
	}
		//setters
	public void setAccuracy(double accuracy)
	{this.accuracy=accuracy;}
	public void setAttackNameNormal(String attackNameNormal)
	{this.attackNameNormal=attackNameNormal;}
	public void setCritLimit(double critLimit)
	{this.critLimit=critLimit;}
	public void setDieSide(int dieSide)
	{this.dieSide=dieSide;}
	public void setDieCount(int dieCount)
	{this.dieCount=dieCount;}
	//getters
	public double getAccuracy()
	{return this.accuracy;}
	public String getAttackNameNormal()
	{return this.attackNameNormal;}
	public double getCritLimit()
	{return this.critLimit;}
	public int getDieSide()
	{return this.dieSide;}
	public int getDieCount()
	{return this.dieCount;}
	public static void main(String[] args){
	System.out.println ("Welcome to COMMONER QUEST!");
	System.out.println ("Please input name.");
	int classChangeLoop=0;
	double randoFoe=(0);
	double gold=(Math.ceil((Math.random()*4)+(Math.random()*4)+(Math.random()*4)));
	double currentGold=(Math.ceil((Math.random()*4))+100);
	System.out.println ("Current cash:"+currentGold);
	double currentRoll=0;
	double totalRoll=0;
	classType=" ";
     //Class stats   	
	//Commoner Stats
	double commonCON=(Math.ceil(Math.random()*19)+1);
	playerHealth=commonCON+10;
	playerMaxHealth=playerHealth;
	System.out.println("Commoner Max Health="+playerHealth);
	System.out.println("");
	classType="Commoner";
	double rogueCON=(Math.random()*29)+1;
	double warriorCON=(Math.random()*19)+1;
    //Foe Stats	
	//Cat stats
	foeCON=Math.ceil((Math.random()*14)+1);
	foeHealth=foeCON+6;
	foeMaxHealth=foeHealth;
	foeName="Cat";
	//Grue Stats
	foeCON=Math.ceil((Math.random()*29)+1);
	//double foeHealth=grueCON+10+Math.ceil((Math.random()*5)+1);
	double grueEvade=2;
	//Constructors
	  //Attack
	//public statusAttack()
	//public healAttack()
	
	
	//Name effects
	Scanner playerNameInput = new Scanner(System.in); 
        String playerName = playerNameInput.nextLine();
        System.out.println ("Welcome "+playerName+"!");
        String playerNameEffect=playerName.toLowerCase();
        if (playerNameEffect.equals("muffin")||playerNameEffect.equals("tiamat")||playerNameEffect.equals("fluff")||playerNameEffect.equals("*fluff*"))
        	{
        	System.out.println ("*fluff*");
        	playerMaxHealth+=5;
        	} 
        if (playerNameEffect.equals("king") || playerNameEffect.equals("dr mcninja") || playerNameEffect.equals("white mage") || playerNameEffect.equals("jester") || playerNameEffect.equals("dr. mcninja") || playerNameEffect.equals("hard mode") )
        	{
        	System.out.println ("YOU WERE WARNED! YOU ARE NOW WEAKER THAN BEFORE.");
        	playerHealth-=5;
        	currentGold-=50;
        	foeCONUp=1;
        	}
        if (playerNameEffect.equals("cuco") || playerNameEffect.equals("almond") || playerNameEffect.equals("cucumber") || playerNameEffect.equals("carrot"))
        	{
        	System.out.println ("Welcome to CucoQuest (tm)");
        	currentGold+=60;
        	foeCONUp=-1;
        	}
        if (playerNameEffect.equals("grue")||playerNameEffect.equals("zork"))
       		{
        	System.out.println ("It is pitch black. You are likely to be eaten by a grue.");
        	playerMaxHealth-=5;
        	}
        if (playerNameEffect.equals("lich")||playerNameEffect.equals("roxas")|playerNameEffect.equals("ada")||playerNameEffect.equals("dregg")||playerNameEffect.equals("amber"))
        	{
        	System.out.println ("And with many strange aeons even death may die.");
        	System.out.println ("Beware the Wolfsbane.");
        	noHeals=-1;
        	playerMaxHealth+=5;
        	}
	//Printing stats
	System.out.println("Commoner Max Health="+playerMaxHealth);
	System.out.println("Cat Max Health="+foeHealth);
	System.out.println("Grue Max Health="+foeHealth);
	System.out.println ("Current cash:"+currentGold);
	System.out.println ("");
	
	//Commoner Attacks Flail 2d6, Punch 1d8, Slap 1d4, Kick 1d12
	double damageBreath=0.0;
	
	//Cat Attacks Claw3d4, Bite 1d6, HB2d4, Slash1d12

	//Scenario Battle 1 (Cat)
	System.out.println ("You are a lowly COMMONER. You have no value at all. You are wandering the streets when HOLYCOWWHATTHEHECK a CAT just jumped at you!");
	System.out.println ("What do you DO?!");
	System.out.println ("Available attacks are: Kick, Slap, Punch, Flail and Breathe. Please do not use spaces or the attack may be invalid.");
	System.out.println ("You may also use the corresponding number keys for offensive attacks and QWERTY for healing ones.");
	//Executes Battle 1
	foeCON=Math.ceil((Math.random()*14)+1);
	CONCheck();
	foeHealth=foeCON+6;
	foeMaxHealth=foeHealth;
	while ((foeHealth>0)&&(playerHealth>0) && winCount<1)
	{
		randoFoe=(Math.ceil((Math.random()*4)));
		System.out.print (">Input attack: ");
		Scanner actionCommon = new Scanner(System.in); 
        	String attackCommon = actionCommon.nextLine(); 
        	attackCommon=attackCommon.toLowerCase( );
        	System.out.println("//"+playerName+"'s Turn\\\\");
		if (attackCommon.equals("kick")||attackCommon.equals("1"))
			{
			commonerQuest kick=new commonerQuest("Kick",1,12,35.0,12.0);
			normalAttackHit(kick);
			}
			
		if (attackCommon.equals("slap") || attackCommon.equals("2"))
			{
			commonerQuest slap=new commonerQuest("Slap",1,4,5.0,4.0);
			normalAttackHit(slap);
			}
		if (attackCommon.equals("punch") || attackCommon.equals("3"))
			{
			commonerQuest punch=new commonerQuest("Punch",1,8,15.0,8.0);
			normalAttackHit(punch);
			}
		if (attackCommon.equals("flail") || attackCommon.equals("4"))
			{
			commonerQuest flail=new commonerQuest("Flail",2,6,42.0,12.0);
			normalAttackHit(flail);
			}	
		if (attackCommon.equals("breath") || attackCommon.equals("breathe") || attackCommon.equals("q"))
			{
			commonerQuest breath=new commonerQuest("Breathe",1,6,6.0,0);
         		healAttackPlayer(breath);
			}	
		if (attackCommon.equals("pet"))
			{
			System.out.println ("Commoner...um...pets the murdercat for some reason. The cat tries to claw the hand off.");
			System.out.println ("You sure that was a good idea? At least the cat took 1 damage.");
			foeHealth--;
			System.out.println ("Cat Health is now "+foeHealth+"/"+foeMaxHealth);
			}
		if (attackCommon.equals("derp") || attackCommon.equals("xyz"))
			{
			System.out.println ("0m3G4 protocol activated. Foe death inbound.");
			foeHealth=0.0;
			}
		System.out.println("\\\\"+foeName+"'s Turn//");
		//Cat Attacks	
		if (randoFoe==1)
			{
			commonerQuest slash=new commonerQuest("Slash",1,12,25.0,11.0);
			foeAttackHit(slash);
			}
		if (randoFoe==2)
			{
			commonerQuest claw=new commonerQuest("Claw",3,4,55.0,12.0);
			foeAttackHit(claw);
			}
		if (randoFoe==3)
			{
			commonerQuest bite=new commonerQuest("Bite",2,3,10.0,6.0);
			foeAttackHit(bite);
			}
		if (randoFoe==4)
			{
			commonerQuest hairball=new commonerQuest("Hairball",2,4,15.0,8.0);
			foeAttackHit(hairball);
			}
		turnSummary();
	}
	if (playerHealth<=0)
		System.out.println ("You lose! Commoner is felled! Cat is victorious! Cat gets 3d4="+gold+" GP!");
	if ((foeHealth<=0)&&(playerHealth>0))
		{
			System.out.println ("You win! Cat is felled! Commoner is victorious! Commoner gets 3d4="+gold+" GP!");
			winCount++;
		}
	if (winCount==1)
	{
		System.out.println ("===");
		System.out.println ("===");
		System.out.println ("Congratulations! You've unlocked a class change!"); 
		System.out.println ("Would you like to be a WARRIOR or a ROGUE?");
		classChangeLoop=1;
        	
	        while (classChangeLoop==1)
		{ 
		Scanner classChange1 = new Scanner(System.in); 
        	String classChange1alpha = classChange1.nextLine();
        	classChange1alpha=classChange1alpha.toLowerCase();
			if (classChange1alpha.equals("warrior") || classChange1alpha.equals("rogue"))
			{
				if (classChange1alpha.equals("warrior"))
					{
					System.out.println ("You are now a WARRIOR! You do not strike as hard as possible, but you can take hits like a walking sheet of metal.");
					System.out.println ("...which you basically are, so that works out pretty well.");
					classType="Warrior";
					classChangeLoop=0;
					}
				if (classChange1alpha.equals("rogue"))
					{
					System.out.println ("You are now a ROGUE! You are not very good at taking blows, but you can backstab your way to victory.");
					System.out.println ("You can sometimes hit so fast that you get in another attack before your foes can react! Be the onslaught!");
					classType="Rogue";
					classChangeLoop=0;
					}
			}
			else
			{
				System.out.println("I'm sorry, I did not get that. You might have typed in a space or mispelled your input.");
				System.out.println ("===");
				System.out.println ("===");
				System.out.println ("Congratulations! You've unlocked a class change!"); 
				System.out.println ("Would you like to be a WARRIOR or a ROGUE?");
			}
		}
	}
	//Battle 2:Grue
	if (winCount==1)
	{
		foeName="Grue";
		if (classType==("Warrior"))
		{
			
			playerMaxHealth=(playerMaxHealth)+warriorCON+15;
		}
		if (classType==("Rogue"))
		{
			
			playerMaxHealth=playerMaxHealth+rogueCON+5;
		}
		playerMaxHealth=Math.ceil(playerMaxHealth);
		healCheck();
		foeCON=Math.ceil((Math.random()*29)+1);
		CONCheck();
		foeHealth=45+foeCON;
		foeMaxHealth=foeHealth;
		System.out.println ("===");
		System.out.println ("===");
		System.out.println ("Alike all, you are twisty in passages of a little maze.");
		System.out.println("You find the early 80's reference suspicious when A GRUE ABRUPLTY ATTACKS! You have no idea what this is! Seriously, there was originally no art.");
		System.out.println("Let's say its a crane. A giant sharp toothed angry crane.");
		while ((foeHealth>0)&&(playerHealth>0) && winCount==1)
		{
        	System.out.println("//"+playerName+"'s Turn\\\\");
        	randoFoe=(Math.ceil(Math.random()*9)+1);
			if (classType=="Rogue")
			{
        		commonerQuest followUp=new commonerQuest("Follow-up",1,4,5.0,4.0);
			System.out.println("Available attacks are: Shiv, Backstab, Hurl, Blitz, Agility and Bandage");
			System.out.println("Bandage and Agility are defensive and as such are QWERTY. All other attacks have hotkeys with the number keys.");
			Scanner actionB2 = new Scanner(System.in);
        		String attackB2 = actionB2.nextLine();
        		attackB2=attackB2.toLowerCase();
        		char attackB2C=attackB2.charAt(0);
        		double followUpCheck=(Math.ceil(Math.random()*5));
			if (attackB2.equals("shiv")||attackB2.equals("1"))
				{
				commonerQuest shiv=new commonerQuest("Shiv",2,4,10.0,8.0);
				normalAttackHit(shiv);
				if (followUpCheck>2)
					{
						normalAttackHit(followUp);
					}
				}
			if (attackB2.equals("backstab")||attackB2.equals("2"))
				{
				commonerQuest backstabA=new commonerQuest("Backstab",1,6,15.0,6.0);
				normalAttackHit(backstabA);
				commonerQuest backstabB=new commonerQuest("Follow-up",1,4,30.0,4.0);
				normalAttackHit(backstabB);
				if (followUpCheck>3)
					{
						normalAttackHit(followUp);
					}
				}
				if (attackB2.equals("hurl")||attackB2.equals("3"))
				{
				commonerQuest hurl=new commonerQuest("Hurl",1,8,5.0,8.0);
				normalAttackHit(hurl);
				}
				if (attackB2.equals("blitz")||attackB2.equals("4"))
				{
				commonerQuest blitz=new commonerQuest("Blitz",4,4,50.0,14.0);
				normalAttackHit(blitz);
					if (followUpCheck>3)
					{
						normalAttackHit(followUp);
						while (followUpCheck>4)
						{
						followUpCheck=(Math.ceil(Math.random()*4)+1);
						normalAttackHit(followUp);
						}
					
					}
				if (attackB2.equals("bandage") || attackB2.equals("q"))
				{
				commonerQuest bandage=new commonerQuest("bandage",1,12,11.0,0);
				healAttackPlayer(bandage);
					if (followUpCheck>3)
					{
						normalAttackHit(followUp);
					}
				}
				}
			}
			if (classType=="Warrior")
			{
				System.out.println("Available attacks are: Smash, Bash, Flurry, Rend, Block and Bandage");
				System.out.println("Block and Bandage are defensive and as such are QWERTY. All other attacks have hotkeys with the number keys.");
				Scanner actionB2 = new Scanner(System.in);
        			String attackB2 = actionB2.nextLine();
        			attackB2=attackB2.toLowerCase( );
				if (attackB2.equals("smash")||attackB2.equals("1"))
				{
				commonerQuest smash=new commonerQuest("Smash",1,6,1.0,6.0);
				normalAttackHit(smash);
				}
				if (attackB2.equals("bash")||attackB2.equals("2"))
				{
				commonerQuest bash=new commonerQuest("Bash",2,4,15.0,7.0);
				normalAttackHit(bash);
				}
				if (attackB2.equals("flurry")||attackB2.equals("3"))
				{
				commonerQuest flurryA=new commonerQuest("Flurry",2,4,40.0,16.0);
				normalAttackHit(flurryA);
				System.out.println("Warrior rests for a moment");
				commonerQuest flurryB=new commonerQuest("Finisher!!",1,8,15.0,16.0);
				normalAttackHit(flurryB);
				}
				if (attackB2.equals("rend")||attackB2.equals("4"))
				{
				commonerQuest rend=new commonerQuest("Rend",1,20,20.0,6.0);
				normalAttackHit(rend);
				}
				if (attackB2.equals("bandage") || attackB2.equals("q"))
				{
				commonerQuest bandage=new commonerQuest("bandage",3,4,10.0,0);
				healAttackPlayer(bandage);
				}
			}
			commonerQuest combo=new commonerQuest("its speed for a Combo Attack!",1,4,35.0,4.0);
			double comboCheck=(Math.ceil(Math.random()*19)+1);
			if (randoFoe==1||randoFoe==2)
			{
				commonerQuest gnaw=new commonerQuest("Gnaw",2,4,10.0,8.0);
				foeAttackHit(gnaw);
				if (comboCheck>18)
				{
					foeAttackHit(combo);
				}
			}
			if (randoFoe==3||randoFoe==4)
			{
				commonerQuest ravage=new commonerQuest("Ravage",3,4,15.0,10.0);
				foeAttackHit(ravage);
				if (comboCheck>15)
				{
					foeAttackHit(combo);
				}
			}
			if (randoFoe==5)
			{
				commonerQuest grind=new commonerQuest("Grind",1,20,25.0,20.0);
				foeAttackHit(grind);
				if (comboCheck>18)
				{
					foeAttackHit(combo);
				}
			}
			if (randoFoe==7||randoFoe==8)
			{
				commonerQuest swiftBlow=new commonerQuest("Swift Blow",1,8,5.0,3.0);
				foeAttackHit(swiftBlow);
				if (comboCheck>13)
				{
					foeAttackHit(combo);
					comboCheck=(Math.ceil(Math.random()*19)+1);
					if (comboCheck>16)
					{
						foeAttackHit(combo);
					}
				}
			}
			if (randoFoe==9||randoFoe==10)
			{
				commonerQuest gobble=new commonerQuest("Gobble",1,6,15.0,8.0);
				foeAttackHit(gobble);
				commonerQuest gobbleHeal=new commonerQuest("a darn self healing skill",1,4,4.0,4.0);
				healAttackFoe(gobbleHeal);
			}
			if (randoFoe==6)
			{
				commonerQuest heal=new commonerQuest("Heal",2,6,4.0,8.0);
				healAttackFoe(heal);
				if (comboCheck>18)
				{
					foeAttackHit(combo);
				}
			}
		turnSummary();
		}
	if (playerHealth<=0)
	{
		System.out.println ("You lose! "+classType+" is felled! Grue is victorious! Grue gets 3d4="+gold+" GP!");
	}
	if ((foeHealth<=0)&&(playerHealth>0))
		{
			System.out.println ("You win! Grue is felled! "+classType+" is victorious! "+classType+" gets 3d4="+gold+" GP!");
			winCount++;
		}
	}
        
	}
	public static void healAttackPlayer(commonerQuest aspectHeal)
	{
		int dieSide=aspectHeal.getDieSide();
		String attackNameNormal=aspectHeal.getAttackNameNormal();
		int dieCount=aspectHeal.getDieCount();
		double critLimit=aspectHeal.getCritLimit();
		double currentRoll=0;
		double totalRoll=0;
		for (int i=0; i<dieCount; i++)
			{
				currentRoll=(Math.random()*(dieSide-1))+1;
				currentRoll=Math.ceil(currentRoll);
				totalRoll=totalRoll+=currentRoll;
				System.out.println ("Roll "+(i+1)+":"+currentRoll);
			}
		if (totalRoll>=critLimit)
			{
					totalRoll+=(totalRoll/4);
					totalRoll=(Math.floor(totalRoll));
			}
        	 playerHealth=playerHealth+=totalRoll;
        	 if (playerHealth>playerMaxHealth)
        	 {
        	 	playerHealth=playerMaxHealth;
        	 }
		System.out.print (classType+" uses "+attackNameNormal+"! ");
		System.out.println(classType+" Health is now "+playerHealth+" out of "+playerMaxHealth+".");
	}
	public static void normalAttackHit(commonerQuest aspectNormal)
	{
		int dieSide=aspectNormal.getDieSide();
		String attackNameNormal=aspectNormal.getAttackNameNormal();
		int dieCount=aspectNormal.getDieCount();
		double accuracy=aspectNormal.getAccuracy();
		double critLimit=aspectNormal.getCritLimit();
		double currentRoll=0;
		double totalRoll=0;
		double hitCheck=0.0;
		int missCount=0;
		for (int i=0; i<dieCount; i++)
			{
				currentRoll=(Math.random()*(dieSide-1))+1;
				currentRoll=Math.ceil(currentRoll);
				hitCheck=(Math.ceil(Math.random()*99)+1);
				if (accuracy<hitCheck)
				{
					totalRoll=totalRoll+=currentRoll;
					System.out.println ("Roll "+(i+1)+":"+currentRoll);
				}
				else
				{
					System.out.println("...the blow missed the foe");
					missCount++;
				}
			}
		if (totalRoll>=critLimit)
			{
					totalRoll+=(totalRoll/4);
					totalRoll=(Math.floor(totalRoll));
			}
		System.out.print (classType+" uses "+attackNameNormal+"! ");
		if (missCount<dieCount)
			{
			System.out.println (dieCount+"d"+dieSide+"="+totalRoll+". "+foeName+" takes "+totalRoll+" damage.");
			foeHealth=foeHealth-=totalRoll;
			}
		else
			{
			System.out.println("...But it missed completely!");
			}
		System.out.println(foeName+" Health is now "+foeHealth+" out of "+foeMaxHealth+".");
	}
	public static void foeAttackHit(commonerQuest aspectNormalFoe)
	{
		int dieSide=aspectNormalFoe.getDieSide();
		String attackNameNormalFoe=aspectNormalFoe.getAttackNameNormal();
		int dieCount=aspectNormalFoe.getDieCount();
		double accuracy=aspectNormalFoe.getAccuracy();
		double critLimit=aspectNormalFoe.getCritLimit();
		double currentRoll=0;
		double totalRoll=0;
		double hitCheck=0.0;
		int missCount=0;
		for (int i=0; i<dieCount; i++)
			{
				currentRoll=(Math.random()*(dieSide-1))+1;
				currentRoll=Math.ceil(currentRoll);
				hitCheck=(Math.ceil(Math.random()*99)+1);
				if (accuracy<hitCheck)
				{
					totalRoll=totalRoll+=currentRoll;
					System.out.println ("Roll "+(i+1)+":"+currentRoll);
				}
				else
				{
					System.out.println("...the blow missed you.");
					missCount++;
				}
			}
		if (totalRoll>=critLimit)
			{
					totalRoll+=(totalRoll/4);
					totalRoll=(Math.floor(totalRoll));
			}
		System.out.print (foeName+" uses "+attackNameNormalFoe+"! ");
		if (missCount<dieCount)
			{
			System.out.println (dieCount+"d"+dieSide+"="+totalRoll+". "+classType+" takes "+totalRoll+" damage.");
			playerHealth=playerHealth-=totalRoll;
			}
		else
			{
			System.out.println("...But it missed completely!");
			}
		System.out.println(classType+" Health is now "+playerHealth+" out of "+playerMaxHealth+".");
	}
	public static void healAttackFoe(commonerQuest aspectHeal)
	{
		int dieSide=aspectHeal.getDieSide();
		String attackNameNormal=aspectHeal.getAttackNameNormal();
		int dieCount=aspectHeal.getDieCount();
		double critLimit=aspectHeal.getCritLimit();
		double currentRoll=0;
		double totalRoll=0;
		for (int i=0; i<dieCount; i++)
			{
				currentRoll=(Math.random()*(dieSide-1))+1;
				currentRoll=Math.ceil(currentRoll);
				totalRoll=totalRoll+=currentRoll;
				System.out.println ("Roll "+(i+1)+":"+currentRoll);
			}
		if (totalRoll>=critLimit)
			{
					totalRoll+=(totalRoll/4);
					totalRoll=(Math.floor(totalRoll));
			}
        	 foeHealth=foeHealth+=totalRoll;
        	 if(foeHealth>foeMaxHealth)
        	 {
        	 	foeHealth=foeMaxHealth;
        	 }
		System.out.print (foeName+" uses "+attackNameNormal+"! ");
		System.out.println(foeName+" Health is now "+foeHealth+" out of "+foeMaxHealth+".");
	}
	public static void healCheck()
	{
	if (noHeals==1)
		{
			System.out.println("You rest at a roadside TAVERN before continuing on your way. Your HEALTH has been fully restored!");
			playerHealth=playerMaxHealth;
			System.out.println(classType+" Health is "+playerHealth+" out of "+playerMaxHealth);
			
		}
	if (noHeals==0)
		{
			System.out.println("You rest at a musty roadside TAVERN before continuing on your way. Your HEALTH has been restored!");
			if (playerHealth<playerMaxHealth-5);
			{
				playerHealth=playerMaxHealth-5;
			}
			System.out.println(classType+" Health is "+playerHealth+" out of "+playerMaxHealth);
		}
	if (noHeals==-1)
		{
		System.out.println("You rest at a pit full of sharp rocks and smelly moss before moving on. You get no sleep at all.");
		System.out.println("Also, the tavern blew up last night. Again. Frigging fantasy settings.");
		playerHealth=Math.ceil(playerMaxHealth/3.5)+playerHealth;
		}
	}
	public static void turnSummary()
	{
		System.out.println ("|| "+classType+" Health is "+playerHealth+" out of "+playerMaxHealth+"||");
		System.out.println ("|| "+foeName+" Health is "+foeHealth+" out of "+foeMaxHealth+"     //");
	}
	public static void CONCheck()
	{
		foeCON=foeCON+(foeCONUp*5);
	}
}
Remember: With great power comes great current squared times resistance.
-Randall Munroe

jpconver
Site Admin
Posts: 10
Joined: Fri Dec 01, 2017 2:09 pm

Re: CommonerQuest: Primitive Text Based JRPG

Post by jpconver » Wed Feb 27, 2019 4:26 pm

Great program! You should publish it using the publish function. Here is a video: https://youtu.be/DeZgd3EjG00
Also extend the run time of your program usign right click on the project and then project properties so your program is not killed too soon :D

Post Reply