diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java b/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java index 0cf8748..61c819a 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java +++ b/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java @@ -39,18 +39,15 @@ public class HealthDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - String message = getString(R.string.new_energies1) + - " " + getArguments().getInt("curativeEfforts") + " " + - getString(R.string.new_energies2); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setMessage(message) - .setTitle(R.string.new_energies_title) - .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { + builder.setMessage(R.string.new_energies_message) + .setTitle(R.string.new_energies) + .setPositiveButton(R.string.me, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mListener.heal(HealthDialogFragment.this, true); } }) - .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { + .setNegativeButton(R.string.other, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { mListener.heal(HealthDialogFragment.this, false); diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/Introduction.java b/app/src/main/java/com/ddns/kauron/dungeonmanager/Introduction.java index 60029c7..83d4c10 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/Introduction.java +++ b/app/src/main/java/com/ddns/kauron/dungeonmanager/Introduction.java @@ -34,7 +34,7 @@ public class Introduction extends ActionBarActivity { classSpinner = (Spinner) findViewById(R.id.classSpinner); classSpinner.setAdapter( - new ArrayAdapter( + new ArrayAdapter<>( this, android.R.layout.simple_spinner_dropdown_item, Player.classStrings @@ -43,7 +43,7 @@ public class Introduction extends ActionBarActivity { raceSpinner = (Spinner) findViewById(R.id.raceSpinner); raceSpinner.setAdapter( - new ArrayAdapter( + new ArrayAdapter<>( this, android.R.layout.simple_spinner_dropdown_item, Player.raceStrings diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java b/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java index 68bd0f9..55b3d7a 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java +++ b/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java @@ -211,6 +211,7 @@ public class MainActivity extends ActionBarActivity private void healthStatusCheck() { int status = player.getState(); + int lastState = player.getLastState(); Button pg = (Button) findViewById(R.id.pgCurrent); pg.setText(String.valueOf(player.getPg())); if (status == Player.MUERTO) { @@ -242,9 +243,23 @@ public class MainActivity extends ActionBarActivity } else if (status == Player.DEBILITADO) { pg.setBackgroundColor(android.R.drawable.btn_default); pg.setTextColor(Color.RED); + if(lastState != Player.SAME) { + Toast.makeText( + getApplicationContext(), + R.string.state_changed_debilitado, + Toast.LENGTH_LONG + ).show(); + } } else if (status == Player.MALHERIDO) { pg.setBackgroundColor(android.R.drawable.btn_default); pg.setTextColor(Color.YELLOW); + if(lastState != Player.SAME) { + Toast.makeText( + getApplicationContext(), + R.string.state_changed_malherido, + Toast.LENGTH_LONG + ).show(); + } } else { pg.setTextColor(getResources().getColor( R.color.abc_primary_text_material_dark @@ -278,7 +293,6 @@ public class MainActivity extends ActionBarActivity p.getInt("sab", 10), p.getInt("car", 10), }, - new int[3], new int[18], new Power[4]); } else { @@ -305,6 +319,7 @@ public class MainActivity extends ActionBarActivity ((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(player.getPg())); + //attacks ((TextView) findViewById(R.id.FUE)).setText( getString(R.string.FUE) + ": " + player.getFue() ); @@ -324,6 +339,20 @@ public class MainActivity extends ActionBarActivity getString(R.string.CAR) + ": " + player.getCar() ); + //defenses + ((TextView) findViewById(R.id.CA)).setText( + getString(R.string.CA) + ": " + player.getCa() + ); + ((TextView) findViewById(R.id.FORT)).setText( + getString(R.string.FORT) + ": " + player.getFort() + ); + ((TextView) findViewById(R.id.REF)).setText( + getString(R.string.REF) + ": " + player.getRef() + ); + ((TextView) findViewById(R.id.VOL)).setText( + getString(R.string.VOL) + ": " + player.getVol() + ); + } diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java b/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java index 1411467..9cc249f 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java +++ b/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java @@ -27,8 +27,9 @@ public class Player { /** * Values for defenses */ - public static final int CA = 1, FORT = 2, REF = 3, VOL = 4; + public static final int CA = 0, FORT = 1, REF = 2, VOL = 3; + //TODO: develop abilities /** * Values for abilities */ @@ -48,11 +49,11 @@ public class Player { /** * Values for the current living state */ - public static final int OK = 1, MALHERIDO = 2, DEBILITADO = 3, MUERTO = 4, + public static final int OK = 1, MALHERIDO = 2, DEBILITADO = 3, MUERTO = 4, SAME = 5, USE_CURATIVE_EFFORT = -1, CURED = 1, NOT_CURED = 0, MAXED = -1; private int pg, maxPg; - private int state; + private int state, lastState; private int curativeEfforts, maxCurativeEfforts; //TODO: convert race and class to integer values private int classInt, raceInt; @@ -64,17 +65,17 @@ public class Player { public Player( String name, String className, String raceName, - int level, int[] atk, int[] def, int[] abilities, + int level, int[] atk, int[] abilities, Power[] powers ){ this.name = name; + this.level = level; + this.raceName = raceName; this.className = className; + this.def = new int[4]; setAtk(atk); setState(); - this.raceName = raceName; - this.level = level; - this.def = def; this.abilities = abilities; this.powers = powers; } @@ -104,14 +105,14 @@ public class Player { else { if(uses && pg < maxPg) curativeEfforts--; if (pg < 0) { - + pg = 0; } else { pg += maxPg / 4; } } } else { if (pg < 0) { - + pg = 0; } else { pg += recovered; } @@ -123,11 +124,13 @@ public class Player { return CURED; } + public int getLastState() {return lastState == state ? SAME : lastState;} public int getState() {return state;} private void setState() { - if (pg < maxPg / -2) state = MUERTO; - else if (pg < 0) state = DEBILITADO; - else if(pg < maxPg / 2) state = MALHERIDO; + lastState = state; + if (pg <= maxPg / -2) state = MUERTO; + else if (pg <= 0) state = DEBILITADO; + else if(pg <= maxPg / 2) state = MALHERIDO; else state = OK; } @@ -143,6 +146,7 @@ public class Player { public String getRaceName() {return raceName;} public void setRaceName(String raceName) {this.raceName = raceName;} + //TODO: implement time in the app public void rest(boolean length) { if(length) { curativeEfforts = maxCurativeEfforts; @@ -160,24 +164,37 @@ public class Player { public int getCar() {return atk[CAR];} public int getDes() {return atk[DES];} public int getInt() {return atk[INT];} + public int getCa() {return def[CA];} + public int getFort() {return def[FORT];} + public int getRef() {return def[REF];} + public int getVol() {return def[VOL];} + //TODO: set the pg level dependant public void setClass() { + int pgExtra = 0, curativeEffortsExtra = 0, defCA = 0, defFORT = 0, defVOL = 0, defREF = 0; if(className.equals(classStrings[1])){ //Ardiente } else if (className.equals(classStrings[2])) { //Brujo //TODO: Kauron - pg = maxPg = 12 + atk[CON]; - curativeEfforts = maxCurativeEfforts = 6 + Player.getModifier(atk[CON]); - return; //TODO: temporal + pgExtra = 12; + curativeEffortsExtra = 6; + defVOL = defREF = 1; } else if (className.equals(classStrings[3])) { //Buscador } else if (className.equals(classStrings[4])) { //Clérigo //TODO: Gárafran + pgExtra = 12; + curativeEffortsExtra = 7; + defVOL = 2; } else if (className.equals(classStrings[5])) { //Explorador //TODO: Aria Saferi + pgExtra = 12; + curativeEffortsExtra= 6; + defFORT = 1; + defREF = 1; } else if (className.equals(classStrings[6])) { //Guerrero } else if (className.equals(classStrings[7])) { @@ -189,6 +206,9 @@ public class Player { } else if (className.equals(classStrings[10])) { //Paladín //TODO: Ceaelynna + pgExtra = 15; + curativeEffortsExtra = 10; + defFORT = defREF = defVOL = 1; } else if (className.equals(classStrings[11])) { //Pícaro } else if (className.equals(classStrings[12])) { @@ -198,9 +218,16 @@ public class Player { } else { //Señor de la Guerra //TODO: Mushu + pgExtra = 12; + curativeEffortsExtra = 7; + defVOL = 2; } - pg = maxPg = 15; - curativeEfforts = maxCurativeEfforts = 15; + pg = maxPg = atk[CON] + pgExtra; + curativeEfforts = maxCurativeEfforts = Player.getModifier(atk[CON]) + curativeEffortsExtra; + def[CA] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[FUE])) + defCA; + def[FORT] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[FUE])) + defFORT; + def[REF] = 10 + level / 2 + Player.getModifier(Math.max(atk[DES], atk[INT])) + defREF; + def[VOL] = 10 + level / 2 + Player.getModifier(Math.max(atk[CAR], atk[SAB])) + defVOL; } public static int getModifier(int i) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c21e829..6bf4163 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -97,78 +97,177 @@ android:id="@+id/curativeEffortsText"/> - - + android:orientation="vertical"> + android:textStyle="bold" + android:textColor="?android:textColorSecondary" + android:textSize="14sp" + android:gravity="center_vertical" + android:paddingLeft="8dip" + android:paddingRight="8dip"/> + + + + + + + + + + + + + + + + + + + android:textStyle="bold" + android:textColor="?android:textColorSecondary" + android:textSize="14sp" + android:gravity="center_vertical" + android:paddingLeft="8dip" + android:paddingRight="8dip"/> - + android:id="@+id/defenseGrid" + android:columnCount="2" + android:rowCount="2"> - + - - + + + + + + + diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 0099b2f..15cb3c1 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -13,7 +13,7 @@ Tienes que rellenar todos los campos Te quedan esfuerzos curativos. - ¿Usar un esfuerzo curativo? + Nuevas energías No No te quedan esfuerzos curativos Ok @@ -31,7 +31,7 @@ Esfuerzos curativos PG Borrar datos - Tienes + Te quedan de esfuerzos curativos diarios Morir @@ -40,9 +40,20 @@ Todos los datos se perderán irrevocablemente ¿Estás seguro? CAR - CON - DES - FUE - INT - SAB + CON + DES + FUE + INT + SAB + Te has caído al suelo debilitado, no puedes moverte ni hacer nada. + ¡Sólo tienes la mitad de la vida! + ¿Quién va a usar un esfuerzo curativo? + Yo + Otro + Ataque + Defensa + CA + FORT + REF + VOL \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 77d3a84..d8ad45b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,10 +2,16 @@ DungeonManager + Attack Cure Undo PG Die + CA + FORT + REF + VOL + Defense Curative efforts You have out of @@ -20,9 +26,11 @@ Action undone Edit character Adventurer name + You have less than half of your maximum health + Who is using a curative effort? Class Race - + You have fainted. You can\'t move or do anything! Cancel Ok Yes @@ -32,7 +40,7 @@ Your character has died You have curative efforts - Use a curative effort? + New energies Edit character Done @@ -44,6 +52,8 @@ You have reached your maximum level of PG Input the damage suffered PG lost + Me + Otro FUE CON