diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 217af47..96cc43e 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
@@ -19,5 +19,4 @@
-
-
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index e206d70..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 2cbb09b..8d2df47 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,9 +3,9 @@
-
-
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 6b63890..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 3b31283..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 59436c9..5f5255e 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,8 +3,21 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 3439f14..ccef493 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -6,5 +6,4 @@
-
-
+
\ No newline at end of file
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index c80f219..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -3,5 +3,4 @@
-
-
+
\ No newline at end of file
diff --git a/DungeonManager.iml b/DungeonManager.iml
index 0bb6048..d57aa27 100644
--- a/DungeonManager.iml
+++ b/DungeonManager.iml
@@ -1,9 +1,10 @@
-
+
+
@@ -15,5 +16,4 @@
-
-
+
\ No newline at end of file
diff --git a/app/app.iml b/app/app.iml
index d7fff0f..544d869 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -12,8 +12,9 @@
-
+
+
@@ -86,11 +87,10 @@
+
-
-
+
-
-
+
\ No newline at end of file
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
index db05457..a118c2f 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
@@ -97,7 +97,7 @@ public class Introduction extends ActionBarActivity {
}
private boolean finished() {
- SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
+ SharedPreferences p = getSharedPreferences(Welcome.PREFERENCES, MODE_PRIVATE);
SharedPreferences.Editor ed = p.edit();
String nameString = name.getText().toString().trim();
int classInt = classSpinner.getSelectedItemPosition();
diff --git a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
index 44bc860..e320026 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
@@ -19,9 +19,11 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
+import android.widget.Toast;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
+import com.nispok.snackbar.listeners.ActionClickListener;
public class MainActivity extends ActionBarActivity {
@@ -30,7 +32,6 @@ 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;
@@ -128,9 +129,7 @@ public class MainActivity extends ActionBarActivity {
boolean levelUp = player.addPx(Integer.parseInt(input.getText().toString()));
if (levelUp) {
//levelUp
- //TODO: update defenses
- //TODO: add attack points when necessary
- //TODO: improve leveling up
+ //TODO: improve leveling up by using a sliding guide
player.setMaxPgOnLevelUp();
lvl.setText(
String.valueOf(player.getLevel())
@@ -274,10 +273,21 @@ public class MainActivity extends ActionBarActivity {
undo = true;
undoPreviousValue = preValue;
undoObject = CURRENT_PG;
+ SnackbarManager.show(
+ Snackbar.with(getApplicationContext()).text("Lost " + damage + " PG's")
+ .actionLabel("Undo") // action button label
+ .actionListener(new ActionClickListener() {
+ @Override
+ public void onActionClicked(Snackbar snackbar) {
+ undo();
+ }
+ })
+ ,getParent()); // action button's
p.edit().putInt("pg", player.getPg()).apply();
pgUpdate();
invalidateOptionsMenu();
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
}
});
@@ -326,7 +336,9 @@ public class MainActivity extends ActionBarActivity {
alert.setNegativeButton(R.string.die, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
- //TODO: fix
+ //TODO: fix snackbar on death
+ Toast.makeText(getApplicationContext(),
+ R.string.message_death, Toast.LENGTH_LONG).show();
// SnackbarManager.show(
// Snackbar
// .with(this)
@@ -492,10 +504,6 @@ public class MainActivity extends ActionBarActivity {
}
- public void selectPlayer(View view) {
- //TODO: implement players and switch between them
- }
-
private void undo() {
String message = "";
if(undoObject == CURRENT_PG){
@@ -539,9 +547,9 @@ public class MainActivity extends ActionBarActivity {
input.requestFocus();
}
- //TODO: fix the display of maxPg and levelUp
- //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
+ //TODO: fix incrementeProgressBar
+ //set up a partial barCommand to raise only between the ratios, then a manager, then another
+ //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,
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Player.java b/app/src/main/java/com/kauron/dungeonmanager/Player.java
index 6d18bf0..fadc6b5 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/Player.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/Player.java
@@ -71,7 +71,8 @@ class Player {
*/
public static final int CA = 0, FORT = 1, REF = 2, VOL = 3;
- //TODO: develop abilities
+ //TODO: develop abilities like attacks, with a popup
+ //could be introduced by the player in a introduction screen, with ticks for train and bonuses
// /**
// * Values for abilities
// */
@@ -104,7 +105,7 @@ class Player {
private int classInt, raceInt;
private String name;
private int level;
- //TODO: use dice class
+ //TODO: use dice dialogs
private int[] atk, def, abilities;
//TODO: implement fully operational powers displayed as cards
private Power[] powers;
@@ -152,7 +153,6 @@ class Player {
}
}
level = LEVEL_PX.length;
- //TODO: substitute level by px and autoconvert
}
@@ -225,13 +225,13 @@ class Player {
pg = maxPg;
curativeEfforts = maxCurativeEfforts;
for (Power p : powers)
- if (p != null && p.getFrequency() == Power.DIARIO)
- p.recover();
+ if (p != null)
+ p.recover(Power.DIARIO);
setState();
}
for (Power p : powers)
- if (p != null && p.getFrequency() == Power.ENCUENTRO)
- p.recover();
+ if (p != null)
+ p.recover(Power.ENCUENTRO);
}
void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();}
@@ -250,8 +250,8 @@ class Player {
void setClass() {
if(level == 1) maxPg = atk[CON] + CLASS_STATS[INITIAL_PG][classInt];
maxCurativeEfforts = Player.getModifier(atk[CON]) + CLASS_STATS[DAILY_CURATIVE_EFFORTS][classInt];
- //TODO: fix ca bonuses!
- def[CA] = 10 + level / 2;
+ //TODO: implement armor!
+ def[CA] = 10 + level / 2 + Math.max(0, Player.getModifier(Math.max(atk[DES], atk[INT])));
def[FORT] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[FUE])) +
CLASS_STATS[DEF_FORT][classInt];
def[REF] = 10 + level / 2 + Player.getModifier(Math.max(atk[DES], atk[INT])) +
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Power.java b/app/src/main/java/com/kauron/dungeonmanager/Power.java
index 18259db..6324cbd 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/Power.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/Power.java
@@ -1,64 +1,61 @@
package com.kauron.dungeonmanager;
-class Power {
- public static final int MELEE = 1, AREA = 2, RANGED = 3;
- public static final int DIARIO = 4, A_VOLUNTAD = 2, ENCUENTRO = 3, OPORTUNIDAD = 1;
+public class Power {
+ /**frequencies*/
+ public static final int OPORTUNIDAD = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, DIARIO = 4;
+ public static final String[] FREQ = {"Nada", "Oportunidad", "A voluntad", "Encuentro", "Diario"};
+ /**actions*/
+ public static final int ESTANDAR = 1, MOVIMIENTO = 2, MENOR = 3, GRATUITA = 4;
+ public static final String[] ACTIONS = {"Nada", "Estándar", "Movimiento", "Menor", "Gratuita"};
+ /**distances*/
+ public static final int CUERPO_A_CUERPO = 1, A_DISTANCIA = 2, EXPLOSION = 3, ESTALLIDO = 4;
+ public static final String[] DISTANCES = {"Nada", "Cuerpo a cuerpo", "A distancia", "Explosión", "Estallido"};
+ /**dies
+ * They are represented by its max size
+ * 0 corresponds to [A], the weapon
+ * any other is represented by d2, d4, d6, d8, d10, d12, d20, d100
+ */
+ public static final int[] DIE = {0, 2, 4, 6, 8, 10, 12, 20, 100};
private boolean used;
- private int frequency, range, distance;
- private String name, keywords;
- private int atk, def;
- /** An array filled with the maximum damage of each die.
- * The position 0 is the damage that doesn't depend on dies.
- * Example: 1d6 + 1d4 + 4 is stored as {4, 4, 6}*/
- private int[] damage;
- //TODO: modify this so that it takes an array of the same size always, each with each kind of damage
+ private int freq, action, distance, range, objectives;
+ private String name, description;
+ private String[] keywords; //fire, spell...
+ private int atk, def; //constants from Player to denote atk and defense
+ private int[] damage; //the max sizes of the different dies
- Power(String name, int frequency, int range, int distance, String keywords, int atk, int def, int[] damage){
- this.name = name;
- this.keywords = keywords;
- this.frequency = frequency;
- this.range = range;
- this.distance = distance;
- this.atk = atk;
- this.def = def;
- this.damage = damage;
+ public Power(String name, String desc, int freq, int action, int distance, String[] keywords,
+ int atk, int def, int[] damage){
used = false;
+ this.name = name; this.description = desc;
+ this.freq = freq; this.action = action;
+ this.distance = distance;
+
}
- String getName(){return name;}
- int getFrequency() {return frequency;}
- String getFrequencyString(){
- //TODO: change lists to arrays in resources
- switch(frequency) {
- case 1: return "Oportunidad";
- case 2: return "A voluntad";
- case 3: return "Encuentro";
- case 4: return "Diario";
- default: return null;
- }
- }
- int getRange() {return range;}
- String getRangeString() {
- switch(range){
- case 1: return "Cuerpo a cuerpo";
- case 2: return "Área";
- case 3: return "A distancia";
- default: return null;
- }
- }
- int getDistance() {return distance;}
- String getKeywords() {return keywords;}
- int getAtk() {return atk;}
- int getDef() {return def;}
- int[] getDamage() {return damage;}
+ public String getName(){return name;}
+ public String getDescription() {return description;}
boolean isUsed(){return used;}
- void use(){
- if(frequency >= ENCUENTRO && !used)
- used = true;
+ public boolean use(){
+ if (!used) {
+ if (freq >= ENCUENTRO) used = true;
+ return true;
+ } else {return false;}
+ }
+
+ public int rollAttack() {return atk + (int)(Math.random()*20) + 1;}
+ public int rollDamage() {
+ int roll = 0;
+ for(int i : damage) {
+ roll += (int)(Math.random()*i + 1);
+ }
+ return roll;
+ }
+
+ public void recover(int type){
+ if(this.freq <= type) used = false;
}
- void recover(){used = false;}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_introduction.xml b/app/src/main/res/layout/activity_introduction.xml
index 9b8643b..3af7ebe 100644
--- a/app/src/main/res/layout/activity_introduction.xml
+++ b/app/src/main/res/layout/activity_introduction.xml
@@ -48,6 +48,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/classSpinner"
+ tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" />
+ tools:listitem="@android:layout/simple_spinner_dropdown_item"
+ android:spinnerMode="dropdown" />
+
+
+
+
+
+
+