diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 8f80d15..6b63890 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -4,6 +4,7 @@
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7c1069c..18bb2d5 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="com.kauron.dungeonmanager" >
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
index 6fcc02c..aebd5a0 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
@@ -13,9 +13,10 @@ import android.widget.Toast;
public class Introduction extends ActionBarActivity {
- EditText name, level;
- EditText fue, con, des, sab, intel, car;
- Spinner classSpinner, raceSpinner;
+ private EditText name, level;
+ private EditText fue, con, des, sab, intel, car;
+ private Spinner classSpinner, raceSpinner;
+ private boolean first;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -49,6 +50,8 @@ public class Introduction extends ActionBarActivity {
Player.RACE_STRINGS
)
);
+
+ first = getIntent().getExtras() == null || getIntent().getExtras().getBoolean("first_time");
}
@@ -78,7 +81,7 @@ public class Introduction extends ActionBarActivity {
//noinspection SimplifiableIfStatement
if (id == R.id.action_save) {
if(finished()) {
- this.finish();
+ finish();
} else {
Toast.makeText(
getApplicationContext(),
@@ -117,7 +120,7 @@ public class Introduction extends ActionBarActivity {
if (!this.sab.getText().toString().isEmpty())
sab = Integer.parseInt(this.sab.getText().toString());
- if(getIntent().getExtras().getBoolean("first_time")) {
+ if(first) {
if (
!nameString.isEmpty() &&
classInt != Player.NULL &&
@@ -151,7 +154,7 @@ public class Introduction extends ActionBarActivity {
if (!nameString.isEmpty()) ed.putString("playerName", nameString);
if (classInt != Player.NULL) ed.putInt("classInt", classInt);
if (raceInt != Player.NULL) ed.putInt("raceInt", raceInt);
- if (pxInt != 0) ed.putInt("px", pxInt);
+ if (pxInt != -1) ed.putInt("px", pxInt);
if (fue != 0) ed.putInt("fue", fue);
if (car != 0) ed.putInt("car", car);
diff --git a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
index 1190e7c..d86a35e 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
@@ -27,20 +27,44 @@ public class MainActivity extends ActionBarActivity{
public Player player;
private boolean undo;
private int undoObject, undoPreviousValue;
+ //TODO: change curativeEffortsBar() color
+
+ private ProgressBar pgBar, negPgBar, xpBar, curativeEffortsBar;
+ private Button pgCurrent;
+ private TextView currentPg, currentXp, currentCurativeEfforts, lvl;
+ private SharedPreferences p;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- ((ProgressBar) findViewById(R.id.xpBar))
- .getProgressDrawable()
+
+ p = getSharedPreferences("basics", MODE_PRIVATE);
+ xpBar = (ProgressBar) findViewById(R.id.xpBar);
+ curativeEffortsBar = (ProgressBar) findViewById(R.id.curativeEffortsBar);
+ pgBar = (ProgressBar) findViewById(R.id.pgBar);
+ negPgBar = (ProgressBar) findViewById(R.id.negPgBar);
+
+ pgCurrent = (Button) findViewById(R.id.pgCurrent);
+
+ lvl = (TextView) findViewById(R.id.lvl);
+ currentPg = (TextView) findViewById(R.id.currentPg);
+ currentXp = (TextView) findViewById(R.id.currentXp);
+ currentCurativeEfforts = (TextView) findViewById(R.id.currentCurativeEfforts);
+
+ xpBar.getProgressDrawable()
.setColorFilter(Color.parseColor("#62BACE"), PorterDuff.Mode.SRC_IN);
- ((ProgressBar) findViewById(R.id.curativeEffortsBar))
- .getProgressDrawable()
+ curativeEffortsBar.getProgressDrawable()
.setColorFilter(Color.parseColor("#FFD700"), PorterDuff.Mode.SRC_IN);
//TODO: use the negative PG bar, not curativeEfforts one
-// findViewById(R.id.negCurativeEffortsBar).setRotation(180);
undo = false;
+ //begin
+ restoreData();
+ pgUpdate();
+ ceUpdate();
+ pxUpdate();
+ //end
invalidateOptionsMenu();
}
@@ -77,7 +101,6 @@ public class MainActivity extends ActionBarActivity{
}
return true;
} else if (id == R.id.action_edit_basics) {
- SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
Intent intent = new Intent(this, Introduction.class);
startActivity(intent.putExtra(
"first_time",
@@ -99,7 +122,7 @@ public class MainActivity extends ActionBarActivity{
R.string.message_reset,
Toast.LENGTH_LONG
).show();
- getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
+ p.edit().clear().apply();
player = null;
restoreData();
}
@@ -132,21 +155,23 @@ public class MainActivity extends ActionBarActivity{
//TODO: update currentPg button
//TODO: improve leveling up
player.setMaxPgOnLevelUp();
- ((TextView) findViewById(R.id.lvl)).setText(
+ lvl.setText(
String.valueOf(player.getLevel())
);
- healthStatusCheck();
- updateCurativeString();
}
- getSharedPreferences("basics", MODE_PRIVATE)
- .edit().putInt("px", player.getPx()).apply();
- incrementProgressBar(
- (ProgressBar) findViewById(R.id.xpBar),
- (TextView) findViewById(R.id.currentXp),
- 1, levelUp, Player.LEVEL_PX[player.getLevel()] -
- Player.LEVEL_PX[player.getLevel() - 1],
- true, player.getPx() - Player.LEVEL_PX[player.getLevel() - 1]
- );
+ p.edit().putInt("px", player.getPx()).apply();
+ if(levelUp)
+ xpBar.setMax(Player.LEVEL_PX[player.getLevel()] -
+ Player.LEVEL_PX[player.getLevel() - 1]);
+ pxUpdate();
+ ceUpdate();
+ pgUpdate();
+// incrementProgressBar(
+// xpBar, currentXp,
+// 1, levelUp, Player.LEVEL_PX[player.getLevel()] -
+// Player.LEVEL_PX[player.getLevel() - 1],
+// true, player.getPx() - Player.LEVEL_PX[player.getLevel() - 1]
+// );
} catch(Exception e) {
Toast.makeText(
getApplicationContext(),
@@ -167,6 +192,24 @@ public class MainActivity extends ActionBarActivity{
Toast.LENGTH_LONG
).show();
return true;
+ } else if (id == R.id.action_time_long_rest) {
+ player.rest(true);
+ Toast.makeText(
+ getApplicationContext(), R.string.long_rest_done, Toast.LENGTH_LONG
+ ).show();
+ p.edit()
+ .putInt("pg", player.getPg())
+ .putInt("curativeEfforts", player.getCurativeEfforts())
+ .apply();
+ pgUpdate();
+ ceUpdate();
+ } else if (id == R.id.action_time_rest) {
+ player.rest(false);
+ Toast.makeText(
+ getApplicationContext(), R.string.rest_done, Toast.LENGTH_LONG
+ ).show();
+ pgUpdate();
+ ceUpdate();
}
return super.onOptionsItemSelected(item);
@@ -176,8 +219,9 @@ public class MainActivity extends ActionBarActivity{
protected void onResume() {
super.onResume();
restoreData();
- healthStatusCheck();
- updateCurativeString();
+ pgUpdate();
+ ceUpdate();
+ pxUpdate();
}
public void heal(boolean usesEffort) {
@@ -196,20 +240,19 @@ public class MainActivity extends ActionBarActivity{
Toast.LENGTH_LONG
).show();
}
- SharedPreferences.Editor e = getSharedPreferences("basics", MODE_PRIVATE).edit();
+ SharedPreferences.Editor e = p.edit();
e.putInt("pg", player.getPg());
if(usesEffort) {
e.putInt("curativeEfforts", player.getCurativeEfforts());
- incrementProgressBar(
- (ProgressBar) findViewById(R.id.curativeEffortsBar),
- (TextView) findViewById(R.id.currentCurativeEfforts),
- 100, false, 0,
- true, player.getCurativeEfforts()
- );
+// incrementProgressBar(
+// curativeEffortsBar, currentCurativeEfforts,
+// 100, false, 0,
+// true, player.getCurativeEfforts()
+// );
+ ceUpdate();
}
e.apply();
- updateCurativeString();
- healthStatusCheck();
+ pgUpdate();
}
}
@@ -250,28 +293,22 @@ public class MainActivity extends ActionBarActivity{
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
- Button pg = (Button) findViewById(R.id.pgCurrent);
try {
- int preValue = Integer.parseInt(pg.getText().toString());
+ int preValue = Integer.parseInt(pgCurrent.getText().toString());
int damage = Integer.parseInt(input.getText().toString());
player.losePg(damage);
- pg.setText(
- String.valueOf(player.getPg())
- );
- incrementProgressBar(
- (ProgressBar) findViewById(R.id.pgBar),
- (TextView) findViewById(R.id.currentPg),
- 100, false, 0,
- true, player.getPg()
- );
+ pgCurrent.setText(String.valueOf(player.getPg()));
+// incrementProgressBar(
+// pgBar, currentPg,
+// 100, false, 0,
+// true, player.getPg()
+// );
//finished correctly, then apply values to undo's
undo = true;
undoPreviousValue = preValue;
undoObject = CURRENT_PG;
- getSharedPreferences("basics", MODE_PRIVATE).edit()
- .putInt("pg", player.getPg())
- .apply();
- healthStatusCheck();
+ p.edit().putInt("pg", player.getPg()).apply();
+ pgUpdate();
invalidateOptionsMenu();
} catch (Exception e) {}
}
@@ -286,23 +323,30 @@ public class MainActivity extends ActionBarActivity{
alert.show();
}
- private void healthStatusCheck() {
+ private void pgUpdate() {
int status = player.getState();
int lastState = player.getLastState();
-// ProgressBar pgBar = (ProgressBar) findViewById(R.id.pgBar);
+ int pg = player.getPg();
+ if (pg < 0) {
+ pgBar.setProgress(0);
+ negPgBar.setProgress(-pg);
+ } else if (pg > 0) {
+ pgBar.setProgress(pg);
+ negPgBar.setProgress(0);
+ } else {
+ pgBar.setProgress(0);
+ negPgBar.setProgress(0);
+ }
+ currentPg.setText(player.getPg() + " / " + player.getMaxPg());
// incrementProgressBar(
-// pgBar,
-// (TextView) findViewById(R.id.currentPg),
-// Math.abs(player.getPg()),
-// 100,
-// false,
-// CURRENT_PG
+// pgBar, currentPg,
+// 100, false, 0,
+// true, Math.abs(player.getPg())
// );
- Button pg = (Button) findViewById(R.id.pgCurrent);
- pg.setText(String.valueOf(player.getPg()));
+ pgCurrent.setText(String.valueOf(player.getPg()));
if (status == Player.MUERTO) {
- pg.setTextColor(Color.BLACK);
- pg.setBackgroundColor(Color.RED);
+ pgCurrent.setTextColor(Color.BLACK);
+ pgCurrent.setBackgroundColor(Color.RED);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(getString(R.string.reset_confirmation_title));
@@ -320,16 +364,17 @@ public class MainActivity extends ActionBarActivity{
R.string.message_death,
Toast.LENGTH_LONG
).show();
- getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
+ p.edit().clear().apply();
restoreData();
}
});
alert.show();
} else if (status == Player.DEBILITADO) {
- pg.setBackgroundColor(android.R.drawable.btn_default);
- pg.setTextColor(Color.RED);
-// pgBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
+ pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
+ pgCurrent.setTextColor(Color.RED);
+ pgBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
+ negPgBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
if(lastState != Player.SAME) {
Toast.makeText(
getApplicationContext(),
@@ -338,9 +383,10 @@ public class MainActivity extends ActionBarActivity{
).show();
}
} else if (status == Player.MALHERIDO) {
- pg.setBackgroundColor(android.R.drawable.btn_default);
- pg.setTextColor(Color.YELLOW);
-// pgBar.getProgressDrawable().setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN);
+ pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
+ pgCurrent.setTextColor(Color.YELLOW);
+ pgBar.getProgressDrawable().setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN);
+ negPgBar.getProgressDrawable().setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN);
if(lastState != Player.SAME) {
Toast.makeText(
getApplicationContext(),
@@ -349,49 +395,37 @@ public class MainActivity extends ActionBarActivity{
).show();
}
} else {
- if(player.getPg() >= player.getMaxPg())
- pg.setTextColor(Color.GREEN);
- else
- pg.setTextColor(getResources().getColor(
- R.color.abc_primary_text_material_dark
- ));
- pg.setBackgroundColor(android.R.drawable.btn_default);
-// pgBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
+ pgCurrent.setTextColor(Color.GREEN);
+ pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
+ pgBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
+ negPgBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
}
}
private void restoreData(){
- SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
- //restore state
if (!p.getBoolean("saved", false)) {
Intent intent = new Intent(this, Introduction.class);
startActivity(intent.putExtra(
"first_time",
!p.getBoolean("saved", false)
));
- while(!p.getBoolean("saved", false));
}
- if(player == null) {
+ if (player == null) {
player = new Player(
p.getString("playerName", getString(R.string.adventurer_name)),
p.getInt("classInt", Player.NULL),
p.getInt("raceInt", Player.NULL),
p.getInt("px", 0),
- new int[] {
+ 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),
+ p.getInt("car", 10)
},
new int[18],
new Power[4]);
- ((ProgressBar) findViewById(R.id.xpBar))
- .setMax(
- Player.LEVEL_PX[player.getLevel()] -
- Player.LEVEL_PX[player.getLevel() - 1]
- );
} else {
player.setName(p.getString("playerName", getString(R.string.adventurer_name)));
player.setClassInt(p.getInt("classInt", Player.NULL));
@@ -403,35 +437,40 @@ public class MainActivity extends ActionBarActivity{
p.getInt("des", 10),
p.getInt("int", 10),
p.getInt("sab", 10),
- p.getInt("car", 10),
+ p.getInt("car", 10)
});
-
}
- if(player.getMaxPg() == 0) {
+ pxUpdate();
+ xpBar.setMax(
+ Player.LEVEL_PX[player.getLevel()] -
+ Player.LEVEL_PX[player.getLevel() - 1]
+ );
+
+ if (player.getMaxPg() == 0) {
pgDialog();
}
player.setCurativeEffort(p.getInt("curativeEfforts", player.getMaxCurativeEfforts()));
player.setPg(p.getInt("pg", player.getMaxPg()));
- incrementProgressBar(
- (ProgressBar) findViewById(R.id.pgBar),
- (TextView) findViewById(R.id.currentPg),
- 100, true, player.getMaxPg(),
- true, player.getPg()
- );
- ProgressBar curativeEffortsBar = (ProgressBar) findViewById(R.id.curativeEffortsBar);
- incrementProgressBar(
- curativeEffortsBar,
- (TextView) findViewById(R.id.currentCurativeEfforts),
- 100, true, player.getMaxCurativeEfforts(),
- true, player.getCurativeEfforts()
- );
- healthStatusCheck();
- updateCurativeString();
+ pgBar.setMax(player.getMaxPg());
+ negPgBar.setMax(player.getMaxPg() / 2);
+// incrementProgressBar(
+// pgBar, currentPg,
+// 100, true, player.getMaxPg(),
+// true, player.getPg()
+// );
+ curativeEffortsBar.setMax(player.getMaxCurativeEfforts());
+// incrementProgressBar(
+// curativeEffortsBar, currentCurativeEfforts,
+// 100, true, player.getMaxCurativeEfforts(),
+// true, player.getCurativeEfforts()
+// );
+ pgUpdate();
+ ceUpdate();
//set restored values to the respective fields
((TextView) findViewById(R.id.nameText)).setText(player.getName());
((TextView) findViewById(R.id.raceText)).setText(player.getRaceName());
((TextView) findViewById(R.id.classText)).setText(player.getClassName());
- ((TextView) findViewById(R.id.lvl)).setText(String.valueOf(player.getLevel()));
+ lvl.setText(String.valueOf(player.getLevel()));
//attacks
((TextView) findViewById(R.id.FUE)).setText(
@@ -466,17 +505,25 @@ public class MainActivity extends ActionBarActivity{
((TextView) findViewById(R.id.VOL)).setText(
getString(R.string.VOL) + ": " + player.getVol()
);
-
-
}
- private void updateCurativeString() {
- ((TextView) findViewById(R.id.currentCurativeEfforts)).setText(
+ private void ceUpdate() {
+ curativeEffortsBar.setProgress(player.getCurativeEfforts());
+ currentCurativeEfforts.setText(
player.getCurativeEfforts() + " / " +
player.getMaxCurativeEfforts()
);
}
+ private void pxUpdate() {
+ xpBar.setProgress(player.getPx());
+ currentXp.setText(
+ player.getPx() + " / " +
+ Player.LEVEL_PX[player.getLevel()]
+ );
+
+ }
+
public void selectPlayer(View view) {
//TODO: implement players and switch between them
}
@@ -484,7 +531,7 @@ public class MainActivity extends ActionBarActivity{
private void undo() {
String message = "";
if(undoObject == CURRENT_PG){
- ((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(undoPreviousValue));
+ pgCurrent.setText(String.valueOf(undoPreviousValue));
player.setPg(undoPreviousValue);
undoObject = NULL;
message = getString(R.string.action_undo_current_pg);
@@ -494,6 +541,7 @@ public class MainActivity extends ActionBarActivity{
message,
Toast.LENGTH_LONG
).show();
+ pgUpdate();
undo = false;
invalidateOptionsMenu();
}
@@ -501,7 +549,6 @@ public class MainActivity extends ActionBarActivity{
private void pgDialog() {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
final EditText input = new EditText(this);
- final AlertDialog d;
input.setHint(R.string.dialog_resolve_max_pg_hint);
input.setInputType(InputType.TYPE_CLASS_NUMBER);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
@@ -530,50 +577,38 @@ public class MainActivity extends ActionBarActivity{
}
//TODO: fix the display of maxPg and levelUp
- //TODO: use this for px and curativeEfforts
//TODO: set up a partial barCommand to raise only between the ratios, then a manager, then another
//TODO: if pgBar, change color accordingly with the pg
private void incrementProgressBar(final ProgressBar progressBar, final TextView textView,
final int factor,
final boolean setMax, int max,
final boolean setVal, int end) {
+ if(factor == 1){
+ textView.setText(
+ (progressBar.getProgress() + Player.LEVEL_PX[player.getLevel() - 1])
+ + " / " +
+ (progressBar.getMax() + Player.LEVEL_PX[player.getLevel() - 1])
+ );
+ } else {
+ textView.setText(
+ (progressBar.getProgress()/factor) + " / " +
+ (progressBar.getMax()/factor)
+ );
+ }
+
if(setMax) progressBar.setMax(factor*max);
if(!setVal) return;
if(progressBar.getProgress() - end*factor == 0) return;
final Handler handler = new Handler();
- final int finalEnd = end * factor;
- final boolean negative = finalEnd < 0;
- final int time = 2000 / Math.abs(progressBar.getProgress() - finalEnd);
+ final int finalEnd = (end < 0 ? 0 : -1) * end * factor;
+ final int time = Math.max(2000 / Math.abs(progressBar.getProgress() - finalEnd), 1);
new Thread(new Runnable() {
public void run() {
int current = progressBar.getProgress();
boolean bigger = current < finalEnd;
while ((bigger && current < finalEnd) || (!bigger && current > finalEnd)) {
- if(bigger) current++;
- else current--;
-
-// if(progressBar.getId() == R.id.pgBar) {
-// double rate = (double)current / progressBar.getMax() * (negative ? -1:1);
-// if (rate <= 0) {
-// progressBar.getProgressDrawable()
-// .setColorFilter(
-// Color.RED,
-// PorterDuff.Mode.SRC_IN
-// );
-// } else if (rate <= 0.5) {
-// progressBar.getProgressDrawable()
-// .setColorFilter(
-// Color.YELLOW,
-// PorterDuff.Mode.SRC_IN
-// );
-// } else {
-// progressBar.getProgressDrawable()
-// .setColorFilter(
-// Color.GREEN,
-// PorterDuff.Mode.SRC_IN
-// );
-// }
-// }
+ if(bigger) current += 2;
+ else current -= 2;
// Update the progress bar and display the
//current value in the text view
final int finalCurrent = Math.abs(current);
@@ -601,11 +636,30 @@ public class MainActivity extends ActionBarActivity{
}
}
}).start();
-
}
//TODO: show on screen the max pg's
- //TODO: show in the bars the max and current values
- //TODO: create secondary thread to move slower the value of the progressBar
+// if(progressBar.getId() == R.id.pgBar) {
+// double rate = (double)current / progressBar.getMax() * (negative ? -1:1);
+// if (rate <= 0) {
+// progressBar.getProgressDrawable()
+// .setColorFilter(
+// Color.RED,
+// PorterDuff.Mode.SRC_IN
+// );
+// } else if (rate <= 0.5) {
+// progressBar.getProgressDrawable()
+// .setColorFilter(
+// Color.YELLOW,
+// PorterDuff.Mode.SRC_IN
+// );
+// } else {
+// progressBar.getProgressDrawable()
+// .setColorFilter(
+// Color.GREEN,
+// PorterDuff.Mode.SRC_IN
+// );
+// }
+// }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Player.java b/app/src/main/java/com/kauron/dungeonmanager/Player.java
index 5f09625..4dafd5a 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/Player.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/Player.java
@@ -86,6 +86,10 @@ public class Player {
"Religión", "Sanar", "Sigilo"
};
+ public static final int[] ABILITY_BOOST = new int[] {
+ -1, DES, CON, INT, FUE, CAR, SAB, CAR, INT, CAR, DES, SAB, SAB, SAB, CAR, INT, SAB, DES
+ };
+
/**
* Values for the current living state
*/
@@ -214,13 +218,18 @@ public class Player {
public int getRaceInt() {return raceInt;}
//TODO: implement time in the app
- public void rest(boolean length) {
- if(length) {
+ public void rest(boolean isLong) {
+ if(isLong) {
+ pg = maxPg;
curativeEfforts = maxCurativeEfforts;
- for(Power p : powers){
- if(p != null) p.recover();
- }
+ for (Power p : powers)
+ if (p != null && p.getType() == Power.DIARIO)
+ p.recover();
+ setState();
}
+ for (Power p : powers)
+ if (p != null && p.getType() == Power.ENCUENTRO)
+ p.recover();
}
public void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();}
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Power.java b/app/src/main/java/com/kauron/dungeonmanager/Power.java
index c649599..4b17d31 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/Power.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/Power.java
@@ -1,7 +1,7 @@
package com.kauron.dungeonmanager;
public class Power {
- public static final int DIARIO = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, OPORTUNIDAD = 4;
+ public static final int DIARIO = 4, A_VOLUNTAD = 2, ENCUENTRO = 3, OPORTUNIDAD = 1;
private boolean used;
private int type;
@@ -20,6 +20,9 @@ public class Power {
public boolean isUsed(){return used;}
- public void use(){used = true;}
+ public void use(){
+ if(type >= ENCUENTRO && !used)
+ used = true;
+ }
public void recover(){used = false;}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Welcome.java b/app/src/main/java/com/kauron/dungeonmanager/Welcome.java
new file mode 100644
index 0000000..bbbd06d
--- /dev/null
+++ b/app/src/main/java/com/kauron/dungeonmanager/Welcome.java
@@ -0,0 +1,58 @@
+package com.kauron.dungeonmanager;
+
+import android.content.Intent;
+import android.support.v7.app.ActionBarActivity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+
+
+public class Welcome extends ActionBarActivity {
+
+ private Button load, newChar;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_welcome);
+ newChar = (Button) findViewById(R.id.newCharacter);
+ load = (Button) findViewById(R.id.loadCharacter);
+ load.setEnabled(
+ getSharedPreferences("basics", MODE_PRIVATE).getBoolean("basics", false)
+ );
+ }
+
+ //TODO: putBoolean in the intent correctly
+ public void onNewClick(View view) {
+ startActivity(new Intent(this, Introduction.class).putExtra("first_time", true));
+ }
+
+ //TODO: get correctly the state of the saved game
+ public void onLoadClick(View view) {
+ startActivity(new Intent(this, MainActivity.class));
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_welcome, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+
+ //noinspection SimplifiableIfStatement
+ if (id == R.id.action_settings) {
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index fbe01bb..38ae614 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -131,10 +131,17 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:id="@+id/negCurativeEffortsBar"
+ android:id="@+id/negPgBar"
android:layout_weight="2"
- android:rotation="180"
- android:progress="25"/>
+ android:rotation="180"/>
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index 7884054..ce85426 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -21,21 +21,11 @@
app:showAsAction="ifRoom"
android:icon="@drawable/ic_action_time">
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 2879c5e..453e622 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -57,7 +57,6 @@
Descanso largo
Descanso corto
Turno siguiente
- Tienes %1$d de %2$d esfuerzos curativos
PX
PX del encuentro
Introduce los PX ganados
@@ -66,4 +65,8 @@
No se han podido calcular tus PG a partir de tu nivel
Atención
Por favor, escribe algo
+ Actualizar app
+ No puedes volver atrás. Para crear tu personaje pulsa el botón de guardar
+ Has descansado y restaurado todos tus poderes
+ Tus poderes de encuentro han sido restaurados
\ 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 c325a78..836b151 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -13,6 +13,8 @@
VOL
Defense
Curative efforts
+ Your encounter powers have been restored
+ All your stats have been restored
Reset
All the data has been cleared
Are you sure?
@@ -72,4 +74,9 @@
Couldn\'t compute your max PG based on your level
Update app
You can\'t go back. Fill the information and press the save button.
+ Welcome
+
+ Hello world!
+ Settings
+ New character