diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 357c800..8f80d15 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -5,6 +5,7 @@
+
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 866a9f3..0cf8748 100644
--- a/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java
+++ b/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java
@@ -9,6 +9,7 @@ import android.content.DialogInterface;
import android.os.Bundle;
public class HealthDialogFragment extends DialogFragment {
+ //TODO: convert to method and dialog, without class
static HealthDialogFragment newInstance(int curativeEfforts) {
HealthDialogFragment f = new HealthDialogFragment();
@@ -20,7 +21,7 @@ public class HealthDialogFragment extends DialogFragment {
}
public interface HealthDialogListener {
- public void curativeEffort(DialogFragment dialog, boolean uses);
+ public void heal(DialogFragment dialog, boolean uses);
}
@@ -46,13 +47,13 @@ public class HealthDialogFragment extends DialogFragment {
.setTitle(R.string.new_energies_title)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
- mListener.curativeEffort(HealthDialogFragment.this, true);
+ mListener.heal(HealthDialogFragment.this, true);
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
- mListener.curativeEffort(HealthDialogFragment.this, false);
+ mListener.heal(HealthDialogFragment.this, false);
}
})
.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() {
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 5017505..68bd0f9 100644
--- a/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java
+++ b/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java
@@ -99,10 +99,10 @@ public class MainActivity extends ActionBarActivity
});
alert.show();
- } else if (id == R.id.action_save) {
- saveData();
- } else if (id == R.id.action_load) {
- restoreData();
+// } else if (id == R.id.action_save) {
+// saveData();
+// } else if (id == R.id.action_load) {
+// restoreData();
}
return super.onOptionsItemSelected(item);
@@ -141,7 +141,7 @@ public class MainActivity extends ActionBarActivity
}
@Override
- public void curativeEffort(DialogFragment dialog, boolean uses) {
+ public void heal(DialogFragment dialog, boolean uses) {
int hasCured = player.recoverPg(Player.USE_CURATIVE_EFFORT, uses);
if (hasCured == Player.NOT_CURED) {
Toast.makeText(
@@ -157,12 +157,16 @@ public class MainActivity extends ActionBarActivity
Toast.LENGTH_LONG
).show();
}
+ getSharedPreferences("basics", MODE_PRIVATE).edit()
+ .putInt("pg", player.getPg())
+ .putInt("curativeEfforts", player.getCurativeEfforts())
+ .apply();
updateCurativeString();
healthStatusCheck();
}
}
- public void onCurrentPgClick(final View view){
+ public void damage(final View view){
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(getString(R.string.suffer_damage));
@@ -187,6 +191,9 @@ public class MainActivity extends ActionBarActivity
undo = true;
undoPreviousValue = preValue;
undoObject = CURRENT_PG;
+ getSharedPreferences("basics", MODE_PRIVATE).edit()
+ .putInt("pg", player.getPg())
+ .apply();
healthStatusCheck();
invalidateOptionsMenu();
} catch (Exception e) {}
@@ -279,11 +286,15 @@ public class MainActivity extends ActionBarActivity
player.setClassName(p.getString("className", getString(R.string.class_name)));
player.setRaceName(p.getString("raceName", getString(R.string.race_name)));
player.setLevel(p.getInt("level", 1));
- player.setMaxPg(p.getInt("maxPg", 15));
- player.setPg(p.getInt("pg", 15));
+ player.setAtk(new int[]{
+ p.getInt("fue", 10),
+ p.getInt("con", 10),
+ p.getInt("des", 10),
+ p.getInt("int", 10),
+ p.getInt("sab", 10),
+ p.getInt("car", 10),
+ });
healthStatusCheck();
- player.setMaxCurativeEfforts(p.getInt("maxCurativeEfforts", 5));
- player.setCurativeEffort(p.getInt("curativeEfforts", 5));
updateCurativeString();
}
//set restored values to the respective fields
@@ -316,15 +327,15 @@ public class MainActivity extends ActionBarActivity
}
- private void saveData() {
- getSharedPreferences("basics", MODE_PRIVATE).edit()
- .putInt("level", player.getLevel())
- .putInt("maxPg", player.getMaxPg())
- .putInt("pg", player.getPg())
- .putInt("maxCurativeEfforts", player.getMaxCurativeEfforts())
- .putInt("curativeEfforts", player.getCurativeEfforts())
- .apply();
- }
+// private void saveData() {
+// getSharedPreferences("basics", MODE_PRIVATE).edit()
+// .putInt("level", player.getLevel())
+// .putInt("maxPg", player.getMaxPg())
+// .putInt("pg", player.getPg())
+// .putInt("maxCurativeEfforts", player.getMaxCurativeEfforts())
+// .putInt("curativeEfforts", player.getCurativeEfforts())
+// .apply();
+// }
private void updateCurativeString() {
((TextView) findViewById(R.id.curativeEffortsText)).setText(
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 00d9ddb..1411467 100644
--- a/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java
+++ b/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java
@@ -66,51 +66,14 @@ public class Player {
String name, String className, String raceName,
int level, int[] atk, int[] def, int[] abilities,
Power[] powers
- ) {
- setState();
+ ){
this.name = name;
this.className = className;
-
- if(className.equals(classStrings[1])){
- //Ardiente
- } else if (className.equals(classStrings[2])) {
- //Brujo
- //TODO: Kauron
- maxPg = atk[CON] + 12;
- maxCurativeEfforts = 6 + atk[CON];
- } else if (className.equals(classStrings[3])) {
- //Buscador
- } else if (className.equals(classStrings[4])) {
- //Clérigo
- //TODO: Gárafran
- } else if (className.equals(classStrings[5])) {
- //Explorador
- //TODO: Aria Saferi
- } else if (className.equals(classStrings[6])) {
- //Guerrero
- } else if (className.equals(classStrings[7])) {
- //Mago
- } else if (className.equals(classStrings[8])) {
- //Mente de Batalla
- } else if (className.equals(classStrings[9])) {
- //Monje
- } else if (className.equals(classStrings[10])) {
- //Paladín
- //TODO: Ceaelynna
- } else if (className.equals(classStrings[11])) {
- //Pícaro
- } else if (className.equals(classStrings[12])) {
- //Psiónico
- } else if (className.equals(classStrings[13])) {
- //Sacerdote rúnico
- } else {
- //Señor de la Guerra
- //TODO: Mushu
- }
+ setAtk(atk);
+ setState();
this.raceName = raceName;
this.level = level;
- this.atk = atk;
this.def = def;
this.abilities = abilities;
this.powers = powers;
@@ -172,7 +135,10 @@ public class Player {
public void setName(String name) {this.name = name;}
public String getClassName() {return className;}
- public void setClassName(String className) {this.className = className;}
+ public void setClassName(String className) {
+ this.className = className;
+ if(atk!=null) setClass();
+ }
public String getRaceName() {return raceName;}
public void setRaceName(String raceName) {this.raceName = raceName;}
@@ -186,15 +152,7 @@ public class Player {
}
}
- public void setAtk(int[] atk) {this.atk = atk;}
- public int[] getAtk() {return atk;}
-
- public void setFue(int fue) {atk[FUE] = fue;}
- public void setCon(int con) {atk[CON] = con;}
- public void setSab(int sab) {atk[SAB] = sab;}
- public void setCar(int car) {atk[CAR] = car;}
- public void setDes(int des) {atk[DES] = des;}
- public void setInt(int intel) {atk[INT] = intel;}
+ public void setAtk(int[] atk) {this.atk = atk; if(className!=null) setClass();}
public int getFue() {return atk[FUE];}
public int getCon() {return atk[CON];}
@@ -202,4 +160,58 @@ public class Player {
public int getCar() {return atk[CAR];}
public int getDes() {return atk[DES];}
public int getInt() {return atk[INT];}
+
+ public void setClass() {
+ 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
+ } else if (className.equals(classStrings[3])) {
+ //Buscador
+ } else if (className.equals(classStrings[4])) {
+ //Clérigo
+ //TODO: Gárafran
+ } else if (className.equals(classStrings[5])) {
+ //Explorador
+ //TODO: Aria Saferi
+ } else if (className.equals(classStrings[6])) {
+ //Guerrero
+ } else if (className.equals(classStrings[7])) {
+ //Mago
+ } else if (className.equals(classStrings[8])) {
+ //Mente de Batalla
+ } else if (className.equals(classStrings[9])) {
+ //Monje
+ } else if (className.equals(classStrings[10])) {
+ //Paladín
+ //TODO: Ceaelynna
+ } else if (className.equals(classStrings[11])) {
+ //Pícaro
+ } else if (className.equals(classStrings[12])) {
+ //Psiónico
+ } else if (className.equals(classStrings[13])) {
+ //Sacerdote rúnico
+ } else {
+ //Señor de la Guerra
+ //TODO: Mushu
+ }
+ pg = maxPg = 15;
+ curativeEfforts = maxCurativeEfforts = 15;
+ }
+
+ public static int getModifier(int i) {
+ return i / 2 - 5;
+ }
+
+ public int getTotalModifier(int i) {
+ return getModifier(i) + level / 2;
+ }
+
+ public static int getLevel (int px) {
+ return 0; //TODO: substitute level by px and autoconvert
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 2781ec8..c21e829 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -11,7 +11,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/pgCurrent"
android:textSize="40sp"
- android:onClick="onCurrentPgClick"
+ android:onClick="damage"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index 20ac31c..1de207d 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -13,16 +13,16 @@
android:orderInCategory="2"
app:showAsAction="always"
android:icon="@drawable/ic_action_heal"/>
-
-
+
+
+
+
+
+
+
+
+
+