package learning;
import static learning.VocationEnum.*;
public class Character {
int lvl = 10, hp, mp, cap;
Double exp;
VocationEnum vocation;
public void print() {
System.out.println(" Postać na poziomie " + lvl + " posiada " + exp.intValue() + " doświadczenia. ");
printProfessionResults();
}
private void printProfessionResults() {
switch(vocation) {
case KNIGHT :
System.out.println("Knight posiada: ");
break;
case PALADIN:
System.out.println("Paladin posiada: ");
break;
case SORCERER:
System.out.println("Sorcerer posiada: ");
break;
case DRUID:
System.out.println(" Elder Druid posiada: ");
break;
}
System.out.println(hp + " życia");
System.out.println(mp + " many. ");
System.out.println(cap + " capa. ");
System.out.println();
}
void askForProfession() {
System.out.println(" Wybierz numer swojej profesji lub q by zakończyć: ");
System.out.println(" 1. EK ");
System.out.println(" 2. RP ");
System.out.println(" 3. MS ");
System.out.println(" 4. ED ");
}
boolean isVal(int ch) {
if(ch < '1' | ch > 4 & ch != 'q') {
return false;
}
else {
return true;
}
}
public void setProfession(char choice) {
switch(choice) {
case '1': vocation = KNIGHT; break;
case '2': vocation = PALADIN; break;
case '3': vocation = SORCERER; break;
case '4': vocation = DRUID; break;
}
}
public void calculate() {
exp = 50.0 / 3.0 * ((lvl * lvl * lvl) - (6 * (lvl * lvl)) + (17 * lvl) - 12);
if(vocation == KNIGHT) {
calculateKnight();
} else if (vocation == PALADIN) {
calculatePaladin();
} else {
calculateMaginProfession();
}
}
private void calculateKnight() {
hp = 5*(3 * lvl +13);
mp = 5*(lvl + 10);
cap = 5*(5 * lvl + 54);
}
private void calculatePaladin() {
hp = 5*(2 * lvl + 21);
mp = 5*(3 * lvl - 6);
cap = 10*(2 * lvl + 31);
}
private void calculateMaginProfession() {
hp = 5*(lvl + 29);
mp = 5*(6 * lvl - 30);
cap = 10*(lvl + 39);
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}