Add files via upload
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,312 @@
|
||||
package Final;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Battle extends Enemies{
|
||||
private List<String> deck = new ArrayList();
|
||||
private List<String> hand = new ArrayList();
|
||||
private List<String> discard = new ArrayList();
|
||||
private List<String> draw = new ArrayList<>();
|
||||
private List<String> selectcard = new ArrayList<>();
|
||||
private Character player = new Character();
|
||||
private String[] enemies;
|
||||
private int[] enemynumbers;
|
||||
private Object[] enemiesinbattle;
|
||||
Enemies first;
|
||||
Enemies second;
|
||||
Enemies third;
|
||||
protected int stage = 1;
|
||||
|
||||
public void GameStart() { //start of run
|
||||
draw = start();
|
||||
}
|
||||
|
||||
public void EnemyDecide() { //called at the start of the encounter
|
||||
enemies = encounters(stage);
|
||||
StartEnemies();
|
||||
for(int i = 0; i < enemies.length; i++) {
|
||||
if(enemies[i] != null) {
|
||||
enemynumbers[i] = SetEnemyHealth(enemies[i]);
|
||||
}
|
||||
}
|
||||
SetEnemyValues(enemies);
|
||||
}
|
||||
|
||||
public void SetEnemyValues(String[] enemies) { //sets all starting enemy values
|
||||
int counter = 0;
|
||||
if(enemies.length == 1) {
|
||||
first = new Enemies();
|
||||
enemiesinbattle[0] = first;
|
||||
first.health = enemynumbers[0];
|
||||
}
|
||||
if(enemies.length == 2) {
|
||||
first = new Enemies();
|
||||
second = new Enemies();
|
||||
enemiesinbattle[0] = first;
|
||||
enemiesinbattle[1] = second;
|
||||
first.health = enemynumbers[0];
|
||||
second.health = enemynumbers[1];
|
||||
}
|
||||
if(enemies.length == 3) {
|
||||
first = new Enemies();
|
||||
second = new Enemies();
|
||||
third = new Enemies();
|
||||
enemiesinbattle[0] = first;
|
||||
enemiesinbattle[1] = second;
|
||||
enemiesinbattle[2] = third;
|
||||
first.health = enemynumbers[0];
|
||||
second.health = enemynumbers[1];
|
||||
third.health = enemynumbers[2];
|
||||
}
|
||||
}
|
||||
|
||||
public void Hand() { //creates a hand at the start of a turn
|
||||
for(int i = 0; i < 6; i++) {
|
||||
if(draw.size() == 0) {
|
||||
Reset();
|
||||
}
|
||||
int randomIndex = (int) (Math.random() * hand.size());
|
||||
hand.add(draw.get( randomIndex ));
|
||||
draw.remove(randomIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(int index) { //called at the end of SinglePlay
|
||||
discard.add(hand.get(index));
|
||||
hand.remove(index);
|
||||
}
|
||||
|
||||
public void RemoveAll(int length) { //activates when end turn button is pressed
|
||||
for(int i = 0; i < length; i++) {
|
||||
discard.add(hand.get(i));
|
||||
hand.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset() { //start of turn if not enough cards in draw
|
||||
draw = discard;
|
||||
discard.clear();
|
||||
}
|
||||
|
||||
public void ResetDeck() { //at the end of battle
|
||||
for(int i = 0; i < hand.size(); i ++) {
|
||||
draw.add(hand.get(i));
|
||||
hand.remove(i);
|
||||
}
|
||||
for(int i = 0; i < discard.size(); i++) {
|
||||
draw.add(discard.get(i));
|
||||
discard.remove(i);
|
||||
}
|
||||
StageIncrease();
|
||||
}
|
||||
|
||||
public boolean TestMana(String name) { //on button press before SinglePlay
|
||||
int[] stats = Values(name);
|
||||
if(player.mana > stats[6]) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SinglePlay(String name, int index, int enemyindex) { //on button press after TestMana
|
||||
int[] stats = Values(name);
|
||||
if(enemyindex == 1) {
|
||||
first.health -= stats[1] - player.strength + first.vulnerable;
|
||||
first.vulnerable += stats[4];
|
||||
first.weak += stats[5];
|
||||
}
|
||||
if(enemyindex == 2) {
|
||||
second.health -= stats[1] - player.strength + second.vulnerable;
|
||||
second.vulnerable += stats[4];
|
||||
second.weak += stats[5];
|
||||
}
|
||||
if(enemyindex == 3) {
|
||||
third.health -= stats[1] - player.strength + third.vulnerable;
|
||||
third.vulnerable += stats[4];
|
||||
third.weak += stats[5];
|
||||
}
|
||||
player.shield += stats[2];
|
||||
player.strength += stats[3];
|
||||
player.mana -= stats[6];
|
||||
/*
|
||||
* guide to the values*
|
||||
* values[1] = damage
|
||||
* values[2] = shield
|
||||
* values[3] = strength
|
||||
* values[4] = vulnerable to enemy
|
||||
* values[5] = weak to enemy
|
||||
* values[6] = mana
|
||||
*/
|
||||
Remove(index);
|
||||
}
|
||||
|
||||
public void EnemyTurn() { //enemies turn after end turn
|
||||
int[] firstvalues = new int[5];
|
||||
int[] secondvalues = new int[5];
|
||||
int[] thirdvalues = new int[5];
|
||||
if(enemies.length == 1) {
|
||||
firstvalues = DamageValues(enemies[0]);
|
||||
player.health -= firstvalues[0] - first.strength + player.vulnerable;
|
||||
first.shield += firstvalues[1];
|
||||
first.strength += firstvalues[2];
|
||||
player.vulnerable += firstvalues[3];
|
||||
player.weak += firstvalues[4];
|
||||
}
|
||||
if(enemies.length == 2) {
|
||||
firstvalues = DamageValues(enemies[0]);
|
||||
secondvalues = DamageValues(enemies[1]);
|
||||
player.health -= firstvalues[0] - first.strength + player.vulnerable;
|
||||
first.shield += firstvalues[1];
|
||||
first.strength += firstvalues[2];
|
||||
player.vulnerable += firstvalues[3];
|
||||
player.weak += firstvalues[4];
|
||||
player.health -= secondvalues[0] - second.strength + player.vulnerable;
|
||||
second.shield += secondvalues[1];
|
||||
second.strength += secondvalues[2];
|
||||
player.vulnerable += secondvalues[3];
|
||||
player.weak += secondvalues[4];
|
||||
}
|
||||
if(enemies.length == 3) {
|
||||
firstvalues = DamageValues(enemies[0]);
|
||||
secondvalues = DamageValues(enemies[1]);
|
||||
thirdvalues = DamageValues(enemies[2]);
|
||||
player.health -= firstvalues[0] - first.strength + player.vulnerable;
|
||||
first.shield += firstvalues[1];
|
||||
first.strength += firstvalues[2];
|
||||
player.vulnerable += firstvalues[3];
|
||||
player.weak += firstvalues[4];
|
||||
player.health -= secondvalues[0] - second.strength + player.vulnerable;
|
||||
second.shield += secondvalues[1];
|
||||
second.strength += secondvalues[2];
|
||||
player.vulnerable += secondvalues[3];
|
||||
player.weak += secondvalues[4];
|
||||
player.health -= thirdvalues[0] - third.strength + player.vulnerable;
|
||||
third.shield += thirdvalues[1];
|
||||
third.strength += thirdvalues[2];
|
||||
player.vulnerable += thirdvalues[3];
|
||||
player.weak += thirdvalues[4];
|
||||
}
|
||||
/*
|
||||
* guide to the values*
|
||||
* enemyvalues[0] = damage
|
||||
* enemyvalues[1] = shield
|
||||
* enemyvalues[2] = strength
|
||||
* enemyvalues[3] = vulnerable
|
||||
* enemyvalues[4] = weak
|
||||
*/
|
||||
}
|
||||
|
||||
public void CardOptions() { //after battle to add to deck
|
||||
String[] options = deckbuild();
|
||||
for(int i = 0; i < 3; i++) {
|
||||
int randomIndex = (int) (Math.random() * options.length);
|
||||
selectcard.add(options[randomIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
public void CardAdd(int index) { //after CardOptions
|
||||
draw.add(selectcard.get(index));
|
||||
}
|
||||
|
||||
public void PlayerEndTurn() {
|
||||
if(player.strength != 0) {
|
||||
player.strength -= 1;
|
||||
}
|
||||
if(player.vulnerable != 0) {
|
||||
player.vulnerable -= 1;
|
||||
}
|
||||
if(player.weak != 0) {
|
||||
player.weak -= 1;
|
||||
}
|
||||
if(enemies.length == 1) {
|
||||
first.shield = 0;
|
||||
}
|
||||
if(enemies.length == 2) {
|
||||
first.shield = 0;
|
||||
second.shield = 0;
|
||||
}
|
||||
if(enemies.length == 3) {
|
||||
first.shield = 0;
|
||||
second.shield = 0;
|
||||
third.shield = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void EnemyEndTurn() {
|
||||
player.shield = 0;
|
||||
if(enemies.length == 1) {
|
||||
if(first.strength != 0) {
|
||||
first.strength -= 1;
|
||||
}
|
||||
if(first.vulnerable != 0) {
|
||||
first.vulnerable -= 1;
|
||||
}
|
||||
if(first.weak != 0) {
|
||||
first.weak -= 1;
|
||||
}
|
||||
}
|
||||
if(enemies.length == 2) {
|
||||
if(first.strength != 0) {
|
||||
first.strength -= 1;
|
||||
}
|
||||
if(first.vulnerable != 0) {
|
||||
first.vulnerable -= 1;
|
||||
}
|
||||
if(first.weak != 0) {
|
||||
first.weak -= 1;
|
||||
}
|
||||
if(second.strength != 0) {
|
||||
second.strength -= 1;
|
||||
}
|
||||
if(second.vulnerable != 0) {
|
||||
second.vulnerable -= 1;
|
||||
}
|
||||
if(second.weak != 0) {
|
||||
second.weak -= 1;
|
||||
}
|
||||
}
|
||||
if(enemies.length == 3) {
|
||||
if(first.strength != 0) {
|
||||
first.strength -= 1;
|
||||
}
|
||||
if(first.vulnerable != 0) {
|
||||
first.vulnerable -= 1;
|
||||
}
|
||||
if(first.weak != 0) {
|
||||
first.weak -= 1;
|
||||
}
|
||||
if(second.strength != 0) {
|
||||
second.strength -= 1;
|
||||
}
|
||||
if(second.vulnerable != 0) {
|
||||
second.vulnerable -= 1;
|
||||
}
|
||||
if(second.weak != 0) {
|
||||
second.weak -= 1;
|
||||
}
|
||||
if(third.strength != 0) {
|
||||
third.strength -= 1;
|
||||
}
|
||||
if(third.vulnerable != 0) {
|
||||
third.vulnerable -= 1;
|
||||
}
|
||||
if(third.weak != 0) {
|
||||
third.weak -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BonfireHeal() {
|
||||
player.health += (player.health / 2);
|
||||
}
|
||||
|
||||
public void Item() {
|
||||
player.health += 6;
|
||||
}
|
||||
|
||||
public void StageIncrease() {
|
||||
stage++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
package Final;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Character {
|
||||
protected int health;
|
||||
protected int shield;
|
||||
protected int strength;
|
||||
protected int vulnerable;
|
||||
protected int weak;
|
||||
protected int mana;
|
||||
protected int damageout;
|
||||
public List<String> cards = new ArrayList();
|
||||
|
||||
public Character() {
|
||||
health = 20;
|
||||
damageout = 0;
|
||||
shield = 0;
|
||||
strength = 0;
|
||||
vulnerable = 0;
|
||||
weak = 0;
|
||||
mana = 6;
|
||||
}
|
||||
|
||||
public void StartCharacter() {
|
||||
values();
|
||||
}
|
||||
|
||||
public String[] deck;
|
||||
public String[] deckbuild() {
|
||||
deck[0] = "Strike";
|
||||
deck[1] = "Defend";
|
||||
deck[2] = "Bash";
|
||||
deck[3] = "Anger";
|
||||
deck[4] = "Body_Slam";
|
||||
deck[5] = "Cleave";
|
||||
deck[6] = "Clothesline";
|
||||
deck[7] = "Iron Wave";
|
||||
deck[8] = "Pommel_Strike";
|
||||
deck[9] = "Thunderclap";
|
||||
deck[10] = "Twin_Strike";
|
||||
deck[11] = "Dropkick";
|
||||
deck[12] = "Hemokinesis";
|
||||
deck[13] = "Searing Blow";
|
||||
deck[14] = "Uppercut";
|
||||
deck[15] = "Bludgeon";
|
||||
deck[16] = "Feed";
|
||||
deck[17] = "Reaper";
|
||||
deck[18] = "Flex";
|
||||
deck[19] = "Shrug_It_Off";
|
||||
deck[20] = "Flame_Barrier";
|
||||
deck[21] = "Seeing_Red";
|
||||
deck[22] = "Sentinel";
|
||||
return deck;
|
||||
}
|
||||
|
||||
private int[] values = new int[6];
|
||||
private void values() {
|
||||
values[0] = 0;
|
||||
values[1] = 0;
|
||||
values[2] = 0;
|
||||
values[3] = 0;
|
||||
values[4] = 0;
|
||||
values[5] = 0;
|
||||
values[6] = 0;
|
||||
/*
|
||||
* guide to the values*
|
||||
* values[0] = card type (attack, skills, power)
|
||||
* values[1] = damage
|
||||
* values[2] = shield
|
||||
* values[3] = strength
|
||||
* values[4] = vulnerable
|
||||
* values[5] = weak
|
||||
* values[6] = mana
|
||||
*/
|
||||
}
|
||||
|
||||
protected List<String> start() {
|
||||
cards.add(deck[0]);
|
||||
cards.add(deck[0]);
|
||||
cards.add(deck[0]);
|
||||
cards.add(deck[0]);
|
||||
cards.add(deck[0]);
|
||||
cards.add(deck[1]);
|
||||
cards.add(deck[1]);
|
||||
cards.add(deck[1]);
|
||||
cards.add(deck[1]);
|
||||
cards.add(deck[2]);
|
||||
return cards;
|
||||
}
|
||||
|
||||
public int[] Values(String name) {
|
||||
if(name == "Strike") {
|
||||
values[0] = 1;
|
||||
values[1] = 6;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Defend") {
|
||||
values[0] = 2;
|
||||
values[2] = 5;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Bash") {
|
||||
values[0] = 1;
|
||||
values[1] = 8;
|
||||
values[4] = 2;
|
||||
values[6] = 2;
|
||||
return values;
|
||||
}
|
||||
if(name == "Anger") {
|
||||
values[0] = 1;
|
||||
values[1] = 6;
|
||||
values[6] = 0;
|
||||
return values;
|
||||
}
|
||||
if(name == "Body_Slam") {
|
||||
values[0] = 1;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Cleave") {
|
||||
values[0] = 1;
|
||||
values[1] = 8;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Clothesline") {
|
||||
values[0] = 1;
|
||||
values[1] = 12;
|
||||
values[5] = 2;
|
||||
values[6] = 2;
|
||||
return values;
|
||||
}
|
||||
if(name == "Iron_Wave") {
|
||||
values[0] = 1;
|
||||
values[1] = 5;
|
||||
values[2] = 5;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Pommel_Strike") {
|
||||
values[0] = 1;
|
||||
values[1] = 9;
|
||||
values[6] = 1;
|
||||
//draw 1 card
|
||||
return values;
|
||||
}
|
||||
if(name == "Thunderclap") {
|
||||
values[0] = 1;
|
||||
values[1] = 4;
|
||||
values[4] = 1;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Twin_Strike") {
|
||||
values[0] = 1;
|
||||
values[1] = 5;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Dropkick") {
|
||||
values[0] = 1;
|
||||
values[1] = 5;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Hemokinesis") {
|
||||
values[0] = 1;
|
||||
values[1] = 14;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Searing_Blow") {
|
||||
values[0] = 1;
|
||||
values[1] = 12;
|
||||
values[6] = 2;
|
||||
return values;
|
||||
}
|
||||
if(name == "Uppercut") {
|
||||
values[0] = 1;
|
||||
values[1] = 13;
|
||||
values[4] = 1;
|
||||
values[5] = 1;
|
||||
values[6] = 2;
|
||||
return values;
|
||||
}
|
||||
if(name == "Bludgeon") {
|
||||
values[0] = 1;
|
||||
values[1] = 32;
|
||||
values[6] = 3;
|
||||
return values;
|
||||
}
|
||||
if(name == "Feed") {
|
||||
values[0] = 1;
|
||||
values[1] = 10;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Reaper") {
|
||||
values[0] = 1;
|
||||
values[1] = 4;
|
||||
values[6] = 2;
|
||||
return values;
|
||||
}
|
||||
/*
|
||||
*
|
||||
* End of attack cards
|
||||
*
|
||||
*/
|
||||
if(name == "Flex") {
|
||||
values[0] = 2;
|
||||
values[3] = 2;
|
||||
values[6] = 0;
|
||||
return values;
|
||||
|
||||
}
|
||||
if(name == "Shrug_It_Off") {
|
||||
values[0] = 2;
|
||||
values[2] = 8;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
if(name == "Flame_Barrier") {
|
||||
values[0] = 2;
|
||||
values[2] = 12;
|
||||
values[6] = 2;
|
||||
return values;
|
||||
}
|
||||
if(name == "Seeing_Red") {
|
||||
values[0] = 2;
|
||||
values[6] = -2;
|
||||
return values;
|
||||
}
|
||||
if(name == "Sentinel") {
|
||||
values[0] = 2;
|
||||
values[2] = 5;
|
||||
values[6] = 1;
|
||||
return values;
|
||||
}
|
||||
/*
|
||||
*
|
||||
* end of skill cards
|
||||
*
|
||||
*/
|
||||
return values;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package Final;
|
||||
|
||||
public class Enemies extends Character{
|
||||
protected int health;
|
||||
protected int damageout;
|
||||
protected int shield;
|
||||
protected int strength;
|
||||
protected int vulnerable;
|
||||
protected int weak;
|
||||
|
||||
public Enemies() {
|
||||
health = 0;
|
||||
damageout = 0;
|
||||
shield = 0;
|
||||
strength = 0;
|
||||
vulnerable = 0;
|
||||
weak = 0;
|
||||
}
|
||||
|
||||
public void StartEnemies() {
|
||||
enemies();
|
||||
SetEnemyValues();
|
||||
}
|
||||
|
||||
private String[] enemylist = new String[9];
|
||||
public String[] enemies() {
|
||||
enemylist[0]= "louse1";
|
||||
enemylist[1]= "louse2";
|
||||
enemylist[2]="acidSlime";
|
||||
enemylist[3]= "thief";
|
||||
enemylist[4]="goblinNob";
|
||||
enemylist[5]="lagavulinSleep";
|
||||
enemylist[6]="lagavulinAwake";
|
||||
enemylist[7]= "slimeBoss" ;
|
||||
enemylist[8]= "slimeBossSplit";
|
||||
return enemylist;
|
||||
}
|
||||
|
||||
public int SetEnemyHealth(String name) {
|
||||
if(name == "lagavulinAwake") {
|
||||
health = 100;
|
||||
}
|
||||
if(name == "lagavulinSleep") {
|
||||
health = 10;
|
||||
}
|
||||
if(name == "goblinNob") {
|
||||
health = 80;
|
||||
}
|
||||
if(name == "acidSlime") {
|
||||
health = 8;
|
||||
}
|
||||
if(name == "louse1" || name == "louse2") {
|
||||
health = 10;
|
||||
}
|
||||
if(name == "slimeBoss") {
|
||||
health = 140;
|
||||
}
|
||||
if(name == "slimeBossSplit") {
|
||||
health = 30;
|
||||
}
|
||||
if(name == "thief") {
|
||||
health = 40;
|
||||
}
|
||||
return health;
|
||||
}
|
||||
|
||||
public int RandomMath(int length, int min) {
|
||||
int attack = 0;
|
||||
do {
|
||||
attack= (int)(Math.random()*length);
|
||||
}while(attack > length || attack <= min);
|
||||
return attack;
|
||||
}
|
||||
|
||||
private int[] enemyvalues;
|
||||
private void SetEnemyValues() {
|
||||
enemyvalues[0] = 0;
|
||||
enemyvalues[1] = 0;
|
||||
enemyvalues[2] = 0;
|
||||
enemyvalues[3] = 0;
|
||||
enemyvalues[4] = 0;
|
||||
/*
|
||||
* guide to the values*
|
||||
* enemyvalues[0] = damage
|
||||
* enemyvalues[1] = shield
|
||||
* enemyvalues[2] = strength
|
||||
* enemyvalues[3] = vulnerable
|
||||
* enemyvalues[4] = weak
|
||||
*/
|
||||
}
|
||||
|
||||
public int[] DamageValues(String name) {
|
||||
int attack = RandomMath(3, 0);
|
||||
if(name == "lagavulinAwake" && attack == 0) {
|
||||
enemyvalues[0] = 18;
|
||||
}
|
||||
if(name == "lagavulinAwake" && (attack == 1 || attack == 2)) {
|
||||
enemyvalues[3] = 2;
|
||||
enemyvalues[4] = 2;
|
||||
}
|
||||
if(name == "lagavulinSleep") {
|
||||
enemyvalues[1] = 10;
|
||||
}
|
||||
if(name == "goblinNob" && attack == 0) {
|
||||
enemyvalues[0] = 14;
|
||||
}
|
||||
if(name == "goblinNob" && attack == 1) {
|
||||
enemyvalues[2] = 2;
|
||||
}
|
||||
if(name == "goblinNob" && attack == 2) {
|
||||
enemyvalues[0] = 6;
|
||||
enemyvalues[3] = 2;
|
||||
}
|
||||
if((name == "acidSlime" || name == "slimeBossSplit") && attack == 0) {
|
||||
enemyvalues[0] = 10;
|
||||
}
|
||||
if((name == "acidSlime" || name == "slimeBossSplit") && attack == 1) {
|
||||
enemyvalues[0] = 7;
|
||||
enemyvalues[4] = 1;
|
||||
}
|
||||
if((name == "acidSlime" || name == "slimeBossSplit") && attack == 2) {
|
||||
enemyvalues[4] = 2;
|
||||
}
|
||||
if((name == "louse1" || name == "louse2") && attack == 0) {
|
||||
enemyvalues[0] = 4;
|
||||
|
||||
}
|
||||
if((name == "louse1" || name == "louse2") && (attack == 1 || attack == 2)) {
|
||||
enemyvalues[2] = 3;
|
||||
}
|
||||
if(name == "slimeBoss" && (attack == 0 || attack == 1)) {
|
||||
enemyvalues[0] = 35;
|
||||
}
|
||||
if(name == "slimeBoss" && attack == 2) {
|
||||
enemyvalues[4] = 2;
|
||||
}
|
||||
if(name == "thief" && attack == 0) {
|
||||
enemyvalues[1] = 6;
|
||||
}
|
||||
if(name == "thief" && attack == 1) {
|
||||
enemyvalues[0] = 12;
|
||||
}
|
||||
if(name == "thief" && attack == 2) {
|
||||
enemyvalues[0] = 10;
|
||||
}
|
||||
return enemyvalues;
|
||||
}
|
||||
|
||||
String[] enemiesselected;
|
||||
public String[] encounters(int stage) {
|
||||
int number = 0;
|
||||
if(stage == 1 || stage == 2 || stage == 5) {
|
||||
number = RandomMath(3, 0);
|
||||
if(number == 0) {
|
||||
enemiesselected[0] = enemylist[0];
|
||||
enemiesselected[1] = enemylist[1];
|
||||
enemiesselected[2] = enemylist[0];
|
||||
}
|
||||
if(number == 1) {
|
||||
enemiesselected[0] = enemylist[2];
|
||||
enemiesselected[1] = enemylist[2];
|
||||
}
|
||||
if(number == 2) {
|
||||
enemiesselected[0] = enemylist[3];
|
||||
enemiesselected[1] = enemylist[3];
|
||||
}
|
||||
}
|
||||
if(stage == 3) {
|
||||
number = RandomMath(2, 0);
|
||||
if(number == 0) {
|
||||
enemiesselected[0] = enemylist[4];
|
||||
}
|
||||
if(number == 1) {
|
||||
enemiesselected[0] = enemylist[5];
|
||||
}
|
||||
if(stage == 6) {
|
||||
enemiesselected[0] = enemylist[7];
|
||||
}
|
||||
}
|
||||
return enemiesselected;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
package Final;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.geometry.VPos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Map extends Application{
|
||||
Stage gameplay = new Stage();
|
||||
Battle background = new Battle();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////// START OF GAME / MAIN MENU //////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void start(Stage game) throws FileNotFoundException {
|
||||
|
||||
gameplay.setWidth(1920); gameplay.setHeight(1080);
|
||||
|
||||
Image splashView = new Image(new FileInputStream("assets/menu/menuSplash.png"));
|
||||
ImageView splash = new ImageView(splashView);
|
||||
|
||||
Image playView = new Image(new FileInputStream("assets/menu/playButton.png"));
|
||||
ImageView play = new ImageView(playView);
|
||||
play.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene map = map();
|
||||
gameplay.setScene(map);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
Image quitView = new Image(new FileInputStream("assets/menu/quitButton.png"));
|
||||
ImageView quit = new ImageView(quitView);
|
||||
quit.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
GridPane mainMenuButtonLayer = new GridPane();
|
||||
mainMenuButtonLayer.setHgap(450);
|
||||
mainMenuButtonLayer.setPadding(new Insets(775, 0, 10, 250));
|
||||
mainMenuButtonLayer.add(play, 1, 0);
|
||||
mainMenuButtonLayer.add(quit, 2, 0);
|
||||
GridPane.setValignment(quit, VPos.BOTTOM);
|
||||
|
||||
StackPane background = new StackPane();
|
||||
background.getChildren().add(splash);
|
||||
background.getChildren().add(mainMenuButtonLayer);
|
||||
|
||||
|
||||
Scene menu = new Scene(background, 1920, 1080);
|
||||
|
||||
gameplay.setScene(menu);
|
||||
gameplay.show();
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////// BONFIRE //////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public Scene bonfire() throws FileNotFoundException{
|
||||
|
||||
Image starsView = new Image(new FileInputStream("assets/scenes/bonfire.png"));
|
||||
ImageView stars = new ImageView(starsView);
|
||||
|
||||
Image yesRestView = new Image(new FileInputStream("assets/scenes/yesRest.png"));
|
||||
ImageView yesRest = new ImageView(yesRestView);
|
||||
|
||||
yesRest.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
background.BonfireHeal();
|
||||
try {
|
||||
Scene map = map();
|
||||
gameplay.setScene(map);
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Image noRestView = new Image(new FileInputStream("assets/scenes/noRest.png"));
|
||||
ImageView noRest = new ImageView(noRestView);
|
||||
|
||||
noRest.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene map = map();
|
||||
gameplay.setScene(map);
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
GridPane RestButtonLayer = new GridPane();
|
||||
RestButtonLayer.setPadding(new Insets(390, 10, 10, 1100));
|
||||
RestButtonLayer.add(yesRest, 1, 1);
|
||||
RestButtonLayer.add(noRest, 2, 1);
|
||||
|
||||
StackPane fireBackground = new StackPane();
|
||||
fireBackground.getChildren().add(stars);
|
||||
fireBackground.getChildren().add(RestButtonLayer);
|
||||
|
||||
|
||||
Scene fire = new Scene(fireBackground, 1920, 1080);
|
||||
return fire;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////// MAP //////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Scene map() throws FileNotFoundException{
|
||||
|
||||
Image paperView = new Image(new FileInputStream("assets/scenes/map.png"));
|
||||
ImageView paper = new ImageView(paperView);
|
||||
|
||||
Image enemyView = new Image(new FileInputStream("assets/scenes/fightIcon.png"));
|
||||
ImageView enemy1 = new ImageView(enemyView);
|
||||
enemy1.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene arena = arena();
|
||||
gameplay.setScene(arena);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ImageView miniboss = new ImageView(enemyView);
|
||||
miniboss.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene arena = arena();
|
||||
gameplay.setScene(arena);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ImageView enemy2 = new ImageView(enemyView);
|
||||
enemy2.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene arena = arena();
|
||||
gameplay.setScene(arena);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ImageView enemy3 = new ImageView(enemyView);
|
||||
enemy3.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene arena = arena();
|
||||
gameplay.setScene(arena);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ImageView boss = new ImageView(enemyView);
|
||||
boss.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene arena = arena();
|
||||
gameplay.setScene(arena);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
boss.setPreserveRatio(true);
|
||||
boss.setFitHeight(250);
|
||||
boss.setFitWidth(250);
|
||||
|
||||
Image bonfireView = new Image(new FileInputStream("assets/scenes/fireIcon.png"));
|
||||
ImageView bonfireIcon = new ImageView(bonfireView);
|
||||
bonfireIcon.setOnMouseClicked(new EventHandler <MouseEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent click) {
|
||||
try {
|
||||
Scene bonfire = bonfire();
|
||||
gameplay.setScene(bonfire);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("IMAGE NOT FOUND");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Image arrowView = new Image(new FileInputStream("assets/scenes/arrowMap.png"));
|
||||
ImageView arrow = new ImageView(arrowView);
|
||||
ImageView arrow1 = new ImageView(arrowView);
|
||||
ImageView arrow2 = new ImageView(arrowView);
|
||||
ImageView arrow3 = new ImageView(arrowView);
|
||||
ImageView arrow4 = new ImageView(arrowView);
|
||||
|
||||
HBox iconLayer = new HBox();
|
||||
iconLayer.getChildren().add(enemy1);
|
||||
iconLayer.getChildren().add(arrow);
|
||||
iconLayer.getChildren().add(enemy2);
|
||||
iconLayer.getChildren().add(arrow1);
|
||||
iconLayer.getChildren().add(miniboss);
|
||||
iconLayer.getChildren().add(arrow2);
|
||||
iconLayer.getChildren().add(bonfireIcon);
|
||||
iconLayer.getChildren().add(arrow3);
|
||||
iconLayer.getChildren().add(enemy3);
|
||||
iconLayer.getChildren().add(arrow4);
|
||||
iconLayer.getChildren().add(boss);
|
||||
iconLayer.setAlignment(Pos.CENTER);
|
||||
|
||||
|
||||
StackPane mapBackground = new StackPane();
|
||||
mapBackground.getChildren().add(paper);
|
||||
mapBackground.getChildren().add(iconLayer);
|
||||
mapBackground.setAlignment(Pos.CENTER);
|
||||
|
||||
|
||||
Scene mapScene = new Scene(mapBackground, 1920, 1080);
|
||||
return mapScene;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////// ARENA /////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public Scene arena() throws FileNotFoundException{
|
||||
|
||||
Image arenaSplashView = new Image(new FileInputStream("assets/scenes/combat.png"));
|
||||
ImageView arenaSplash = new ImageView(arenaSplashView);
|
||||
|
||||
Image ironCladView = new Image(new FileInputStream("assets/characters/ironClad.png"));
|
||||
ImageView ironClad = new ImageView(ironCladView);
|
||||
|
||||
|
||||
|
||||
StackPane arenaBackground = new StackPane();
|
||||
arenaBackground.getChildren().add(arenaSplash);
|
||||
arenaBackground.getChildren().add(ironClad);
|
||||
|
||||
|
||||
Scene arena = new Scene(arenaBackground, 1920, 1080);
|
||||
return arena;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////// MAIN /////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
module LA3ModuleInfo {
|
||||
requires javafx.base;
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
requires javafx.graphics;
|
||||
requires javafx.media;
|
||||
requires javafx.swing;
|
||||
requires javafx.swt;
|
||||
requires javafx.web;
|
||||
exports Final;
|
||||
}
|
||||
Reference in New Issue
Block a user