Debug adding stat from race
adding weapons
This commit is contained in:
parent
cf1a8e9cc3
commit
fa90d6fc67
BIN
out/production/Java_Petit_projet/events/StartEvent.class
Normal file
BIN
out/production/Java_Petit_projet/events/StartEvent.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/Java_Petit_projet/items/weapons/Fist.class
Normal file
BIN
out/production/Java_Petit_projet/items/weapons/Fist.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/items/weapons/axes/Axe.class
Normal file
BIN
out/production/Java_Petit_projet/items/weapons/axes/Axe.class
Normal file
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.
4
src/events/StartEvent.java
Normal file
4
src/events/StartEvent.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package events;
|
||||||
|
|
||||||
|
public class StartEvent extends Event{
|
||||||
|
}
|
||||||
@ -5,14 +5,19 @@ import heroes.Hero;
|
|||||||
public class Dwarf extends Race{
|
public class Dwarf extends Race{
|
||||||
public Dwarf() {
|
public Dwarf() {
|
||||||
this.setRaceName("Nain");
|
this.setRaceName("Nain");
|
||||||
|
this.health = 10;
|
||||||
|
this.strength = 10;
|
||||||
|
this.defense = 10;
|
||||||
|
this.dexterity = -15;
|
||||||
|
this.intelligence = -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustStats(Hero hero) {
|
public void adjustStats(Hero hero) {
|
||||||
hero.setHealth(hero.getHealthBaseLevel() + 10);
|
hero.setHealth(hero.getHealth() + health);
|
||||||
hero.setStrength(hero.getStrengthBaseLevel() + 10);
|
hero.setStrength(hero.getStrength() + strength);
|
||||||
hero.setDefense(hero.getDefenseBaseLevel() + 10);
|
hero.setDefense(hero.getDefense() + defense);
|
||||||
hero.setDexterity(hero.getDexterityBaseLevel() - 15);
|
hero.setDexterity(hero.getDexterity() + dexterity);
|
||||||
hero.setIntelligence(hero.getIntelligenceBaseLevel() - 10);
|
hero.setIntelligence(hero.getIntelligence() + intelligence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,14 +5,19 @@ import heroes.Hero;
|
|||||||
public class Elf extends Race{
|
public class Elf extends Race{
|
||||||
public Elf() {
|
public Elf() {
|
||||||
this.setRaceName("Elfe");
|
this.setRaceName("Elfe");
|
||||||
|
this.health = -5;
|
||||||
|
this.strength = -5;
|
||||||
|
this.defense = - 5;
|
||||||
|
this.dexterity = 10;
|
||||||
|
this.intelligence = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustStats(Hero hero) {
|
public void adjustStats(Hero hero) {
|
||||||
hero.setHealth(hero.getHealthBaseLevel() - 5);
|
hero.setHealth(hero.getHealth() + health);
|
||||||
hero.setStrength(hero.getStrengthBaseLevel() - 5);
|
hero.setStrength(hero.getStrength() + strength);
|
||||||
hero.setDefense(hero.getDefenseBaseLevel() - 5);
|
hero.setDefense(hero.getDefense() + defense);
|
||||||
hero.setDexterity(hero.getDexterityBaseLevel() + 10);
|
hero.setDexterity(hero.getDexterity() + dexterity);
|
||||||
hero.setIntelligence(hero.getIntelligenceBaseLevel() + 10);
|
hero.setIntelligence(hero.getIntelligence() + intelligence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,14 +5,19 @@ import heroes.Hero;
|
|||||||
public class Human extends Race{
|
public class Human extends Race{
|
||||||
public Human() {
|
public Human() {
|
||||||
this.setRaceName("Human");
|
this.setRaceName("Human");
|
||||||
|
this.health = 5;
|
||||||
|
this.strength = 5;
|
||||||
|
this.defense = 5;
|
||||||
|
this.dexterity = 5;
|
||||||
|
this.intelligence = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustStats(Hero hero) {
|
public void adjustStats(Hero hero) {
|
||||||
hero.setHealth(hero.getHealthBaseLevel() + 5);
|
hero.setHealth(hero.getHealth() + health);
|
||||||
hero.setStrength(hero.getStrengthBaseLevel() + 5);
|
hero.setStrength(hero.getStrength() + strength);
|
||||||
hero.setDefense(hero.getDefenseBaseLevel() + 5);
|
hero.setDefense(hero.getDefense() + defense);
|
||||||
hero.setDexterity(hero.getDexterityBaseLevel() + 5);
|
hero.setDexterity(hero.getDexterity() + dexterity);
|
||||||
hero.setIntelligence(hero.getIntelligenceBaseLevel() + 5);
|
hero.setIntelligence(hero.getIntelligence() + intelligence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,16 +3,22 @@ package heroes.races;
|
|||||||
import heroes.Hero;
|
import heroes.Hero;
|
||||||
|
|
||||||
public class Ork extends Race {
|
public class Ork extends Race {
|
||||||
|
|
||||||
public Ork() {
|
public Ork() {
|
||||||
this.setRaceName("Orc");
|
this.setRaceName("Orc");
|
||||||
|
this.health = 10;
|
||||||
|
this.strength = 10;
|
||||||
|
this.defense = 10;
|
||||||
|
this.dexterity = -5;
|
||||||
|
this.intelligence = -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustStats(Hero hero) {
|
public void adjustStats(Hero hero) {
|
||||||
hero.setHealth(hero.getHealthBaseLevel() + 10);
|
hero.setHealth(hero.getHealth() + health);
|
||||||
hero.setStrength(hero.getStrengthBaseLevel() + 10);
|
hero.setStrength(hero.getStrength() + strength);
|
||||||
hero.setDefense(hero.getDefenseBaseLevel() + 10);
|
hero.setDefense(hero.getDefense() + defense);
|
||||||
hero.setDexterity(hero.getDexterityBaseLevel() - 5);
|
hero.setDexterity(hero.getDexterity() + dexterity);
|
||||||
hero.setIntelligence(hero.getIntelligenceBaseLevel() - 10);
|
hero.setIntelligence(hero.getIntelligence() + intelligence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,11 @@ import heroes.Hero;
|
|||||||
|
|
||||||
public abstract class Race {
|
public abstract class Race {
|
||||||
public String raceName;
|
public String raceName;
|
||||||
|
public int health;
|
||||||
|
public int strength;
|
||||||
|
public int defense;
|
||||||
|
public int dexterity;
|
||||||
|
public int intelligence;
|
||||||
|
|
||||||
public String getRaceName(){
|
public String getRaceName(){
|
||||||
return raceName;
|
return raceName;
|
||||||
|
|||||||
15
src/items/weapons/Fist.java
Normal file
15
src/items/weapons/Fist.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package items.weapons;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
|
public class Fist extends Weapon{
|
||||||
|
public Fist() {
|
||||||
|
this.name = "Poings d'acier";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void equip(Hero hero) {
|
||||||
|
hero.setWeapon(this);
|
||||||
|
hero.setStrength(hero.getStrength() + 5);
|
||||||
|
hero.setDexterity(hero.getDexterity() + 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,4 +3,5 @@ package items.weapons;
|
|||||||
import items.Equipment;
|
import items.Equipment;
|
||||||
|
|
||||||
public abstract class Weapon extends Equipment {
|
public abstract class Weapon extends Equipment {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/items/weapons/axes/Axe.java
Normal file
6
src/items/weapons/axes/Axe.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package items.weapons.axes;
|
||||||
|
|
||||||
|
import items.weapons.Weapon;
|
||||||
|
|
||||||
|
public abstract class Axe extends Weapon {
|
||||||
|
}
|
||||||
16
src/items/weapons/axes/TrainingAxe.java
Normal file
16
src/items/weapons/axes/TrainingAxe.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package items.weapons.axes;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
|
public class TrainingAxe extends Axe{
|
||||||
|
public TrainingAxe() {
|
||||||
|
this.name = "Hache d'apprentissage";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void equip(Hero hero) {
|
||||||
|
hero.setWeapon(this);
|
||||||
|
hero.setStrength(hero.getStrength() + 10);
|
||||||
|
hero.setDexterity(hero.getDexterity() -5);
|
||||||
|
hero.setIntelligence(hero.getIntelligence() -5);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/items/weapons/staffs/ApprenticeStaff.java
Normal file
14
src/items/weapons/staffs/ApprenticeStaff.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package items.weapons.staffs;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
|
public class ApprenticeStaff extends Staff {
|
||||||
|
public ApprenticeStaff() {
|
||||||
|
this.name = "Bâton d'apprenti";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void equip(Hero hero) {
|
||||||
|
hero.setWeapon(this);
|
||||||
|
hero.setIntelligence(hero.getIntelligence() + 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/items/weapons/staffs/Staff.java
Normal file
6
src/items/weapons/staffs/Staff.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package items.weapons.staffs;
|
||||||
|
|
||||||
|
import items.weapons.Weapon;
|
||||||
|
|
||||||
|
public abstract class Staff extends Weapon {
|
||||||
|
}
|
||||||
15
src/items/weapons/swords/Dagger.java
Normal file
15
src/items/weapons/swords/Dagger.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package items.weapons.swords;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
|
public class Dagger extends Sword{
|
||||||
|
public Dagger() {
|
||||||
|
this.name = "Dague";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void equip(Hero hero) {
|
||||||
|
hero.setWeapon(this);
|
||||||
|
hero.setStrength(hero.getStrength() + 2);
|
||||||
|
hero.setDexterity(hero.getDexterity() + 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/items/weapons/swords/Sword.java
Normal file
6
src/items/weapons/swords/Sword.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package items.weapons.swords;
|
||||||
|
|
||||||
|
import items.weapons.Weapon;
|
||||||
|
|
||||||
|
public abstract class Sword extends Weapon {
|
||||||
|
}
|
||||||
15
src/items/weapons/swords/TrainingSword.java
Normal file
15
src/items/weapons/swords/TrainingSword.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package items.weapons.swords;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
|
public class TrainingSword extends Sword{
|
||||||
|
public TrainingSword() {
|
||||||
|
this.name = "Épée d'Entraînement";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void equip(Hero hero) {
|
||||||
|
hero.setWeapon(this);
|
||||||
|
hero.setStrength(hero.getStrength() + 5);
|
||||||
|
hero.setDexterity(hero.getDexterity() + 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,67 +1,59 @@
|
|||||||
package systems;
|
package systems;
|
||||||
|
|
||||||
|
import events.StartEvent;
|
||||||
import heroes.Hero;
|
import heroes.Hero;
|
||||||
import heroes.jobs.*;
|
import heroes.jobs.*;
|
||||||
import heroes.races.*;
|
import heroes.races.*;
|
||||||
import items.chests.LeatherArmor;
|
import items.chests.*;
|
||||||
import items.chests.MailChest;
|
import items.helmets.*;
|
||||||
import items.chests.PlateArmor;
|
import items.weapons.axes.TrainingAxe;
|
||||||
import items.chests.RobeMage;
|
import items.weapons.staffs.ApprenticeStaff;
|
||||||
import items.helmets.Hat;
|
import items.weapons.swords.*;
|
||||||
import items.helmets.Helm;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Game {
|
public class Game {
|
||||||
|
|
||||||
public Scanner scanner = new Scanner(System.in);
|
private final Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
public Game() {
|
public Game() {
|
||||||
System.out.println("Bienvenue dans ce projet fou ! Veux-tu créer ton personnage ?");
|
System.out.println("Bienvenue dans ce projet fou ! Veux-tu créer ton personnage ?");
|
||||||
System.out.println("1.Oui\n2.Non");
|
System.out.println("1.Oui\n2.Non");
|
||||||
String startGame = scanner.next();
|
String startGame = scanner.next();
|
||||||
switch (startGame.toLowerCase()) {
|
if (startGame.equalsIgnoreCase("oui") || startGame.equalsIgnoreCase("yes") || startGame.equalsIgnoreCase("y") || startGame.equalsIgnoreCase("o")) {
|
||||||
case "oui", "yes", "y", "o" -> createCharacter();
|
createCharacter();
|
||||||
case "non", "no", "n" -> {
|
} else {
|
||||||
System.out.println("Très bien, à bientôt !");
|
System.out.println("Très bien, à bientôt !");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createCharacter() {
|
private void createCharacter() {
|
||||||
System.out.println("Quel est le nom de ton personnage ?");
|
System.out.println("Quel est le nom de ton personnage ?");
|
||||||
String name = scanner.next();
|
String name = scanner.next();
|
||||||
System.out.println("Ton personnage s'appelle " + name + " ! Veux-tu le modifier ? \n1.Oui\n2.Non");
|
System.out.println("Ton personnage s'appelle " + name + " ! Veux-tu le modifier ? \n1.Oui\n2.Non");
|
||||||
String choice = scanner.next();
|
String choice = scanner.next();
|
||||||
switch (choice.toLowerCase()) {
|
if (choice.equalsIgnoreCase("oui") || choice.equalsIgnoreCase("yes") || choice.equalsIgnoreCase("y") || choice.equalsIgnoreCase("o")) {
|
||||||
case "oui", "yes", "y", "o" -> {
|
createCharacter();
|
||||||
createCharacter();
|
} else {
|
||||||
}
|
System.out.println("Très bien, " + name + ".");
|
||||||
case "non", "no", "n" -> {
|
Hero hero = new Hero(name);
|
||||||
System.out.println("Très bien, " + name + ".");
|
hero.printStats();
|
||||||
Hero hero = new Hero(name);
|
selectJob(hero);
|
||||||
hero.printStats();
|
|
||||||
selectJob(hero);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectJob(Hero hero) {
|
private void selectJob(Hero hero) {
|
||||||
System.out.println("Quelle classe veux-tu choisir ? Un guerrier ? (G), un mage ? (M), un voleur ? (V)");
|
System.out.println("Quelle classe veux-tu choisir ? Un guerrier ? (G), un mage ? (M), un voleur ? (V)");
|
||||||
String job = scanner.next();
|
String job = scanner.next();
|
||||||
switch (job.toLowerCase()) {
|
switch (job.toLowerCase()) {
|
||||||
case "guerrier", "g" -> {
|
case "guerrier", "g" -> hero.setJob(new Warrior());
|
||||||
hero.setJob(new Warrior());
|
case "mage", "m" -> hero.setJob(new Mage());
|
||||||
System.out.println("Tu as choisi la classe de guerrier !");
|
case "voleur", "v" -> hero.setJob(new Rogue());
|
||||||
}
|
default -> {
|
||||||
case "mage", "m" -> {
|
System.out.println("Je n'ai pas compris ta réponse.");
|
||||||
hero.setJob(new Mage());
|
selectJob(hero);
|
||||||
System.out.println("Tu as choisi la classe de mage !");
|
return;
|
||||||
}
|
|
||||||
case "voleur", "v" -> {
|
|
||||||
hero.setJob(new Rogue());
|
|
||||||
System.out.println("Tu as choisi la classe de voleur !");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Voici les caractéristiques de ton personnage :");
|
System.out.println("Voici les caractéristiques de ton personnage :");
|
||||||
@ -69,9 +61,10 @@ public class Game {
|
|||||||
System.out.println(hero.getJob().getJobName());
|
System.out.println(hero.getJob().getJobName());
|
||||||
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
||||||
String choice = scanner.next();
|
String choice = scanner.next();
|
||||||
switch (choice.toLowerCase()) {
|
if (choice.equalsIgnoreCase("oui") || choice.equalsIgnoreCase("yes") || choice.equalsIgnoreCase("y") || choice.equalsIgnoreCase("o")) {
|
||||||
case "oui", "yes", "y", "o" -> selectRace(hero);
|
selectRace(hero);
|
||||||
case "non", "no", "n" -> selectJob(hero);
|
} else {
|
||||||
|
selectJob(hero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,21 +72,14 @@ public class Game {
|
|||||||
System.out.println("Veux-tu jouer un nain ? (N), un orc ? (O), un elfe (E) ou un humain (H) ?");
|
System.out.println("Veux-tu jouer un nain ? (N), un orc ? (O), un elfe (E) ou un humain (H) ?");
|
||||||
String choice = scanner.next();
|
String choice = scanner.next();
|
||||||
switch (choice.toLowerCase()) {
|
switch (choice.toLowerCase()) {
|
||||||
case "nain", "n" -> {
|
case "nain", "n" -> hero.setRace(new Dwarf());
|
||||||
hero.setRace(new Dwarf());
|
case "orc", "o" -> hero.setRace(new Ork());
|
||||||
System.out.println("Tu as choisi d'être un nain !");
|
case "elfe", "e" -> hero.setRace(new Elf());
|
||||||
}
|
case "humain", "h" -> hero.setRace(new Human());
|
||||||
case "orc", "o" -> {
|
default -> {
|
||||||
hero.setRace(new Ork());
|
System.out.println("Je n'ai pas compris ta réponse.");
|
||||||
System.out.println("Tu as choisi d'être un orc !");
|
selectRace(hero);
|
||||||
}
|
return;
|
||||||
case "elfe", "e" -> {
|
|
||||||
hero.setRace(new Elf());
|
|
||||||
System.out.println("Tu as choisi d'être un elfe !");
|
|
||||||
}
|
|
||||||
case "humain", "h" -> {
|
|
||||||
hero.setRace(new Human());
|
|
||||||
System.out.println("Tu as choisi d'être un humain !");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Voici les caractéristiques de ton personnage :");
|
System.out.println("Voici les caractéristiques de ton personnage :");
|
||||||
@ -101,152 +87,127 @@ public class Game {
|
|||||||
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
||||||
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
||||||
String choice2 = scanner.next();
|
String choice2 = scanner.next();
|
||||||
switch (choice2.toLowerCase()) {
|
if (choice2.equalsIgnoreCase("oui") || choice2.equalsIgnoreCase("yes") || choice2.equalsIgnoreCase("y") || choice2.equalsIgnoreCase("o")) {
|
||||||
case "oui", "yes", "y", "o" -> {
|
System.out.println("Très bien, Et maintenant, ton équipement.");
|
||||||
System.out.println("Très bien, Et maintenant, ton équipement.");
|
equipHelmet(hero);
|
||||||
equipHelmet(hero);
|
} else {
|
||||||
}
|
selectRace(hero);
|
||||||
case "non", "no", "n" -> selectRace(hero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void equipHelmet(Hero hero) {
|
|
||||||
System.out.println("Veux-tu équiper un casque ?\n1.Oui\n2.Non");
|
|
||||||
String choice = scanner.next();
|
|
||||||
switch (choice.toLowerCase()) {
|
|
||||||
case "oui", "yes", "y", "o" -> {
|
|
||||||
System.out.println("D'accord, lequel ? Un Heaume ? (H), un Chapeau ? (C) ?, ou rien ?");
|
|
||||||
String helmet = scanner.next();
|
|
||||||
switch (helmet.toLowerCase()) {
|
|
||||||
case "heaume", "h" -> {
|
|
||||||
hero.setHelmet(new Helm());
|
|
||||||
hero.getHelmet().equip(hero);
|
|
||||||
System.out.println("Tu as équipé un heaume !");
|
|
||||||
}
|
|
||||||
case "chapeau", "c" -> {
|
|
||||||
hero.setHelmet(new Hat());
|
|
||||||
hero.getHelmet().equip(hero);
|
|
||||||
System.out.println("Tu as équipé un chapeau !");
|
|
||||||
}
|
|
||||||
case "none", "rien", "r", "n" -> System.out.println("Très bien, tu n'as pas équipé de casque.");
|
|
||||||
default -> {
|
|
||||||
System.out.println("Je n'ai pas compris ta réponse.");
|
|
||||||
equipHelmet(hero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "non", "no", "n" -> {
|
|
||||||
System.out.println("Très bien, tu n'as pas équipé de casque.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hero.printStats();
|
|
||||||
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
|
||||||
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
|
||||||
String choice2 = scanner.next();
|
|
||||||
switch (choice2.toLowerCase()) {
|
|
||||||
case "oui", "yes", "y", "o" -> equipArmor(hero);
|
|
||||||
case "non", "no", "n" -> equipHelmet(hero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void equipArmor(Hero hero) {
|
|
||||||
System.out.println("Veux-tu t'équiper d'une armure ?\n1.Oui\n2.Non");
|
|
||||||
String choice = scanner.next();
|
|
||||||
switch (choice.toLowerCase()) {
|
|
||||||
case "oui", "yes", "y", "o" -> {
|
|
||||||
System.out.println("D'accord, lequel ? Une armure en plaque (P) ? Une cotte de mail (M) ? Une tunique en cuir (T) ? Une robe de mage (R) ?");
|
|
||||||
String armor = scanner.next();
|
|
||||||
switch (armor.toLowerCase()) {
|
|
||||||
case "plaque", "plate", "p", "armor", "armure" -> {
|
|
||||||
hero.setChest(new PlateArmor());
|
|
||||||
hero.getChest().equip(hero);
|
|
||||||
System.out.println("Tu t'es équipé d'une armure en plaque !");
|
|
||||||
}
|
|
||||||
case "tunique","tunic", "t", "leather", "cuir" -> {
|
|
||||||
hero.setChest(new LeatherArmor());
|
|
||||||
hero.getChest().equip(hero);
|
|
||||||
System.out.println("Tu t'es équipé d'une tunique de cuir !");
|
|
||||||
}
|
|
||||||
case "mail","mailles", "m", "cotte", "chest" -> {
|
|
||||||
hero.setChest(new MailChest());
|
|
||||||
hero.getChest().equip(hero);
|
|
||||||
System.out.println("Tu t'es équipé d'une tunique de cuir !");
|
|
||||||
}
|
|
||||||
case "robe","mage", "r" -> {
|
|
||||||
hero.setChest(new RobeMage());
|
|
||||||
hero.getChest().equip(hero);
|
|
||||||
System.out.println("Tu t'es équipé d'une tunique de cuir !");
|
|
||||||
}
|
|
||||||
case "none", "rien" -> {
|
|
||||||
System.out.println("Tu veux VRAIMENT y aller à poil ?");
|
|
||||||
String validate = scanner.next();
|
|
||||||
switch (validate.toLowerCase()) {
|
|
||||||
case "oui", "yes", "y", "o" -> System.out.println("Ah bah d'accord le nudiste ...");
|
|
||||||
case "non", "no", "n" -> equipArmor(hero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default -> {
|
|
||||||
System.out.println("Je n'ai pas compris ta réponse.");
|
|
||||||
equipHelmet(hero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "non", "no", "n" -> System.out.println("Très bien, tu n'as pas équipé d'armure.");
|
|
||||||
}
|
|
||||||
hero.printStats();
|
|
||||||
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
|
||||||
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
|
||||||
String choice2 = scanner.next();
|
|
||||||
switch (choice2.toLowerCase()) {
|
|
||||||
case "oui", "yes", "y", "o" -> equipWeapon(hero);
|
|
||||||
case "non", "no", "n" -> equipArmor(hero);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void equipWeapon(Hero hero){
|
private void equipHelmet(Hero hero) {
|
||||||
System.out.println("Veux-tu t'équiper d'une arme ?\n1.Oui\n2.Non");
|
System.out.println("Veux-tu équiper un casque ?\n1.Oui\n2.Non");
|
||||||
String choice = scanner.next();
|
String choice = scanner.next();
|
||||||
switch (choice.toLowerCase()) {
|
if (choice.equalsIgnoreCase("oui") || choice.equalsIgnoreCase("yes") || choice.equalsIgnoreCase("y") || choice.equalsIgnoreCase("o")) {
|
||||||
case "oui", "yes", "y", "o" -> {
|
System.out.println("D'accord, lequel ? Un Heaume ? (H), un Chapeau ? (C) ?, ou rien ?");
|
||||||
System.out.println("D'accord, lequel ? Une épée (E) ? Un bâton (B) ? Un arc (A) ? Une dague (D) ?");
|
String helmet = scanner.next();
|
||||||
String weapon = scanner.next();
|
switch (helmet.toLowerCase()) {
|
||||||
switch (weapon.toLowerCase()) {
|
case "heaume", "h" -> hero.setHelmet(new Helm());
|
||||||
case "sword", "epee", "e" -> {
|
case "chapeau", "c" -> hero.setHelmet(new Hat());
|
||||||
hero.setWeapon(new Sword());
|
case "none", "rien", "r", "n" -> System.out.println("Très bien, tu n'as pas équipé de casque.");
|
||||||
hero.getWeapon().equip(hero);
|
default -> {
|
||||||
System.out.println("Tu t'es équipé d'une épée !");
|
System.out.println("Je n'ai pas compris ta réponse.");
|
||||||
}
|
equipHelmet(hero);
|
||||||
case "staff", "baton", "b" -> {
|
return;
|
||||||
hero.setWeapon(new Staff());
|
|
||||||
hero.getWeapon().equip(hero);
|
|
||||||
System.out.println("Tu t'es équipé d'un bâton !");
|
|
||||||
}
|
|
||||||
case "bow", "arc", "a" -> {
|
|
||||||
hero.setWeapon(new Bow());
|
|
||||||
hero.getWeapon().equip(hero);
|
|
||||||
System.out.println("Tu t'es équipé d'un arc !");
|
|
||||||
}
|
|
||||||
case "dagger", "dague", "d" -> {
|
|
||||||
hero.setWeapon(new Dagger());
|
|
||||||
hero.getWeapon().equip(hero);
|
|
||||||
System.out.println("Tu t'es équipé d'une dague !");
|
|
||||||
}
|
|
||||||
case "none", "rien" -> {
|
|
||||||
System.out.println("Tu veux VRAIMENT y aller à mains nues ?");
|
|
||||||
String validate = scanner.next();
|
|
||||||
switch (validate.toLowerCase()) {
|
|
||||||
case "oui", "yes", "y", "o" -> System.out.println("Ah bah d'accord le nudiste ...");
|
|
||||||
case "non", "no", "n" -> equipWeapon(hero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default -> {
|
|
||||||
System.out.println("Je n'ai pas compris ta réponse.");
|
|
||||||
equipWeapon(hero);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "non", "no", "n" -> System.out.println("Très bien, tu n'as pas équipé d'arme.");
|
if (hero.getHelmet() != null) hero.getHelmet().equip(hero);
|
||||||
|
} else {
|
||||||
|
System.out.println("Très bien, tu n'as pas équipé de casque.");
|
||||||
}
|
}
|
||||||
hero.printStats();
|
hero.printStats();
|
||||||
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
||||||
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
||||||
|
String choice2 = scanner.next();
|
||||||
|
if (choice2.equalsIgnoreCase("oui") || choice2.equalsIgnoreCase("yes") || choice2.equalsIgnoreCase("y") || choice2.equalsIgnoreCase("o")) {
|
||||||
|
equipArmor(hero);
|
||||||
|
} else {
|
||||||
|
equipHelmet(hero);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void equipArmor(Hero hero) {
|
||||||
|
System.out.println("Veux-tu t'équiper d'une armure ?\n1.Oui\n2.Non");
|
||||||
|
String choice = scanner.next();
|
||||||
|
if (choice.equalsIgnoreCase("oui") || choice.equalsIgnoreCase("yes") || choice.equalsIgnoreCase("y") || choice.equalsIgnoreCase("o")) {
|
||||||
|
System.out.println("D'accord, lequel ? Une armure en plaque (P) ? Une cotte de mail (M) ? Une tunique en cuir (T) ? Une robe de mage (R) ?");
|
||||||
|
String armor = scanner.next();
|
||||||
|
switch (armor.toLowerCase()) {
|
||||||
|
case "plaque", "plate", "p", "armor", "armure" -> hero.setChest(new PlateArmor());
|
||||||
|
case "tunique", "tunic", "t", "leather", "cuir" -> hero.setChest(new LeatherArmor());
|
||||||
|
case "mail", "mailles", "m", "cotte", "chest" -> hero.setChest(new MailChest());
|
||||||
|
case "robe", "mage", "r" -> hero.setChest(new RobeMage());
|
||||||
|
case "none", "rien" -> {
|
||||||
|
System.out.println("Tu veux VRAIMENT y aller à poil ?");
|
||||||
|
String validate = scanner.next();
|
||||||
|
if (validate.equalsIgnoreCase("oui") || validate.equalsIgnoreCase("yes") || validate.equalsIgnoreCase("y") || validate.equalsIgnoreCase("o")) {
|
||||||
|
System.out.println("Ah bah d'accord le nudiste ...");
|
||||||
|
} else {
|
||||||
|
equipArmor(hero);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
System.out.println("Je n'ai pas compris ta réponse.");
|
||||||
|
equipArmor(hero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hero.getChest() != null) hero.getChest().equip(hero);
|
||||||
|
} else {
|
||||||
|
System.out.println("Très bien, tu n'as pas équipé d'armure.");
|
||||||
|
}
|
||||||
|
hero.printStats();
|
||||||
|
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
||||||
|
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
||||||
|
String choice2 = scanner.next();
|
||||||
|
if (choice2.equalsIgnoreCase("oui") || choice2.equalsIgnoreCase("yes") || choice2.equalsIgnoreCase("y") || choice2.equalsIgnoreCase("o")) {
|
||||||
|
equipWeapon(hero);
|
||||||
|
} else {
|
||||||
|
equipArmor(hero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void equipWeapon(Hero hero) {
|
||||||
|
System.out.println("Veux-tu t'équiper d'une arme ?\n1.Oui\n2.Non");
|
||||||
|
String choice = scanner.next();
|
||||||
|
if (choice.equalsIgnoreCase("oui") || choice.equalsIgnoreCase("yes") || choice.equalsIgnoreCase("y") || choice.equalsIgnoreCase("o")) {
|
||||||
|
System.out.println("D'accord, lequel ? Une épée (E) ? Un bâton (B) ? Une hache (H) ? Une dague (D) ? Ou rien ?");
|
||||||
|
String weapon = scanner.next();
|
||||||
|
switch (weapon.toLowerCase()) {
|
||||||
|
case "sword", "epee", "e" -> hero.setWeapon(new TrainingSword());
|
||||||
|
case "staff", "baton", "b" -> hero.setWeapon(new ApprenticeStaff());
|
||||||
|
case "axe", "hache", "h" -> hero.setWeapon(new TrainingAxe());
|
||||||
|
case "dagger", "dague", "d" -> hero.setWeapon(new Dagger());
|
||||||
|
case "none", "rien" -> {
|
||||||
|
System.out.println("Tu veux VRAIMENT y aller à mains nues ?");
|
||||||
|
String validate = scanner.next();
|
||||||
|
if (validate.equalsIgnoreCase("oui") || validate.equalsIgnoreCase("yes") || validate.equalsIgnoreCase("y") || validate.equalsIgnoreCase("o")) {
|
||||||
|
System.out.println("Rien de tel que ses poings pour montrer sa puissance.");
|
||||||
|
} else {
|
||||||
|
equipWeapon(hero);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
System.out.println("Je n'ai pas compris ta réponse.");
|
||||||
|
equipWeapon(hero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hero.getWeapon() != null) hero.getWeapon().equip(hero);
|
||||||
|
} else {
|
||||||
|
System.out.println("Très bien, tu n'as pas équipé d'arme.");
|
||||||
|
}
|
||||||
|
hero.printStats();
|
||||||
|
System.out.println(hero.getRace().getRaceName() + "\n" + hero.getJob().getJobName());
|
||||||
|
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
||||||
|
String choice2 = scanner.next();
|
||||||
|
if (choice2.equalsIgnoreCase("oui") || choice2.equalsIgnoreCase("yes") || choice2.equalsIgnoreCase("y") || choice2.equalsIgnoreCase("o")) {
|
||||||
|
System.out.println("Très bien, tu es prêt à commencer l'aventure !");
|
||||||
|
new StartEvent();
|
||||||
|
} else {
|
||||||
|
equipWeapon(hero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user