Classes crées et les stats changent en fonction du choix.
This commit is contained in:
parent
6ac654cc3a
commit
39212794fd
BIN
out/production/Java_Petit_projet/Main.class
Normal file
BIN
out/production/Java_Petit_projet/Main.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/events/Event.class
Normal file
BIN
out/production/Java_Petit_projet/events/Event.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/heroes/Hero.class
Normal file
BIN
out/production/Java_Petit_projet/heroes/Hero.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/heroes/jobs/Job.class
Normal file
BIN
out/production/Java_Petit_projet/heroes/jobs/Job.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/heroes/jobs/Mage.class
Normal file
BIN
out/production/Java_Petit_projet/heroes/jobs/Mage.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/heroes/jobs/Rogue.class
Normal file
BIN
out/production/Java_Petit_projet/heroes/jobs/Rogue.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/heroes/jobs/Warrior.class
Normal file
BIN
out/production/Java_Petit_projet/heroes/jobs/Warrior.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/heroes/races/Race.class
Normal file
BIN
out/production/Java_Petit_projet/heroes/races/Race.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/items/Item.class
Normal file
BIN
out/production/Java_Petit_projet/items/Item.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/items/armors/Armor.class
Normal file
BIN
out/production/Java_Petit_projet/items/armors/Armor.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/Java_Petit_projet/items/helmets/Helmet.class
Normal file
BIN
out/production/Java_Petit_projet/items/helmets/Helmet.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/items/shields/Shield.class
Normal file
BIN
out/production/Java_Petit_projet/items/shields/Shield.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/rules/Action.class
Normal file
BIN
out/production/Java_Petit_projet/rules/Action.class
Normal file
Binary file not shown.
BIN
out/production/Java_Petit_projet/systems/Game.class
Normal file
BIN
out/production/Java_Petit_projet/systems/Game.class
Normal file
Binary file not shown.
@ -7,7 +7,7 @@ public class Hero {
|
|||||||
protected String name;
|
protected String name;
|
||||||
protected Race race;
|
protected Race race;
|
||||||
protected Job job;
|
protected Job job;
|
||||||
protected int heatlhBaseLevel;
|
protected int healthBaseLevel;
|
||||||
protected int strengthBaseLevel;
|
protected int strengthBaseLevel;
|
||||||
protected int dexterityBaseLevel;
|
protected int dexterityBaseLevel;
|
||||||
protected int intelligenceBaseLevel;
|
protected int intelligenceBaseLevel;
|
||||||
@ -40,14 +40,17 @@ public class Hero {
|
|||||||
|
|
||||||
public void setJob(Job job) {
|
public void setJob(Job job) {
|
||||||
this.job = job;
|
this.job = job;
|
||||||
|
if (job != null){
|
||||||
|
job.adjustStats(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeatlhBaseLevel() {
|
public int getHealthBaseLevel() {
|
||||||
return heatlhBaseLevel;
|
return healthBaseLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHeatlhBaseLevel(int heatlhBaseLevel) {
|
public void setHealthBaseLevel(int healthBaseLevel) {
|
||||||
this.heatlhBaseLevel = heatlhBaseLevel;
|
this.healthBaseLevel = healthBaseLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStrengthBaseLevel() {
|
public int getStrengthBaseLevel() {
|
||||||
@ -126,32 +129,42 @@ public class Hero {
|
|||||||
this.setName("Hero");
|
this.setName("Hero");
|
||||||
this.setRace(null);
|
this.setRace(null);
|
||||||
this.setJob(null);
|
this.setJob(null);
|
||||||
this.setHeatlhBaseLevel(100);
|
this.setHealthBaseLevel(100);
|
||||||
this.setStrengthBaseLevel(10);
|
this.setStrengthBaseLevel(10);
|
||||||
this.setDexterityBaseLevel(10);
|
this.setDexterityBaseLevel(10);
|
||||||
this.setIntelligenceBaseLevel(10);
|
this.setIntelligenceBaseLevel(10);
|
||||||
this.setDefenseBaseLevel(10);
|
this.setDefenseBaseLevel(10);
|
||||||
|
setHealth(this.getHealthBaseLevel());
|
||||||
|
setStrength(this.getStrengthBaseLevel());
|
||||||
|
setDexterity(this.getDexterityBaseLevel());
|
||||||
|
setIntelligence(this.getIntelligenceBaseLevel());
|
||||||
|
setDefense(this.getDefenseBaseLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hero(String name) {
|
public Hero(String name) {
|
||||||
this.setName(name);
|
this.setName(name);
|
||||||
this.setRace(null);
|
this.setRace(null);
|
||||||
this.setJob(null);
|
this.setJob(null);
|
||||||
this.setHeatlhBaseLevel(100);
|
this.setHealthBaseLevel(100);
|
||||||
this.setStrengthBaseLevel(10);
|
this.setStrengthBaseLevel(10);
|
||||||
this.setDexterityBaseLevel(10);
|
this.setDexterityBaseLevel(10);
|
||||||
this.setIntelligenceBaseLevel(10);
|
this.setIntelligenceBaseLevel(10);
|
||||||
this.setDefenseBaseLevel(10);
|
this.setDefenseBaseLevel(10);
|
||||||
|
setHealth(this.getHealthBaseLevel());
|
||||||
|
setStrength(this.getStrengthBaseLevel());
|
||||||
|
setDexterity(this.getDexterityBaseLevel());
|
||||||
|
setIntelligence(this.getIntelligenceBaseLevel());
|
||||||
|
setDefense(this.getDefenseBaseLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printStats() {
|
public void printStats() {
|
||||||
System.out.println("Caractéristiques de " + this.getName() + " :");
|
System.out.println("Caractéristiques de " + this.getName() + " :");
|
||||||
// System.out.println("Classe : " + this.getJob().getName());
|
// System.out.println("Classe : " + this.getJob().getName());
|
||||||
// System.out.println("Race : " + this.getRace().getName());
|
// System.out.println("Race : " + this.getRace().getName());
|
||||||
System.out.println("Point de vie : " + this.getHeatlhBaseLevel());
|
System.out.println("Point de vie : " + this.getHealth());
|
||||||
System.out.println("Force : " + this.getStrengthBaseLevel());
|
System.out.println("Force : " + this.getStrength());
|
||||||
System.out.println("Dextérité : " + this.getDexterityBaseLevel());
|
System.out.println("Dextérité : " + this.getDexterity());
|
||||||
System.out.println("Intelligence : " + this.getIntelligenceBaseLevel());
|
System.out.println("Intelligence : " + this.getIntelligence());
|
||||||
System.out.println("Défense : " + this.getDefenseBaseLevel());
|
System.out.println("Défense : " + this.getDefense());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,16 @@ package heroes.jobs;
|
|||||||
|
|
||||||
import heroes.Hero;
|
import heroes.Hero;
|
||||||
|
|
||||||
public abstract class Job extends Hero {
|
public abstract class Job {
|
||||||
|
public String jobName;
|
||||||
|
|
||||||
|
public String getJobName() {
|
||||||
|
return jobName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJobName(String jobName) {
|
||||||
|
this.jobName = jobName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void adjustStats(Hero hero);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
package heroes.jobs;
|
package heroes.jobs;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
public class Mage extends Job{
|
public class Mage extends Job{
|
||||||
public Mage() {
|
public Mage() {
|
||||||
this.setJob(this);
|
this.setJobName("Mage");
|
||||||
this.setHealth(getHeatlhBaseLevel() - 10);
|
}
|
||||||
this.setStrength(getStrengthBaseLevel() - 5);
|
@Override
|
||||||
this.setDefense(getDefenseBaseLevel() - 5);
|
public void adjustStats(Hero hero) {
|
||||||
this.setDexterity(getDexterityBaseLevel() -5);
|
hero.setHealth(hero.getHealthBaseLevel() - 10);
|
||||||
this.setIntelligence(getIntelligenceBaseLevel() + 15);
|
hero.setStrength(hero.getStrengthBaseLevel() - 10);
|
||||||
|
hero.setDefense(hero.getDefenseBaseLevel() - 5);
|
||||||
|
hero.setIntelligence(hero.getIntelligenceBaseLevel() + 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
package heroes.jobs;
|
package heroes.jobs;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
public class Rogue extends Job{
|
public class Rogue extends Job{
|
||||||
public Rogue() {
|
public Rogue() {
|
||||||
this.setJob(this);
|
this.setJobName("Voleur");
|
||||||
this.setHealth(getHeatlhBaseLevel());
|
}
|
||||||
this.setStrength(getStrengthBaseLevel() - 5);
|
@Override
|
||||||
this.setDefense(getDefenseBaseLevel() - 5);
|
public void adjustStats(Hero hero) {
|
||||||
this.setDexterity(getDexterityBaseLevel() + 15);
|
hero.setHealth(hero.getHealthBaseLevel() - 10);
|
||||||
this.setIntelligence(getIntelligenceBaseLevel() - 5);
|
hero.setStrength(hero.getStrengthBaseLevel() + 5);
|
||||||
|
hero.setDexterity(hero.getDexterityBaseLevel() + 20);
|
||||||
|
hero.setIntelligence(hero.getIntelligenceBaseLevel() - 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,17 @@
|
|||||||
package heroes.jobs;
|
package heroes.jobs;
|
||||||
|
|
||||||
|
import heroes.Hero;
|
||||||
|
|
||||||
public class Warrior extends Job {
|
public class Warrior extends Job {
|
||||||
public Warrior() {
|
public Warrior() {
|
||||||
this.setJob(this);
|
this.setJobName("Guerrier");
|
||||||
this.setHealth(getHeatlhBaseLevel() + 15);
|
}
|
||||||
this.setStrength(getStrengthBaseLevel() + 10);
|
@Override
|
||||||
this.setDefense(getDefenseBaseLevel() + 5);
|
public void adjustStats(Hero hero) {
|
||||||
this.setDexterity(getDexterityBaseLevel() - 15);
|
hero.setHealth(hero.getHealthBaseLevel() + 10);
|
||||||
this.setIntelligence(getIntelligenceBaseLevel() - 10);
|
hero.setStrength(hero.getStrengthBaseLevel() + 10);
|
||||||
|
hero.setDefense(hero.getDefenseBaseLevel() + 10);
|
||||||
|
hero.setDexterity(hero.getDexterityBaseLevel() - 5);
|
||||||
|
hero.setIntelligence(hero.getIntelligenceBaseLevel() - 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
package systems;
|
package systems;
|
||||||
|
|
||||||
import heroes.Hero;
|
import heroes.Hero;
|
||||||
|
import heroes.jobs.Mage;
|
||||||
|
import heroes.jobs.Rogue;
|
||||||
|
import heroes.jobs.Warrior;
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Game {
|
public class Game {
|
||||||
@ -33,7 +37,42 @@ public class Game {
|
|||||||
System.out.println("Très bien, " + name + ".");
|
System.out.println("Très bien, " + name + ".");
|
||||||
Hero hero = new Hero(name);
|
Hero hero = new Hero(name);
|
||||||
hero.printStats();
|
hero.printStats();
|
||||||
|
selectJob(hero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void selectJob(Hero hero){
|
||||||
|
System.out.println("Quelle classe veux-tu choisir ? Un guerrier ? (G), un mage ? (M), un voleur ? (V)");
|
||||||
|
String job = scanner.next();
|
||||||
|
switch (job.toLowerCase()) {
|
||||||
|
case "guerrier", "g" -> {
|
||||||
|
hero.setJob(new Warrior());
|
||||||
|
System.out.println("Tu as choisi la classe de guerrier !");
|
||||||
|
hero.printStats();
|
||||||
|
}
|
||||||
|
case "mage", "m" -> {
|
||||||
|
hero.setJob(new Mage());
|
||||||
|
System.out.println("Tu as choisi la classe de mage !");
|
||||||
|
hero.printStats();
|
||||||
|
}
|
||||||
|
case "voleur", "v" -> {
|
||||||
|
hero.setJob(new Rogue());
|
||||||
|
System.out.println("Tu as choisi la classe de voleur !");
|
||||||
|
hero.printStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("Voici les caractéristiques de ton personnage :");
|
||||||
|
hero.printStats();
|
||||||
|
System.out.println(hero.getJob().getJobName());
|
||||||
|
System.out.println("Veux-tu continuer ?\n1.Oui\n2.Non");
|
||||||
|
String choice = scanner.next();
|
||||||
|
switch (choice.toLowerCase()) {
|
||||||
|
case "oui", "yes", "y", "o" -> selectRace(hero);
|
||||||
|
case "non", "no", "n" -> selectJob(hero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectRace(Hero hero) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user