1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
import java.util.Scanner;
public class Boxe
{
public static void main(String[] args)
{
Scanner clavier = new Scanner(System.in);
//assignation d'un nom au Boxeur1
System.out.println("Entrer le nom du Boxeur 1:");
Scanner clavier1 = new Scanner(System.in);
String nomBoxeur1= clavier1.nextLine();
System.out.println("Le Boxeur 1 est **" + nomBoxeur1 + "**.");
System.out.println(" ");
//assignation d'un nom au Boxeur2
System.out.println("Entrer le nom du Boxeur 2:");
Scanner clavier2 = new Scanner(System.in);
String nomBoxeur2= clavier2.nextLine();
System.out.println("Le Boxeur 2 est **" + nomBoxeur2 + "**.");
System.out.println(" ");
//début du combat
System.out.println("==== QUE LE COMBAT COMMENCE !!! ====");
//déclaration endurance des deux Boxeurs
int endurance1 = 100;
int endurance2 = 100;
for(int round = 1; round <13; round++)
{
System.out.println(" ");
System.out.println("== ROUND " + round + "==");
System.out.println(" ");
int recupEnd1 = (int) (Math.random() * 10);
endurance1 = endurance1 + recupEnd1;
System.out.println("**" + nomBoxeur1 + "** récupère " + recupEnd1 + " points d'Endurance. (" + endurance1 + ")");
int recupEnd2 = (int) (Math.random() * 10);
endurance2 = endurance2 + recupEnd2;
System.out.println("**" + nomBoxeur2 + "** récupère " + recupEnd2 + " points d'Endurance. (" + endurance2 + ")");
for (int tour = 1; tour <4; tour++)
{
System.out.println(" ");
//choix du coup Boxeur1
System.out.println("**" + nomBoxeur1 + "** choisi le coup que tu vas tenter:");
System.out.println("1 = DIRECT, 80% d'infliger 3 points de dégâts. (crit 8% / 9 pts)");
System.out.println("2 = CROCHET, 60% d'infliger 6 points de dégâts. (crit 6% / 18 pts)");
System.out.println("3 = UPPERCUT, 40% d'infliger 9 points de dégâts. (crit 4% / 27 pts)");
System.out.println("Entre 1, 2 ou 3:");
String coup = "";
do
{
coup = clavier.nextLine();
switch (coup)
{
case "1":
System.out.println("Tu balances un DIRECT !");
int precision = (int) (Math.random() * 100);
System.out.println("Résultat du Dé = (" + precision + ").");
if (precision <= 8)
{System.out.println("Ton Direct est *CRITIQUE* !!!");
endurance2 = endurance2 - 9;
System.out.println("**" + nomBoxeur2 + "** perd 9 points d'Endurance");}
if (precision >=9 && precision <= 80)
{System.out.println("Ton Direct est *REUSSI*.");
endurance2 = endurance2 - 3;
System.out.println("**" + nomBoxeur2 + "** perd 3 points d'Endurance");}
if (precision >= 81)
{System.out.println("Ton Direct est *RATE*.");}
break;
case "2":
System.out.println("Tu balances un CROCHET !");
int precision1 = (int) (Math.random() * 100);
System.out.println("Résultat du Dé = (" + precision1 + ").");
if (precision1 <= 6)
{System.out.println("Ton Crochet est *CRITIQUE* !!!");
endurance2 = endurance2 - 18;
System.out.println("**" + nomBoxeur2 + "** perd 18 points d'Endurance");}
if (precision1 >=7 && precision1 <= 60)
{System.out.println("Ton Crochet est *REUSSI*.");
endurance2 = endurance2 - 6;
System.out.println("**" + nomBoxeur2 + "** perd 6 points d'Endurance");}
if (precision1 >= 61)
{System.out.println("Ton Crochet est *RATE*.");}
break;
case "3":
System.out.println("Tu balances un UPPERCUT !");
int precision2 = (int) (Math.random() * 100);
System.out.println("Résultat du Dé = (" + precision2 + ").");
if (precision2 <= 4)
{System.out.println("Ton Uppercut est *CRITIQUE* !!!");
endurance2 = endurance2 - 27;
System.out.println("**" + nomBoxeur2 + "** perd 27 points d'Endurance");}
if (precision2 >=5 && precision2 <= 40)
{System.out.println("Ton Uppercut est *REUSSI*.");
endurance2 = endurance2 - 9;
System.out.println("**" + nomBoxeur2 + "** perd 9 points d'Endurance");}
if (precision2 >= 41)
{System.out.println("Ton Uppercut est *RATE*.");}
break;
default:
System.out.println("Entre 1, 2 ou 3 !");
coup = "";
}
}while(coup.isEmpty());
System.out.println(" ");
//choix du coup Boxeur2
System.out.println("**" + nomBoxeur2 + "** choisi le coup que tu vas tenter:");
System.out.println("1 = DIRECT, 80% d'infliger 3 points de dégâts. (crit 8% / 9 pts)");
System.out.println("2 = CROCHET, 60% d'infliger 6 points de dégâts. (crit 6% / 18 pts)");
System.out.println("3 = UPPERCUT, 40% d'infliger 9 points de dégâts. (crit 4% / 27 pts)");
System.out.println("Entre 1, 2 ou 3:");
String coup2 = "";
do{
coup2 = clavier.nextLine();
switch (coup2)
{
case "1":
System.out.println("Tu balances un DIRECT !");
int precision3 = (int) (Math.random() * 100);
System.out.println("Résultat du Dé = (" + precision3 + ").");
if (precision3 <= 8)
{System.out.println("Ton Direct est *CRITIQUE* !!!");
endurance1 = endurance1 - 9;
System.out.println("**" + nomBoxeur1 + "** perd 9 points d'Endurance");}
if (precision3 >=9 && precision3 <= 80)
{System.out.println("Ton Direct est *REUSSI*.");
endurance1 = endurance1 - 3;
System.out.println("**" + nomBoxeur1 + "** perd 3 points d'Endurance");}
if (precision3 >= 81)
{System.out.println("Ton Direct est *RATE*.");}
break;
case "2":
System.out.println("Tu balances un CROCHET !");
int precision4 = (int) (Math.random() * 100);
System.out.println("Résultat du Dé = (" + precision4 + ").");
if (precision4 <= 6)
{System.out.println("Ton Crochet est *CRITIQUE* !!!");
endurance1 = endurance1 - 18;
System.out.println("**" + nomBoxeur1 + "** perd 18 points d'Endurance");}
if (precision4 >=7 && precision4 <= 60)
{System.out.println("Ton Crochet est *REUSSI*.");
endurance1 = endurance1 - 6;
System.out.println("**" + nomBoxeur1 + "** perd 6 points d'Endurance");}
if (precision4 >= 61)
{System.out.println("Ton Crochet est *RATE*.");}
break;
case "3":
System.out.println("Tu balances un UPPERCUT !");
int precision5 = (int) (Math.random() * 100);
System.out.println("Résultat du Dé = (" + precision5 + ").");
if (precision5 <= 4)
{System.out.println("Ton Uppercut est *CRITIQUE* !!!");
endurance1 = endurance1 - 27;
System.out.println("**" + nomBoxeur1 + "** perd 27 points d'Endurance");}
if (precision5 >=5 && precision5 <= 40)
{System.out.println("Ton Uppercut est *REUSSI*.");
endurance1 = endurance1 - 9;
System.out.println("**" + nomBoxeur1 + "** perd 9 points d'Endurance");}
if (precision5 >= 41)
{System.out.println("Ton Uppercut est *RATE*.");}
break;
default:
System.out.println("Entre 1, 2 ou 3 !");
coup2 = "";
}
}while(coup2.isEmpty());
}
}
System.out.println(" ");
System.out.println("Endurance de " + nomBoxeur1 + ":" + endurance1);
System.out.println("Endurance de " + nomBoxeur2 + ":" + endurance2);
System.out.println(" ");
if (endurance1 > endurance2){
System.out.println("===== BRAVO **" + nomBoxeur1 + "** TU GAGNES LE COMBAT !!! =====");}
else if (endurance2 > endurance1){
System.out.println("===== BRAVO **" + nomBoxeur2 + "** TU GAGNES LE COMBAT !!! =====");}
else {System.out.println("===== LES JUGES N'ONT PAS DECLARE DE VAINQUEUR ! VOUS ETES A EGALITE ! =====");}
}
} |
Partager