Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaslam11 committed Dec 30, 2015
1 parent 73e3908 commit c3f8895
Show file tree
Hide file tree
Showing 30 changed files with 4,096 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/com/hotmail/kalebmarc/textfighter/item/Chest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.hotmail.kalebmarc.textfighter.item;

import com.hotmail.kalebmarc.textfighter.main.Action;
import com.hotmail.kalebmarc.textfighter.main.Ui;
import com.hotmail.kalebmarc.textfighter.main.Weapon;
import com.hotmail.kalebmarc.textfighter.player.Coins;

public class Chest {
private Chest(){}
public static void view(){

Action.cls();
Ui.println("------------------------------");
Ui.println(" Item Chest ");
Ui.println();
Ui.println("First-Aid kits: " + FirstAid.get());
Ui.println("Insta-Healths: " + InstaHealth.get());
Ui.println("Coins: " + Coins.get());
Ui.println("POWERS: " + Power.get());
for(int i = 0; i < Weapon.arrayWeapon.size(); i++){
Ui.println(Weapon.arrayWeapon.get(i).getName() + ": " + Weapon.arrayWeapon.get(i).owns());
}
Ui.println("Ammo: " + Weapon.getAmmo());
Ui.println("Shotgun ammo: " + Weapon.getSgAmmo());
Ui.println();
Ui.println("------------------------------");
Action.pause();

}
}
79 changes: 79 additions & 0 deletions src/com/hotmail/kalebmarc/textfighter/item/Craft.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.hotmail.kalebmarc.textfighter.item;

import com.hotmail.kalebmarc.textfighter.main.Action;
import com.hotmail.kalebmarc.textfighter.main.Game;
import com.hotmail.kalebmarc.textfighter.main.Ui;
import com.hotmail.kalebmarc.textfighter.main.Weapon;
import com.hotmail.kalebmarc.textfighter.player.Stats;
import com.hotmail.kalebmarc.textfighter.player.Xp;

public class Craft {
private Craft(){}

public static int LEVEL = 0;

public static void menu(){

while(true){


//Makes sure your level x, if not, exits crafting menu
if(Xp.getLevel() < LEVEL){
Action.cls();
Ui.println("You need to be at least level " + LEVEL + " to craft!");
Action.pause();
return;
}

Action.cls();
Ui.println("----------------------------");
Ui.println(" CRAFTING ");
Ui.println();
Ui.println("1) Shotgun ammo (1)");
Ui.println(" - Needs 7 ammo (You have " + Weapon.getAmmo() + " ammo.)");
Ui.println("2) Rifle with knife");
Ui.println(" - Needs rifle and knife");
Ui.println("3) Back");
Ui.println("----------------------------");

switch(Action.getValidInt()){
case 1:
craftShotgunAmmo();
break;
case 2:
craftRifleWithKnife();
break;
case 3:
return;
}
}
}
private static void craftShotgunAmmo(){
Action.cls();
if (Weapon.getAmmo() >= 7){
Weapon.setAmmo(-7, true);
Weapon.setSgAmmo(1, true);
Stats.itemsCrafted++;
Ui.println("You've crafted 1 shotgun bullet using 7 ammo.");
Action.pause();
}else{
Ui.println("You don't have enough ammo to craft this!");
Action.pause();
}
}
private static void craftRifleWithKnife(){
Action.cls();
if (Game.rifle.owns && Game.knife.owns && !Game.rifleWithKnife.owns){
Game.rifle.owns = false;
Game.knife.owns = false;
Game.rifleWithKnife.owns = true;
Weapon.set(Game.rifleWithKnife);
Stats.itemsCrafted++;
Ui.println("You've crafted a rifle with knife using a rifle and a knife.");
Action.pause();
}else{
Ui.println("Cannot craft rifle with knife.");
Action.pause();
}
}
}
87 changes: 87 additions & 0 deletions src/com/hotmail/kalebmarc/textfighter/item/FirstAid.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package com.hotmail.kalebmarc.textfighter.item;

import com.hotmail.kalebmarc.textfighter.main.Action;
import com.hotmail.kalebmarc.textfighter.main.Ui;
import com.hotmail.kalebmarc.textfighter.player.Coins;
import com.hotmail.kalebmarc.textfighter.player.Health;
import com.hotmail.kalebmarc.textfighter.player.Stats;
import com.hotmail.kalebmarc.textfighter.player.Xp;

public class FirstAid {
private FirstAid(){}

private static int firstAid;
public static int used = 0;
public static int price;
public static int level;

public static int get(){
return firstAid;
}
public static void set(int amount, boolean add){

if(!add){
firstAid = amount;
}else{
firstAid += amount;
if (firstAid < 0) firstAid = 0;
}

}
public static void use(){

Action.cls();

if(get() <= 0){

Ui.println("----------------------------------------------------");
Ui.println("You have no First-Aid kits left!");
Ui.println("Go to the shop to buy some more.");
Ui.println("----------------------------------------------------");
Action.pause();

}else if(Health.get() == 100){

Ui.println("----------------------------------------------------");
Ui.println("You already have full health!");
Ui.println("You don't need a First-Aid kit!");
Ui.println("----------------------------------------------------");
Ui.println("Your health: " + Health.getStr());
Ui.println("First-Aid kits: " + get());
Ui.println("----------------------------------------------------");
Action.pause();

}else{

set(-1, true);
Health.gain(20);
used++;

Ui.println("----------------------------------------------------");
Ui.println("You have used a First-Aid kit.");
Ui.println("You've gained 20 health.");
Ui.println("----------------------------------------------------");
Ui.println("Your health: " + Health.getStr());
Ui.println("First-Aid kits: " + get());
Ui.println("----------------------------------------------------");
Action.pause();

}

}
public static void buy(){
if(Xp.getLevel() < level){
Ui.println("You have to be at least level " + level + " to buy this!");
Action.pause();
}else if(price <= Coins.get()){
Coins.set(-price, true);
Stats.coinsSpentOnHealth += price;
set(1, true);
Ui.println("Thank you for your purchase. Come again soon! ");
Action.pause();
}else{
Ui.println("You do not have enough coins.");
Action.pause();
}
}
}
88 changes: 88 additions & 0 deletions src/com/hotmail/kalebmarc/textfighter/item/InstaHealth.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.hotmail.kalebmarc.textfighter.item;

import com.hotmail.kalebmarc.textfighter.main.Action;
import com.hotmail.kalebmarc.textfighter.main.Ui;
import com.hotmail.kalebmarc.textfighter.player.Coins;
import com.hotmail.kalebmarc.textfighter.player.Health;
import com.hotmail.kalebmarc.textfighter.player.Stats;
import com.hotmail.kalebmarc.textfighter.player.Xp;

public class InstaHealth {
private InstaHealth() {}

private static int instaHealth;
public static int used = 0;
public static int price;
public static int level;

public static int get() {
return instaHealth;
}

public static void set(int amount, boolean add) {

if (!add) {
instaHealth = amount;
} else {
instaHealth += amount;
if (instaHealth < 0) instaHealth = 0;
}

}

public static void use() {

Action.cls();

if (get() <= 0) {

Ui.println("----------------------------------------------------");
Ui.println("You have no Insta-Health's left!");
Ui.println("Go to the shop to buy some more.");
Ui.println("----------------------------------------------------");
Action.pause();

} else if (Health.get() == 100) {

Ui.println("----------------------------------------------------");
Ui.println("You already have full health!");
Ui.println("You don't need an Insta-Health!");
Ui.println("----------------------------------------------------");
Ui.println("Your health: " + Health.getStr());
Ui.println("Insta-Health's: " + get());
Ui.println("----------------------------------------------------");
Action.pause();

} else {

set(-1, true);
Health.set(Health.getOutOf());
used++;

Ui.println("----------------------------------------------------");
Ui.println("You have used an Insta-Health.");
Ui.println("You're health has been fully restored.");
Ui.println("----------------------------------------------------");
Ui.println("Your health: " + Health.getStr());
Ui.println("Insta-Health's: " + get());
Ui.println("----------------------------------------------------");
Action.pause();

}
}
public static void buy(){
if(Xp.getLevel() < level){
Ui.println("You have to be at least level " + level + " to buy this!");
Action.pause();
}else if(price <= Coins.get()){
Coins.set(-price, true);
Stats.coinsSpentOnHealth += price;
set(1, true);
Ui.println("Thank you for your purchase. Come again soon! ");
Action.pause();
}else{
Ui.println("You do not have enough coins.");
Action.pause();
}
}
}
74 changes: 74 additions & 0 deletions src/com/hotmail/kalebmarc/textfighter/item/Power.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.hotmail.kalebmarc.textfighter.item;

import com.hotmail.kalebmarc.textfighter.main.Action;
import com.hotmail.kalebmarc.textfighter.main.Enemy;
import com.hotmail.kalebmarc.textfighter.main.Ui;
import com.hotmail.kalebmarc.textfighter.player.Coins;
import com.hotmail.kalebmarc.textfighter.player.Stats;
import com.hotmail.kalebmarc.textfighter.player.Xp;

public class Power {

private static int powers;
public static int used = 0;
public static int price;
public static int level;

public static int get(){
return powers;
}
public static void set(int amount, boolean add){

if(!add){
powers = amount;
}else{
powers += amount;
if (powers < 0) powers = 0;
}

}
public static void use(){

Action.cls();

if(powers <= 0){

Ui.println("----------------------------------------------------");
Ui.println("You have no POWER's left!");
Ui.println("Go to the shop to buy some more.");
Ui.println("----------------------------------------------------");
Action.pause();

}else{

powers--;
used++;
Xp.set(20, true);
Enemy.get().takeDamage(Enemy.get().getHealth());
Ui.println("----------------------------------------------------");
Ui.println("You have used a POWER.");
Ui.println("The enemy has instantly died.");
Ui.println("----------------------------------------------------");
Ui.println("Enemy Health: " + Enemy.get().getHeathStr());
Ui.println("POWER's: " + powers);
Ui.println("----------------------------------------------------");
Action.pause();

}
}
public static void buy(){
if(Xp.getLevel() < level){
Ui.println("You have to be at least level " + level + " to buy this!");
Action.pause();
}else if(price <= Coins.get()){
Coins.set(-price, true);
Stats.coinsSpentOnWeapons += price;
set(1, true);
Ui.println("Thank you for your purchase. Come again soon! ");
Action.pause();
}else{
Ui.println("You do not have enough coins.");
Action.pause();
}
}
}
28 changes: 28 additions & 0 deletions src/com/hotmail/kalebmarc/textfighter/main/About.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.hotmail.kalebmarc.textfighter.main;

import javax.swing.*;

class About {
private About(){}

private static boolean viewed = false;

public static void view(boolean achValid){

//Displays basic information
Ui.popup("Text-Fighter " + Version.getFull() + "\n\n" + Version.getDesc(), "About", JOptionPane.INFORMATION_MESSAGE);

//Displays the Change log (Pops-up after the basic information frame closes)
Ui.popup("Text-Fighter " + Version.getFull() + " Change Log\n\n" + Version.getChange(), "Change Log", JOptionPane.INFORMATION_MESSAGE);

if (achValid) {
viewed = true;
}
}
public static boolean viewed() {
return viewed;
}
public static void setViewed(boolean v){
viewed = v;
}
}
Loading

0 comments on commit c3f8895

Please sign in to comment.