1
0
Fork 0

Refactored the naming to proper English

This commit is contained in:
Carlos Galindo 2015-04-29 13:58:38 +02:00
parent 3fc3dbdd37
commit cc86ecc276
45 changed files with 626 additions and 920 deletions

View file

@ -1,6 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="Carlos">
<words>
<w>dungeoneering</w>
<w>snackbar</w>
</words>
</dictionary>

View file

@ -13,7 +13,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -2,34 +2,29 @@ package com.kauron.dungeonmanager;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import java.io.Serializable;
class Player implements Serializable {
public static final String NAME = "playerName", CLASS = "classInt", RACE = "raceInt", PX = "px";
public static final String NAME = "playerName", CLASS = "classInt", RACE = "raceInt", XP = "px";
/**
* Names for the classes
*/
public static final String[] CLASS_STRINGS = {
"Clase", "Ardiente", "Brujo", "Buscador", "Clérigo", "Explorador",
"Guerrero", "Mago", "Mente de Batalla", "Monje", "Paladín", "Pícaro", "Psiónico",
"Sacerdote Rúnico", "Señor de la guerra"
};
public static String[] CLASS_STRINGS;
// "Clase", "Ardiente", "Brujo", "Buscador", "Clérigo", "Explorador",
// "Guerrero", "Mago", "Mente de Batalla", "Monje", "Paladín", "Pícaro", "Psiónico",
// "Sacerdote Rúnico", "Señor de la guerra"
public static final int NULL = 0;
// /**
// * Values for classes
// */
// public static final int ARDIENTE = 1, BRUJO = 2, BUSCADOR = 3, CLÉRIGO = 4,
// EXPLORADOR = 5, GUERRERO = 6, MAGO = 7, MENTE_DE_BATALLA = 8, MONJE = 9, PALADÍN = 10,
// PÍCARO = 11, PSIÓNICO = 12, SACERDOTE_RÚNICO = 13, SEÑOR_DE_LA_GUERRA = 14;
/**
* Values for level - px computation
* Values for level - xp computation
*/
public static final int[] LEVEL_PX = new int[]{
public static final int[] LEVEL_XP = new int[]{
0, 1000, 2250, 3750, 5500, 7500, 10000, 13000, 16500, 20500, 26000,
32000, 39000, 47000, 57000, 69000, 83000, 99000, 119000, 143000, 175000,
210000, 255000, 310000, 375000, 450000, 550000, 675000, 825000, 1000000
@ -39,13 +34,13 @@ class Player implements Serializable {
* Values for each class' characteristics
*/
public static final int[][] CLASS_STATS = new int[][] {
//pg on level up
//hp on level up
{0, 5, 5, 5, 5, 5, 6, 4, 6, 5, 6, 5, 4, 5, 5},
//defenses bonus: fort, ref, vol
//defenses bonus: fort, ref, will
{0, 1, 0, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 0, 1},
{0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 2, 0, 0, 0},
{0, 1, 1, 1, 2, 0, 0, 2, 2, 1, 1, 0, 2, 2, 1},
//initial pg bonus
//initial hp bonus
{0,12,12,12,12,12,15,10,15,12,15,12,12,12,12},
//daily curative efforts
{0, 7, 6, 7, 7, 6, 9, 6, 9, 7,10, 6, 6, 7, 7}
@ -54,58 +49,51 @@ class Player implements Serializable {
/**
* Identifiers for each class characteristic
*/
public static final int PG_ON_LEVEL_UP = 0, DEF_FORT = 1, DEF_REF = 2, DEF_VOL = 3,
INITIAL_PG = 4, DAILY_CURATIVE_EFFORTS = 5;
public static final int HP_ON_LEVEL_UP = 0, DEF_FORT = 1, DEF_REF = 2, DEF_WILL = 3,
INITIAL_HP = 4, DAILY_SURGES = 5;
/**
* Names for the races
*/
public static final String[] RACE_STRINGS = new String[] {
"Raza", "Dracónido", "Eladrín", "Elfo", "Enano", "Gitzherai", "Humano", "Mediano",
"Mente del Fragmento", "Minotauro", "Salvaje", "Semielfo", "Tiflin"
};
public static String[] RACE_STRINGS;
// "Raza", "Dracónido", "Eladrín", "Elfo", "Enano", "Gitzherai", "Humano", "Mediano",
// "Mente del Fragmento", "Minotauro", "Salvaje", "Semielfo", "Tiflin"
/**
* Values for attack
*/
public static final int FUE = 0, CON = 1, DES = 2, INT = 3, SAB = 4, CAR = 5;
public static final int STR = 0, CON = 1, DEX = 2, INT = 3, WIS = 4, CHA = 5;
/**
* Values for defenses
*/
public static final int CA = 0, FORT = 1, REF = 2, VOL = 3;
public static final int AC = 0, FORT = 1, REF = 2, WILL = 3;
//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
// */
// public static final int ACROBACIAS = 1, AGUANTE = 2, ARCANOS = 3, ATLETISMO = 4, DIPLOMACIA = 5,
// DUNGEONS = 6, ENGAÑAR = 7, HISTORIA = 8, HURTO = 9, INTIMIDAR = 10, NATURALEZA = 11,
// PERCEPCIÓN = 12, PERSPICACIA = 13, RECURSOS = 14, RELIGIÓN = 15, SANAR = 16, SIGILO = 17;
/**
* Names for the abilities
*/
public static final String[] ABILITY_STRING = new String[] {
public static String[] ABILITY_STRING = new String[] {
"Habilidades", "Acrobacias", "Aguante", "Arcanos", "Atletismo", "Diplomacia", "Dungeons", "Engañar",
"Historia", "Hurto", "Intimidar", "Naturaleza", "Percepción", "Perspicacia", "Recursos",
"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
-1, DEX, CON, INT, STR, CHA, WIS, CHA, INT, CHA, DEX, WIS, WIS, WIS, CHA, INT, WIS, DEX
};
/**
* Values for the current living state
*/
public static final int OK = 1, MALHERIDO = 2, DEBILITADO = 3, MUERTO = 4, SAME = 5,
public static final int OK = 1, BLOODIED = 2, DYING = 3, DEAD = 4, SAME = 5,
USE_CURATIVE_EFFORT = -1, CURED = 1, NOT_CURED = 0, MAXED = -1;
private int pg, maxPg, px;
private int hp, maxHp, xp;
private int state, lastState;
private int curativeEfforts, maxCurativeEfforts;
private int surges, maxSurges;
private int classInt, raceInt;
private String name;
private int level;
@ -118,7 +106,7 @@ class Player implements Serializable {
*/
Player (SharedPreferences p) {
this.name = p.getString(NAME, "Player");
this.px = p.getInt(PX, 0);
this.xp = p.getInt(XP, 0);
setLevel();
this.raceInt = p.getInt(RACE, 0);
this.classInt = p.getInt(CLASS, 0);
@ -132,66 +120,73 @@ class Player implements Serializable {
p.getInt("car", 10)}
);
setState();
this.pg = p.getInt( "pg" , maxPg);
this.curativeEfforts = p.getInt( "curativeEfforts" , maxCurativeEfforts );
this.hp = p.getInt( "pg" , maxHp);
this.surges = p.getInt( "curativeEfforts" , maxSurges);
}
int getPx() {return px;}
void setPx (int px) {this.px = px; setLevel();}
boolean addPx(int px) {
public static void setStrings ( Resources res ) {
CLASS_STRINGS = res.getStringArray(R.array.classes);
RACE_STRINGS = res.getStringArray(R.array.races);
ABILITY_STRING = res.getStringArray(R.array.abilities);
}
int getXp() {return xp;}
void setXp(int xp) {this.xp = xp; setLevel();}
boolean addPx(int xp) {
int lastLevel = level;
setPx(this.px + px);
setXp(this.xp + xp);
return lastLevel < level;
}
int getMaxCurativeEfforts() {return maxCurativeEfforts;}
void setMaxCurativeEfforts(int maxCurativeEfforts) {this.maxCurativeEfforts = maxCurativeEfforts;}
int getMaxSurges() {return maxSurges;}
void setMaxSurges(int maxSurges) {this.maxSurges = maxSurges;}
int getCurativeEfforts() {return curativeEfforts;}
void setCurativeEffort(int curativeEfforts) {this.curativeEfforts = curativeEfforts;}
int getSurges() {return surges;}
void setCurativeEffort(int surges) {this.surges = surges;}
int getLevel() {return level;}
void setLevel() {
for (int i = 0; i < LEVEL_PX.length; i++)
if(px < LEVEL_PX[i]) {level = i; return;}
level = LEVEL_PX.length;
for (int i = 0; i < LEVEL_XP.length; i++)
if(xp < LEVEL_XP[i]) {level = i; return;}
level = LEVEL_XP.length;
}
int getMaxPg() {return maxPg;}
void setMaxPg(int maxPg) {
if(this.maxPg == 0)
this.pg = maxPg;
this.maxPg = maxPg;
int getMaxHp() {return maxHp;}
void setMaxHp(int maxHp) {
if(this.maxHp == 0)
this.hp = maxHp;
this.maxHp = maxHp;
}
int getPg() {return pg;}
void setPg(int pg) {this.pg = pg; setState();}
int getHp() {return hp;}
void setHp(int hp) {this.hp = hp; setState();}
void losePg(int damage) {
pg -= damage;
hp -= damage;
setState();
}
int recoverPg(int recovered, boolean uses) {
if(recovered == USE_CURATIVE_EFFORT){
if(uses && curativeEfforts <= 0) return NOT_CURED;
if(uses && surges <= 0) return NOT_CURED;
else {
if(uses && pg < maxPg) curativeEfforts--;
if (pg < 0) {
pg = 0;
if(uses && hp < maxHp) surges--;
if (hp < 0) {
hp = 0;
} else {
pg += maxPg / 4;
hp += maxHp / 4;
}
}
} else {
if (pg < 0) {
pg = 0;
if (hp < 0) {
hp = 0;
} else {
pg += recovered;
hp += recovered;
}
}
setState();
if (pg > maxPg) {pg = maxPg; return MAXED;}
if (hp > maxHp) {
hp = maxHp; return MAXED;}
return CURED;
}
@ -200,9 +195,9 @@ class Player implements Serializable {
int getState() {return state;}
private void setState() {
lastState = state;
if (pg <= maxPg / -2) state = MUERTO;
else if (pg <= 0) state = DEBILITADO;
else if(pg <= maxPg / 2) state = MALHERIDO;
if (hp <= maxHp / -2) state = DEAD;
else if (hp <= 0) state = DYING;
else if(hp <= maxHp / 2) state = BLOODIED;
else state = OK;
}
@ -212,51 +207,51 @@ class Player implements Serializable {
private void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();}
int getFue() {return atk[FUE];}
int getFue() {return atk[STR];}
int getCon() {return atk[CON];}
int getSab() {return atk[SAB];}
int getCar() {return atk[CAR];}
int getDes() {return atk[DES];}
int getSab() {return atk[WIS];}
int getCar() {return atk[CHA];}
int getDes() {return atk[DEX];}
int getInt() {return atk[INT];}
int getCa() {return def[CA];}
int getCa() {return def[AC];}
int getFort() {return def[FORT];}
int getRef() {return def[REF];}
int getVol() {return def[VOL];}
int getVol() {return def[WILL];}
private void setClass() {
maxPg = atk[CON] + CLASS_STATS[INITIAL_PG][classInt]
+ ( level - 1 ) * CLASS_STATS[PG_ON_LEVEL_UP][classInt];
maxCurativeEfforts =
Player.getModifier(atk[CON]) + CLASS_STATS[DAILY_CURATIVE_EFFORTS][classInt];
maxHp = atk[CON] + CLASS_STATS[INITIAL_HP][classInt]
+ ( level - 1 ) * CLASS_STATS[HP_ON_LEVEL_UP][classInt];
maxSurges =
Player.getModifier(atk[CON]) + CLASS_STATS[DAILY_SURGES][classInt];
//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])) +
def[AC] = 10 + level / 2 + Math.max(0, Player.getModifier(Math.max(atk[DEX], atk[INT])));
def[FORT] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[STR])) +
CLASS_STATS[DEF_FORT][classInt];
def[REF] = 10 + level / 2 + Player.getModifier(Math.max(atk[DES], atk[INT])) +
def[REF] = 10 + level / 2 + Player.getModifier(Math.max(atk[DEX], atk[INT])) +
CLASS_STATS[DEF_REF][classInt];
def[VOL] = 10 + level / 2 + Player.getModifier(Math.max(atk[CAR], atk[SAB])) +
CLASS_STATS[DEF_VOL][classInt];
def[WILL] = 10 + level / 2 + Player.getModifier(Math.max(atk[CHA], atk[WIS])) +
CLASS_STATS[DEF_WILL][classInt];
}
static int getModifier(int i) {
return i / 2 - 5;
}
int getStatusColor(Context context) {
if (pg > maxPg / 2)
return context.getResources().getColor(R.color.green);
else if (pg > 0)
return context.getResources().getColor(R.color.yellow);
else if (pg > - maxPg / 2)
return context.getResources().getColor(R.color.red);
int getStatusColor(Resources res) {
if (hp > maxHp / 2)
return res.getColor(R.color.green);
else if (hp > 0)
return res.getColor(R.color.yellow);
else if (hp > -maxHp / 2)
return res.getColor(R.color.red);
else
return context.getResources().getColor(R.color.black);
return res.getColor(R.color.black);
}
void rest (boolean isLong) {
if ( isLong ) {
pg = maxPg;
curativeEfforts = maxCurativeEfforts;
hp = maxHp;
surges = maxSurges;
}
//TODO: here implement action points!
}

View file

@ -1,8 +1,6 @@
package com.kauron.dungeonmanager;
import android.content.Context;
import android.graphics.AvoidXfermode;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.view.LayoutInflater;
import android.view.View;
@ -28,23 +26,23 @@ class PlayerAdapter extends ArrayAdapter<Player> {
if ( player != null ) {
((TextView) mView.findViewById(R.id.name)).setText(player.getName());
((TextView) mView.findViewById(R.id.other)).setText(player.getClassName() + " " + player.getRaceName());
((TextView) mView.findViewById(R.id.level))
((TextView) mView.findViewById(R.id.class_and_race)).setText(player.getClassName() + " " + player.getRaceName());
((TextView) mView.findViewById(R.id.levelText))
.setText(
getContext().getResources().getString(R.string.level) + " " + player.getLevel()
);
int pg = player.getPg();
int maxPg = player.getMaxPg();
ProgressBar neg = (ProgressBar) mView.findViewById(R.id.negPgBar);
ProgressBar pos = (ProgressBar) mView.findViewById(R.id.pgBar);
int hp = player.getHp();
int maxHp = player.getMaxHp();
ProgressBar neg = (ProgressBar) mView.findViewById(R.id.negative_hp_bar);
ProgressBar pos = (ProgressBar) mView.findViewById(R.id.positive_hp_bar);
neg.setMax(maxPg / 2);
pos.setMax(maxPg);
neg.setMax(maxHp / 2);
pos.setMax(maxHp);
neg.setProgress(pg < 0 ? -pg : 0);
pos.setProgress(pg > 0 ? pg : 0);
neg.setProgress(hp < 0 ? -hp : 0);
pos.setProgress(hp > 0 ? hp : 0);
int color = player.getStatusColor(getContext());
int color = player.getStatusColor(getContext().getResources());
neg.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
pos.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}

View file

@ -11,8 +11,8 @@ public class PlayerDBHandler extends SQLiteOpenHelper {
public static final String TABLE_PLAYERS = "players";
public static final String C_ID="_id", C_NAME="name", C_CLASS="class", C_RACE="race";
public static final String C_PG="pg", C_PG_MAX="pgMax", C_SURGES="surges", C_SURGES_MAX="surgesMax";
public static final String C_PX = "px", C_ATK = "atk", C_ABILITY = "ability", C_POWER_ID="powerID";
public static final String C_HP ="hp", C_HP_MAX ="hpMax", C_SURGES="surges", C_SURGES_MAX="surgesMax";
public static final String C_XP = "px", C_ATK = "atk", C_ABILITY = "ability", C_POWER_ID="powerID";
//TODO: complete class and implement database to save the players instead of sharedprefs
//TODO: not using it at the moment

View file

@ -18,7 +18,7 @@ import com.nispok.snackbar.SnackbarManager;
public class PlayerEditor extends ActionBarActivity {
private EditText name, level;
private EditText fue, con, des, sab, intel, car;
private EditText str, con, dex, wis, intel, cha;
private Spinner classSpinner, raceSpinner;
@Override
@ -30,15 +30,15 @@ public class PlayerEditor extends ActionBarActivity {
setSupportActionBar(toolbar);
getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
name = (EditText) findViewById(R.id.editNameIntro);
name = (EditText) findViewById(R.id.namePlayerEdit);
name.requestFocus();
level = (EditText) findViewById(R.id.editPxIntro);
fue = (EditText) findViewById(R.id.FUE);
level = (EditText) findViewById(R.id.xpEdit);
str = (EditText) findViewById(R.id.STR);
con = (EditText) findViewById(R.id.CON);
des = (EditText) findViewById(R.id.DES);
sab = (EditText) findViewById(R.id.SAB);
dex = (EditText) findViewById(R.id.DEX);
wis = (EditText) findViewById(R.id.WIS);
intel = (EditText) findViewById(R.id.INT);
car = (EditText) findViewById(R.id.CAR);
cha = (EditText) findViewById(R.id.CHA);
classSpinner = (Spinner) findViewById(R.id.classSpinner);
classSpinner.setAdapter(
@ -108,74 +108,59 @@ public class PlayerEditor extends ActionBarActivity {
pxInt = Integer.parseInt(level.getText().toString());
int fue = 0, con = 0, des = 0, intel = 0, sab = 0, car = 0;
if (!this.car.getText().toString().isEmpty())
car = Integer.parseInt(this.car.getText().toString());
if (!this.fue.getText().toString().isEmpty())
fue = Integer.parseInt(this.fue.getText().toString());
if (!this.cha.getText().toString().isEmpty())
car = Integer.parseInt(this.cha.getText().toString());
if (!this.str.getText().toString().isEmpty())
fue = Integer.parseInt(this.str.getText().toString());
if (!this.con.getText().toString().isEmpty())
con = Integer.parseInt(this.con.getText().toString());
if (!this.des.getText().toString().isEmpty())
des = Integer.parseInt(this.des.getText().toString());
if (!this.dex.getText().toString().isEmpty())
des = Integer.parseInt(this.dex.getText().toString());
if (!this.intel.getText().toString().isEmpty())
intel = Integer.parseInt(this.intel.getText().toString());
if (!this.sab.getText().toString().isEmpty())
sab = Integer.parseInt(this.sab.getText().toString());
if (!this.wis.getText().toString().isEmpty())
sab = Integer.parseInt(this.wis.getText().toString());
// if(first) {
if (
!nameString.isEmpty() &&
classInt != Player.NULL &&
raceInt != Player.NULL &&
pxInt != -1 &&
car != 0 &&
fue != 0 &&
con != 0 &&
des != 0 &&
intel != 0 &&
sab != 0
) {
SharedPreferences p = getSharedPreferences(Welcome.PREFERENCES, MODE_PRIVATE);
int i = p.getInt("players", 0);
String saveName = nameString;
for (int j = 0; j < i; j++) {
if (p.getString("player" + j, "").equals(saveName))
saveName += "2";
}
p.edit().putString("player" + i, saveName).putInt("players", i + 1).apply();
SharedPreferences.Editor ed = getSharedPreferences(saveName, MODE_PRIVATE).edit();
//first save it all
ed.putString("playerName", nameString);
ed.putInt("classInt", classInt);
ed.putInt("raceInt", raceInt);
ed.putInt("px", pxInt);
ed.putInt("fue", fue);
ed.putInt("car", car);
ed.putInt("int", intel);
ed.putInt("sab", sab);
ed.putInt("con", con);
ed.putInt("des", des);
//TEMP
ed.putBoolean("new", true);
ed.apply();
} else {
return false;
if (
!nameString.isEmpty() &&
classInt != Player.NULL &&
raceInt != Player.NULL &&
pxInt != -1 &&
car != 0 &&
fue != 0 &&
con != 0 &&
des != 0 &&
intel != 0 &&
sab != 0
) {
SharedPreferences p = getSharedPreferences(Welcome.PREFERENCES, MODE_PRIVATE);
int i = p.getInt("players", 0);
String saveName = nameString;
for (int j = 0; j < i; j++) {
if (p.getString("player" + j, "").equals(saveName))
saveName += "2";
}
// } else {
// 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 != -1) ed.putInt("px", pxInt);
//
// if (fue != 0) ed.putInt("fue", fue);
// if (car != 0) ed.putInt("car", car);
// if (intel != 0) ed.putInt("int", intel);
// if (sab != 0) ed.putInt("sab", sab);
// if (con != 0) ed.putInt("con", con);
// if (des != 0) ed.putInt("des", des);
// }
p.edit().putString("player" + i, saveName).putInt("players", i + 1).apply();
SharedPreferences.Editor ed = getSharedPreferences(saveName, MODE_PRIVATE).edit();
return true;
//first save it all
ed.putString("playerName", nameString);
ed.putInt("classInt", classInt);
ed.putInt("raceInt", raceInt);
ed.putInt("px", pxInt);
ed.putInt("fue", fue);
ed.putInt("car", car);
ed.putInt("int", intel);
ed.putInt("sab", sab);
ed.putInt("con", con);
ed.putInt("des", des);
//TEMP
ed.putBoolean("new", true);
ed.apply();
return true;
} else {
return false;
}
}
}

View file

@ -2,20 +2,22 @@ package com.kauron.dungeonmanager;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.content.res.Resources;
import java.io.Serializable;
class Power implements Serializable{
/**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"};
public static final int AT_WILL = 2, ENCOUNTER = 3, DAILY = 4;
/*{"Nada", "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"};
public static final int STANDARD = 1, MOVEMENT = 2, MINOR = 3, FREE = 4;
/*{"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"};
public static final int MELEE = 1, RANGED = 2, EXPLOSION = 3, AREA = 4, CLOSE = 5, AURA = 6;
/* {"Nada", "Cuerpo a cuerpo", "A distancia", "Explosión", "Estallido"};*/
public static String[] RANGES, ACTIONS, FREQ, ATK, DEF, ATTACK, DEFENSE;
/**dies
* They are represented by its max size
* 0 corresponds to [A], the weapon
@ -45,11 +47,21 @@ class Power implements Serializable{
this.action = p.getInt("i4", 0);
}
static void setStrings(Resources res) {
FREQ = res.getStringArray(R.array.frequencies);
ACTIONS = res.getStringArray(R.array.actions);
RANGES = res.getStringArray(R.array.ranges);
ATK = res.getStringArray(R.array.atk);
DEF = res.getStringArray(R.array.def);
ATTACK = res.getStringArray(R.array.attack);
DEFENSE = res.getStringArray(R.array.defense);
}
String getKeywords() {return keywords;}
String getTypeString() {return ACTIONS[action];}
String getFrequencyString() {return FREQ[freq];}
String getRangeString() {return DISTANCES[range];}
String getRangeString() {return RANGES[range];}
int getAtk() {return atk;}
int getDef() {return def;}
@ -67,7 +79,7 @@ class Power implements Serializable{
boolean use(){
if (!used) {
if (freq >= ENCUENTRO) used = true;
if (freq >= ENCOUNTER) used = true;
return true;
} else {return false;}
}
@ -80,9 +92,9 @@ class Power implements Serializable{
int getFreqColor(Context context) {
switch (freq) {
case DIARIO:
case DAILY:
return context.getResources().getColor(R.color.daily);
case ENCUENTRO:
case ENCOUNTER:
return context.getResources().getColor(R.color.encounter);
default:
return context.getResources().getColor(R.color.at_will);

View file

@ -1,43 +1,30 @@
package com.kauron.dungeonmanager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import com.nispok.snackbar.listeners.ActionClickListener;
import java.io.File;
import java.util.ArrayList;
class AttackAdapter extends ArrayAdapter<Power> {
AttackAdapter(Context context, ArrayList<Power> powers) {
super(context, R.layout.attack_row, powers);
class PowerAdapter extends ArrayAdapter<Power> {
PowerAdapter(Context context, ArrayList<Power> powers) {
super(context, R.layout.power_row, powers);
}
@Override
public View getView(final int position, final View convertView, ViewGroup parent) {
LayoutInflater mInflater = LayoutInflater.from(getContext());
View mView = mInflater.inflate(R.layout.attack_row, parent, false);
View mView = mInflater.inflate(R.layout.power_row, parent, false);
final Power attack = getItem(position);
if ( attack != null ) {
((TextView) mView.findViewById(R.id.name)).setText(attack.getName());
((TextView) mView.findViewById(R.id.keywords)).setText(attack.getKeywords());
((TextView) mView.findViewById(R.id.frequency)).setText(attack.getFrequencyString());
((TextView) mView.findViewById(R.id.extra)).setText(attack.getRangeString() + " " + attack.getDistance());
((TextView) mView.findViewById(R.id.range_and_distance)).setText(attack.getRangeString() + " " + attack.getDistance());
mView.setBackgroundColor(attack.getFreqColor(getContext()));
if (attack.isUsed())
mView.getBackground().setAlpha(0);

View file

@ -2,7 +2,6 @@ package com.kauron.dungeonmanager;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
@ -14,8 +13,6 @@ import android.widget.Spinner;
public class PowerEditor extends ActionBarActivity {
public static final String NAME="name", FREQ="freq", KEYWORDS="keywords", RANGE="range", DISTANCE="distance";
private EditText [] edits = new EditText[5];
private Spinner [] spinners = new Spinner[5];
@ -53,7 +50,7 @@ public class PowerEditor extends ActionBarActivity {
new ArrayAdapter<>(
this,
android.R.layout.simple_spinner_dropdown_item,
getResources().getStringArray(R.array.freq_array)
Power.FREQ
)
);
spinners[1] = (Spinner) findViewById(R.id.rangeSpinner);
@ -61,7 +58,7 @@ public class PowerEditor extends ActionBarActivity {
new ArrayAdapter<>(
this,
android.R.layout.simple_spinner_dropdown_item,
getResources().getStringArray(R.array.ranges_array)
Power.RANGES
)
);
spinners[2] = (Spinner) findViewById(R.id.atkSpinner);
@ -69,7 +66,7 @@ public class PowerEditor extends ActionBarActivity {
new ArrayAdapter<>(
this,
android.R.layout.simple_spinner_dropdown_item,
getResources().getStringArray(R.array.atk_array)
Power.ATK
)
);
spinners[3] = (Spinner) findViewById(R.id.defSpinner);
@ -77,26 +74,26 @@ public class PowerEditor extends ActionBarActivity {
new ArrayAdapter<>(
this,
android.R.layout.simple_spinner_dropdown_item,
getResources().getStringArray(R.array.def_array)
Power.DEF
)
);
spinners[4] = (Spinner) findViewById(R.id.actionTypeSpinner);
spinners[4] = (Spinner) findViewById(R.id.actionSpinner);
spinners[4].setAdapter(
new ArrayAdapter<>(
this,
android.R.layout.simple_spinner_dropdown_item,
getResources().getStringArray(R.array.actions_array)
Power.ACTIONS
)
);
background = spinners[0].getBackground();
if (power != -1) {
SharedPreferences pp = getSharedPreferences(p.getString("power" + power, ""), MODE_PRIVATE);
SharedPreferences powerPrefs = getSharedPreferences(p.getString("power" + power, ""), MODE_PRIVATE);
for ( int i = 0; i < spinners.length; i++ )
spinners[i].setSelection(pp.getInt("i" + i, 0));
spinners[i].setSelection(powerPrefs.getInt("i" + i, 0));
for ( int i = 0; i < edits.length; i++ )
edits[i].setText(pp.getString("s" + i, ""));
edits[i].setText(powerPrefs.getString("s" + i, ""));
originalName = edits[0].getText().toString();
}

View file

@ -40,16 +40,15 @@ public class ShowPlayer extends ActionBarActivity {
public Player player;
private boolean undo;
//TODO: fix undo (show snackbar with button in each case, without timing).
private int undoObject, undoPreviousValue;
private ProgressBar posPgBar, negPgBar, xpBar, curativeEffortsBar;
private TextView currentPg, currentXp, currentCurativeEfforts, level;
private ProgressBar posHpBar, negHpBar, xpBar, surgesBar;
private TextView hpText, xpText, surgesText, levelText;
private SharedPreferences p;
private Toolbar toolbar;
private ListView attackList;
private ListView powerList;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -70,19 +69,19 @@ public class ShowPlayer extends ActionBarActivity {
}
//Performing all the findViewById commands
xpBar = (ProgressBar) findViewById(R.id.xpBar);
curativeEffortsBar = (ProgressBar) findViewById(R.id.curativeEffortsBar);
posPgBar = (ProgressBar) findViewById(R.id.pgBar);
negPgBar = (ProgressBar) findViewById(R.id.negPgBar);
xpBar = (ProgressBar) findViewById(R.id.xpBar);
surgesBar = (ProgressBar) findViewById(R.id.surgesBar);
posHpBar = (ProgressBar) findViewById(R.id.positive_hp_bar);
negHpBar = (ProgressBar) findViewById(R.id.negative_hp_bar);
currentPg = (TextView) findViewById(R.id.currentPg);
currentXp = (TextView) findViewById(R.id.currentXp);
currentCurativeEfforts = (TextView) findViewById(R.id.currentCurativeEfforts);
level = (TextView) findViewById(R.id.level);
hpText = (TextView) findViewById(R.id.hpText);
xpText = (TextView) findViewById(R.id.xpText);
surgesText = (TextView) findViewById(R.id.surgesText);
levelText = (TextView) findViewById(R.id.levelText);
xpBar.getProgressDrawable()
.setColorFilter(getResources().getColor(R.color.px_bar), PorterDuff.Mode.SRC_IN);
curativeEffortsBar.getProgressDrawable()
surgesBar.getProgressDrawable()
.setColorFilter(getResources().getColor(R.color.surges_bar), PorterDuff.Mode.SRC_IN);
undo = false;
@ -100,7 +99,7 @@ public class ShowPlayer extends ActionBarActivity {
@Override
public boolean onPrepareOptionsMenu (Menu menu) {
MenuItem menuHeal = menu.findItem(R.id.action_cure);
boolean maxed = player.getPg() == player.getMaxPg();
boolean maxed = player.getHp() == player.getMaxHp();
menuHeal.setEnabled(!maxed);
if (maxed)
menuHeal.getIcon().setAlpha(128);
@ -112,10 +111,10 @@ public class ShowPlayer extends ActionBarActivity {
private void addPx(EditText input) {
try {
if (player.addPx(Integer.parseInt(input.getText().toString()))) levelUp();
p.edit().putInt("px", player.getPx()).apply();
pxUpdate();
ceUpdate();
pgUpdate();
p.edit().putInt("px", player.getXp()).apply();
xpUpdate();
surgeUpdate();
hpUpdate();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "There was an error leveling up", Toast.LENGTH_LONG).show();
}
@ -130,7 +129,7 @@ public class ShowPlayer extends ActionBarActivity {
//noinspection SimplifiableIfStatement
if (id == R.id.action_cure) {
if(player.getMaxPg() <= player.getPg()){
if(player.getMaxHp() <= player.getHp()){
SnackbarManager.show(
Snackbar
.with(this)
@ -167,23 +166,22 @@ public class ShowPlayer extends ActionBarActivity {
alert.setNegativeButton(R.string.level_up, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
player.setPx(Player.LEVEL_PX[player.getLevel()]);
player.setXp(Player.LEVEL_XP[player.getLevel()]);
levelUp();
p.edit().putInt(Player.PX, player.getPx()).apply();
pxUpdate();
p.edit().putInt(Player.XP, player.getXp()).apply();
xpUpdate();
}
});
alert.show();
input.requestFocus();
return true;
//TODO: TEST fix restoring powers
} else if (id == R.id.action_time_long_rest) {
AttackAdapter attackAdapter = (AttackAdapter)attackList.getAdapter();
if (attackAdapter != null) {
for (int i = 0; i < attackAdapter.getCount(); i++) {
Power power = attackAdapter.getItem(i);
if ( power.getFreq() != Power.A_VOLUNTAD ) {
power.recover(Power.DIARIO);
PowerAdapter powerAdapter = (PowerAdapter) powerList.getAdapter();
if (powerAdapter != null) {
for (int i = 0; i < powerAdapter.getCount(); i++) {
Power power = powerAdapter.getItem(i);
if ( power.getFreq() != Power.AT_WILL) {
power.recover(Power.DAILY);
getSharedPreferences(p.getString("power" + i, ""), MODE_PRIVATE)
.edit().putBoolean("used", false);
}
@ -199,18 +197,18 @@ public class ShowPlayer extends ActionBarActivity {
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
);
p.edit()
.putInt("pg", player.getPg())
.putInt("curativeEfforts", player.getCurativeEfforts())
.putInt("pg", player.getHp())
.putInt("curativeEfforts", player.getSurges())
.apply();
pgUpdate();
ceUpdate();
hpUpdate();
surgeUpdate();
} else if (id == R.id.action_time_rest) {
AttackAdapter attackAdapter = (AttackAdapter) attackList.getAdapter();
if (attackAdapter != null) {
for (int i = 0; i < attackAdapter.getCount(); i++) {
Power power = attackAdapter.getItem(i);
if ( power.getFreq() == Power.ENCUENTRO) {
power.recover(Power.ENCUENTRO);
PowerAdapter powerAdapter = (PowerAdapter) powerList.getAdapter();
if (powerAdapter != null) {
for (int i = 0; i < powerAdapter.getCount(); i++) {
Power power = powerAdapter.getItem(i);
if ( power.getFreq() == Power.ENCOUNTER) {
power.recover(Power.ENCOUNTER);
getSharedPreferences(p.getString("power" + i, ""), MODE_PRIVATE)
.edit().putBoolean("used", false);
}
@ -224,8 +222,8 @@ public class ShowPlayer extends ActionBarActivity {
.text(R.string.rest_done)
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
);
pgUpdate();
ceUpdate();
hpUpdate();
surgeUpdate();
}
return super.onOptionsItemSelected(item);
@ -233,17 +231,17 @@ public class ShowPlayer extends ActionBarActivity {
private void levelUp() {
//TODO: improve leveling up by using a sliding guide
xpBar.setMax(Player.LEVEL_PX[player.getLevel()] -
Player.LEVEL_PX[player.getLevel() - 1]);
xpBar.setMax(Player.LEVEL_XP[player.getLevel()] -
Player.LEVEL_XP[player.getLevel() - 1]);
}
@Override
protected void onResume() {
super.onResume();
restoreData();
pgUpdate();
ceUpdate();
pxUpdate();
hpUpdate();
surgeUpdate();
xpUpdate();
}
/**
@ -263,13 +261,13 @@ public class ShowPlayer extends ActionBarActivity {
return false;
} else {
SharedPreferences.Editor e = p.edit();
e.putInt("pg", player.getPg());
e.putInt("pg", player.getHp());
if(usesEffort) {
e.putInt("curativeEfforts", player.getCurativeEfforts());
ceUpdate();
e.putInt("curativeEfforts", player.getSurges());
surgeUpdate();
}
e.apply();
pgUpdate();
hpUpdate();
return true;
}
}
@ -285,24 +283,24 @@ public class ShowPlayer extends ActionBarActivity {
.setTitle(R.string.new_energies)
.setPositiveButton(R.string.me, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
undoPreviousValue = player.getPg();
if (heal(true)) {
undoPreviousValue = player.getHp();
if (heal(true)) { //a surge has been used
SnackbarManager.show(
Snackbar.with(getApplicationContext())
.text(String.format(getString(R.string.healed), player.getMaxPg() / 4))
.text(String.format(getString(R.string.healed), player.getMaxHp() / 4))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.actionLabel(R.string.action_undo)
.actionColor(getResources().getColor(R.color.yellow))
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
player.setPg(undoPreviousValue);
player.setCurativeEffort(player.getCurativeEfforts() + 1);
player.setHp(undoPreviousValue);
player.setCurativeEffort(player.getSurges() + 1);
p.edit().putInt("pg", undoPreviousValue)
.putInt("curativeEfforts", player.getCurativeEfforts())
.putInt("curativeEfforts", player.getSurges())
.apply();
pgUpdate();
ceUpdate();
hpUpdate();
surgeUpdate();
SnackbarManager.show(
Snackbar
.with(getApplicationContext())
@ -320,18 +318,18 @@ public class ShowPlayer extends ActionBarActivity {
.setNegativeButton(R.string.other, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
undoPreviousValue = player.getPg();
undoPreviousValue = player.getHp();
heal(false);
SnackbarManager.show(
Snackbar.with(getApplicationContext())
.text(String.format(getString(R.string.healed), player.getMaxPg() / 4))
.text(String.format(getString(R.string.healed), player.getMaxHp() / 4))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.actionLabel(R.string.action_undo)
.actionColor(getResources().getColor(R.color.yellow))
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
player.setPg(undoPreviousValue);
player.setHp(undoPreviousValue);
p.edit().putInt("pg", undoPreviousValue).apply();
SnackbarManager.show(
Snackbar
@ -340,7 +338,7 @@ public class ShowPlayer extends ActionBarActivity {
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE),
activity
);
pgUpdate();
hpUpdate();
}
}),
activity
@ -379,7 +377,7 @@ public class ShowPlayer extends ActionBarActivity {
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
try {
int preValue = player.getPg();
int preValue = player.getHp();
int damage = Integer.parseInt(input.getText().toString());
player.losePg(damage);
undo = true;
@ -397,8 +395,8 @@ public class ShowPlayer extends ActionBarActivity {
.actionColor(getResources().getColor(R.color.yellow))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
,activity); // action button's
p.edit().putInt("pg", player.getPg()).apply();
pgUpdate();
p.edit().putInt("pg", player.getHp()).apply();
hpUpdate();
invalidateOptionsMenu();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "There was an error", Toast.LENGTH_LONG).show();
@ -419,82 +417,46 @@ public class ShowPlayer extends ActionBarActivity {
* Sets the hit points progress bars to the adequate value and color.
* Sets the text indicating the numerical value of the hit points
*/
private void pgUpdate() {
int pg = player.getPg();
negPgBar.setProgress(pg < 0 ? -pg : 0);
posPgBar.setProgress(pg > 0 ? pg : 0);
private void hpUpdate() {
int hp = player.getHp();
negHpBar.setProgress(hp < 0 ? -hp : 0);
posHpBar.setProgress(hp > 0 ? hp : 0);
currentPg.setText(player.getPg() + " / " + player.getMaxPg());
hpText.setText(player.getHp() + " / " + player.getMaxHp());
int color = player.getStatusColor(getApplicationContext());
posPgBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
int color = player.getStatusColor(getApplicationContext().getResources());
posHpBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
negHpBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
/**
* Recovers the player's data from the sharedPreferences and then updates all the layouts
* This includes an update for the attackList layout.
* This includes an update for the powerList layout.
*/
private void restoreData(){
//Loading player
player = new Player( p );
pxUpdate();
xpUpdate();
xpBar.setMax(
Player.LEVEL_PX[player.getLevel()] -
Player.LEVEL_PX[player.getLevel() - 1]
Player.LEVEL_XP[player.getLevel()] -
Player.LEVEL_XP[player.getLevel() - 1]
);
player.setCurativeEffort(p.getInt("curativeEfforts", player.getMaxCurativeEfforts()));
player.setPg(p.getInt("pg", player.getMaxPg()));
player.setCurativeEffort(p.getInt("curativeEfforts", player.getMaxSurges()));
player.setHp(p.getInt("pg", player.getMaxHp()));
posPgBar.setMax(player.getMaxPg());
negPgBar.setMax(player.getMaxPg() / 2);
curativeEffortsBar.setMax(player.getMaxCurativeEfforts());
pgUpdate();
ceUpdate();
posHpBar.setMax(player.getMaxHp());
negHpBar.setMax(player.getMaxHp() / 2);
surgesBar.setMax(player.getMaxSurges());
hpUpdate();
surgeUpdate();
//set restored values to the respective fields
toolbar.setTitle(player.getName());
toolbar.setSubtitle(
player.getClassName() + " " + player.getRaceName()
);
// //attacks
// ((TextView) findViewById(R.id.FUE)).setText(
// getString(R.string.FUE) + ":" + player.getFue()
// );
// ((TextView) findViewById(R.id.CON)).setText(
// getString(R.string.CON) + ":" + player.getCon()
// );
// ((TextView) findViewById(R.id.DES)).setText(
// getString(R.string.DES) + ":" + player.getDes()
// );
// ((TextView) findViewById(R.id.INT)).setText(
// getString(R.string.INT) + ":" + player.getInt()
// );
// ((TextView) findViewById(R.id.SAB)).setText(
// getString(R.string.SAB) + ":" + player.getSab()
// );
// ((TextView) findViewById(R.id.CAR)).setText(
// 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()
// );
//
//
//Loading powers and abilities (not implemented yet)
refreshList();
}
@ -502,34 +464,35 @@ public class ShowPlayer extends ActionBarActivity {
/**
* This updates the progress and indicator text of the available surges.
*/
private void ceUpdate() {
curativeEffortsBar.setProgress(player.getCurativeEfforts());
currentCurativeEfforts.setText(
player.getCurativeEfforts() + " / " +
player.getMaxCurativeEfforts()
private void surgeUpdate() {
surgesBar.setProgress(player.getSurges());
surgesText.setText(
player.getSurges() + " / " +
player.getMaxSurges()
);
}
/**
* Updates the progress and indicator text of the XP
*/
private void pxUpdate() {
xpBar.setProgress(player.getPx() - Player.LEVEL_PX[player.getLevel() - 1]);
level.setText(getString(R.string.level) + " " + player.getLevel());
currentXp.setText(
player.getPx() + " / " +
Player.LEVEL_PX[player.getLevel()]
private void xpUpdate() {
xpBar.setProgress(player.getXp() - Player.LEVEL_XP[player.getLevel() - 1]);
levelText.setText(getString(R.string.level) + " " + player.getLevel());
xpText.setText(
player.getXp() + " / " +
Player.LEVEL_XP[player.getLevel()]
);
}
/**
* Undoes the last change done by the player. Only used in damage(). Healing is not yet included
* Undoes the last change done by the player. Only used in damage().
* Healing is undone in the health dialog
*/
private void undo() {
String message = "";
if(undoObject == CURRENT_PG){
player.setPg(undoPreviousValue);
player.setHp(undoPreviousValue);
undoObject = NULL;
message = getString(R.string.restored);
}
@ -541,7 +504,7 @@ public class ShowPlayer extends ActionBarActivity {
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
);
}
pgUpdate();
hpUpdate();
undo = false;
invalidateOptionsMenu();
}
@ -575,8 +538,8 @@ public class ShowPlayer extends ActionBarActivity {
int n = p.getInt("powers",0);
int elements = 0;
attackList = (ListView) findViewById(R.id.attackList);
final AttackAdapter adapter = (AttackAdapter) attackList.getAdapter();
powerList = (ListView) findViewById(R.id.powerList);
final PowerAdapter adapter = (PowerAdapter) powerList.getAdapter();
if ( adapter != null )
elements = adapter.getCount();
@ -593,24 +556,15 @@ public class ShowPlayer extends ActionBarActivity {
powers.add( new Power(sav) );
}
attackList.setAdapter(new AttackAdapter(this, powers));
powerList.setAdapter(new PowerAdapter(this, powers));
final Activity activity = this;
attackList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
powerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
final Dialog dialog = new Dialog(ShowPlayer.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.attack_display);
// set the custom dialog components - text, image and button
// Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
// // if button is clicked, close the custom dialog
// dialogButton.setOnClickListener(new OnClickListener() {
// @Override
// public void onClick(View v) {
// dialog.dismiss();
// }
// });
//identify all the elements from the VIEW and then add LISTENERS
final Power power = (Power) parent.getItemAtPosition(position);
@ -628,8 +582,8 @@ public class ShowPlayer extends ActionBarActivity {
((TextView) dialog.findViewById(R.id.impactText)).setText(power.getImpact());
((TextView) dialog.findViewById(R.id.otherText)).setText(power.getOther());
String[] attack = getResources().getStringArray(R.array.attack_array);
String[] defense = getResources().getStringArray(R.array.defense_array);
String[] attack = getResources().getStringArray(R.array.attack);
String[] defense = getResources().getStringArray(R.array.defense);
((TextView) dialog.findViewById(R.id.attackText)).setText(attack[power.getAtk()]
+ " " + getResources().getString(R.string.vs)
+ " " + defense[power.getDef()]);
@ -657,7 +611,7 @@ public class ShowPlayer extends ActionBarActivity {
useButton.setEnabled(false);
useButton.setClickable(false);
getSharedPreferences(p.getString("power" + position, ""), MODE_PRIVATE)
.edit().putBoolean("used", true).apply();
.edit().putBoolean("used", true).apply();
refreshList();
SnackbarManager.show(
Snackbar.with(getApplicationContext())
@ -665,7 +619,7 @@ public class ShowPlayer extends ActionBarActivity {
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
power.recover(Power.DIARIO);
power.recover(Power.DAILY);
useButton.setBackgroundColor(color);
useButton.setTextColor(getResources().getColor(R.color.white));
useButton.getBackground().setAlpha(255);
@ -700,17 +654,16 @@ public class ShowPlayer extends ActionBarActivity {
}
final Activity thisActivity = this;
attackList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
powerList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(final AdapterView<?> parent, View view, final int position, long id) {
AlertDialog.Builder alert = new AlertDialog.Builder(thisActivity);
alert.setItems(
new String[]{getString(R.string.delete), getString(R.string.edit)},
new DialogInterface.OnClickListener()
{
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if ( which == 0 ) {
if (which == 0) {
SnackbarManager.show(
Snackbar.with(getApplicationContext())
.text(R.string.sure)
@ -754,7 +707,7 @@ public class ShowPlayer extends ActionBarActivity {
);
}
}
});
});
alert.show();
return true;
}

View file

@ -4,7 +4,6 @@ import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
@ -35,7 +34,10 @@ public class Welcome extends ActionBarActivity {
setContentView(R.layout.activity_welcome);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitleTextColor(getResources().getColor(R.color.white));
Player.setStrings(getResources());
Power .setStrings(getResources());
p = getSharedPreferences(PREFERENCES, MODE_PRIVATE);
load();
}
@ -68,10 +70,9 @@ public class Welcome extends ActionBarActivity {
load();
}
//TODO: load all players with secondary constructor (except the ones created by introduction and haven't passed by ShowPlayer)
private void load() {
int n = p.getInt("players",0);
ListView playerList = (ListView) findViewById(R.id.listView);
ListView playerList = (ListView) findViewById(R.id.playersList);
final PlayerAdapter adapter = (PlayerAdapter) playerList.getAdapter();
int elements = 0;
if ( adapter != null )
@ -93,7 +94,7 @@ public class Welcome extends ActionBarActivity {
ArrayList<Player> players = new ArrayList<>();
for ( int i = 0; i < n; i++ ) {
SharedPreferences sav = getSharedPreferences(p.getString("player" + i, ""), MODE_PRIVATE);
if (sav.contains(Player.NAME)) //TODO: adding a second player causes an error
if (sav.contains(Player.NAME))
players.add( new Player( sav ) );
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

View file

@ -1,237 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list>
<!-- Shadow -->
<item android:top="1dp" android:right="1dp">
<layer-list>
<item>
<shape android:shape="oval">
<solid android:color="#08000000"/>
<padding
android:bottom="3px"
android:left="3px"
android:right="3px"
android:top="3px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#09000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#10000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#11000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#12000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#13000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#14000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#15000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#16000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
</layer-list>
</item>
<!-- Blue button pressed -->
<item>
<shape android:shape="oval">
<solid android:color="#90CAF9"/>
</shape>
</item>
</layer-list>
</item>
<item android:state_enabled="true">
<layer-list>
<!-- Shadow -->
<item android:top="2dp" android:right="1dp">
<layer-list>
<item>
<shape android:shape="oval">
<solid android:color="#08000000"/>
<padding
android:bottom="4px"
android:left="4px"
android:right="4px"
android:top="4px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#09000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#10000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#11000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#12000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#13000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#14000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#15000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#16000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
</layer-list>
</item>
<!-- Blue button -->
<item>
<shape android:shape="oval">
<solid android:color="#03A9F4"/>
</shape>
</item>
</layer-list>
</item>
</selector>

View file

@ -35,23 +35,23 @@
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords"
android:layout_weight="0.5"
android:id="@+id/editNameIntro"
android:id="@+id/namePlayerEdit"
android:hint="@string/adventurer_name"
android:nextFocusDown="@+id/editPxIntro"
android:nextFocusForward="@+id/editPxIntro"/>
android:nextFocusDown="@+id/xpEdit"
android:nextFocusForward="@+id/xpEdit"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:id="@+id/editPxIntro"
android:id="@+id/xpEdit"
android:hint="@string/px"
android:layout_weight="1"
android:nextFocusDown="@+id/FUE"
android:nextFocusForward="@+id/FUE"
android:nextFocusLeft="@+id/FUE"
android:nextFocusRight="@+id/FUE"
android:nextFocusUp="@+id/FUE"/>
android:nextFocusDown="@+id/STR"
android:nextFocusForward="@+id/STR"
android:nextFocusLeft="@+id/STR"
android:nextFocusRight="@+id/STR"
android:nextFocusUp="@+id/STR"/>
</LinearLayout>
<LinearLayout
@ -93,9 +93,9 @@
android:layout_row="0"
android:layout_column="0"
android:id="@+id/FUE"
android:id="@+id/STR"
android:hint="@string/FUE"
android:nextFocusDown="@+id/DES"/>
android:nextFocusDown="@+id/DEX"/>
<EditText
android:layout_width="wrap_content"
@ -119,9 +119,9 @@
android:layout_row="0"
android:layout_column="1"
android:id="@+id/DES"
android:id="@+id/DEX"
android:hint="@string/DES"
android:nextFocusDown="@+id/SAB"/>
android:nextFocusDown="@+id/WIS"/>
<EditText
android:layout_width="wrap_content"
@ -134,7 +134,7 @@
android:id="@+id/INT"
android:hint="@string/INT"
android:nextFocusDown="@+id/CAR"/>
android:nextFocusDown="@+id/CHA"/>
<EditText
android:layout_width="wrap_content"
@ -145,7 +145,7 @@
android:layout_row="0"
android:layout_column="2"
android:id="@+id/SAB"
android:id="@+id/WIS"
android:hint="@string/SAB"
android:nextFocusDown="@+id/CON"/>
@ -159,7 +159,7 @@
android:layout_row="1"
android:layout_column="2"
android:id="@+id/CAR"
android:id="@+id/CHA"
android:hint="@string/CAR"/>
</GridLayout>

View file

@ -22,12 +22,12 @@
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.kauron.dungeonmanager.PowerEditor">
tools:context=".PowerEditor">
<EditText
android:layout_width="wrap_content"
@ -102,11 +102,11 @@
android:id="@+id/rangeSpinner"
android:layout_weight="1"
android:spinnerMode="dropdown" />
<!--TODO: this field can accept more than numbers, rearrange-->
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:inputType="textCapSentences"
android:ems="10"
android:id="@+id/distanceNumEdit"
android:layout_weight="0.75"
@ -173,7 +173,7 @@
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/actionTypeSpinner"
android:id="@+id/actionSpinner"
android:layout_below="@+id/impactEdit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
@ -186,7 +186,7 @@
android:text="@string/objective"
android:id="@+id/objectiveText"
android:gravity="center_vertical"
android:layout_below="@+id/actionTypeSpinner"
android:layout_below="@+id/actionSpinner"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginRight="10dp"
@ -197,7 +197,7 @@
android:layout_height="wrap_content"
android:id="@+id/objectiveEdit"
android:hint="@string/objectiveHint"
android:layout_below="@+id/actionTypeSpinner"
android:layout_below="@+id/actionSpinner"
android:layout_alignParentRight="true"
android:capitalize="sentences"
android:layout_alignParentEnd="true"

View file

@ -40,8 +40,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/titlePgBar"
android:text="@string/pg"
android:id="@+id/hpTitle"
android:text="@string/hp"
android:textAllCaps="true"
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
android:layout_width="fill_parent"
@ -56,7 +56,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:id="@+id/currentPg"
android:id="@+id/hpText"
android:textSize="14sp"
android:textStyle="bold"
android:textAllCaps="true"
@ -71,7 +71,7 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/negPgBar"
android:id="@+id/negative_hp_bar"
android:layout_weight="2"
android:rotation="180"/>
<TextView
@ -86,7 +86,7 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/pgBar"
android:id="@+id/positive_hp_bar"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
@ -103,7 +103,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/titleCurativeEffortsBar"
android:id="@+id/surgesTitle"
android:text="@string/curative_efforts"
android:textAllCaps="true"
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
@ -120,7 +120,7 @@
android:textSize="14sp"
android:textStyle="bold"
android:gravity="end"
android:id="@+id/currentCurativeEfforts"
android:id="@+id/surgesText"
android:textAllCaps="true"/>
</LinearLayout>
@ -128,7 +128,7 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/curativeEffortsBar"/>
android:id="@+id/surgesBar"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
@ -142,7 +142,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/titleXpBar"
android:id="@+id/xpTitle"
android:text="@string/px"
android:textAllCaps="true"
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
@ -155,7 +155,7 @@
android:paddingRight="8dip"
android:layout_weight="1"/>
<TextView
android:id="@+id/level"
android:id="@+id/levelText"
tools:text="Level 1"
android:textAllCaps="true"
android:gravity="center_horizontal"
@ -169,7 +169,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:id="@+id/currentXp"
android:id="@+id/xpText"
android:textSize="14sp"
android:textStyle="bold"
android:textAllCaps="true"
@ -214,186 +214,186 @@
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/attackList"
android:id="@+id/powerList"
android:layout_gravity="center_horizontal"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:choiceMode="none" />
<LinearLayout
android:id="@+id/attackContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:visibility="gone">
<!--<LinearLayout-->
<!--android:id="@+id/attackContainer"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="10dp"-->
<!--android:orientation="vertical"-->
<!--android:visibility="gone">-->
<TextView
android:id="@+id/titleAttack"
android:text="@string/attack"
android:textAllCaps="true"
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip"/>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/attackGrid"
android:columnCount="3"
android:rowCount="2">
<!--<TextView-->
<!--android:id="@+id/titleAttack"-->
<!--android:text="@string/attack"-->
<!--android:textAllCaps="true"-->
<!--android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"-->
<!--android:layout_marginBottom="5dp"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:textStyle="bold"-->
<!--android:textColor="?android:textColorSecondary"-->
<!--android:textSize="14sp"-->
<!--android:gravity="center_vertical"-->
<!--android:paddingLeft="8dip"-->
<!--android:paddingRight="8dip"/>-->
<!--<HorizontalScrollView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<GridLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:id="@+id/attackGrid"-->
<!--android:columnCount="3"-->
<!--android:rowCount="2">-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="0"
android:layout_column="0"
android:id="@+id/FUE"
tools:text="@string/FUE" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="4"-->
<!--android:layout_row="0"-->
<!--android:layout_column="0"-->
<!--android:id="@+id/STR"-->
<!--tools:text="@string/FUE" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1"
android:layout_column="0"
android:id="@+id/CON"
tools:text="@string/CON" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="4"-->
<!--android:layout_row="1"-->
<!--android:layout_column="0"-->
<!--android:id="@+id/CON"-->
<!--tools:text="@string/CON" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/DES"
tools:text="@string/DES" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="4"-->
<!--android:layout_row="0"-->
<!--android:layout_column="1"-->
<!--android:id="@+id/DEX"-->
<!--tools:text="@string/DES" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1"
android:layout_column="1"
android:id="@+id/INT"
tools:text="@string/INT" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="4"-->
<!--android:layout_row="1"-->
<!--android:layout_column="1"-->
<!--android:id="@+id/INT"-->
<!--tools:text="@string/INT" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="0"
android:layout_column="2"
android:id="@+id/SAB"
tools:text="@string/SAB" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="4"-->
<!--android:layout_row="0"-->
<!--android:layout_column="2"-->
<!--android:id="@+id/WIS"-->
<!--tools:text="@string/SAB" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1"
android:layout_column="2"
android:id="@+id/CAR"
tools:text="@string/CAR" />
</GridLayout>
</HorizontalScrollView>
</LinearLayout>
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="4"-->
<!--android:layout_row="1"-->
<!--android:layout_column="2"-->
<!--android:id="@+id/CHA"-->
<!--tools:text="@string/CAR" />-->
<!--</GridLayout>-->
<!--</HorizontalScrollView>-->
<!--</LinearLayout>-->
<LinearLayout
android:id="@+id/defenseContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:visibility="gone"
android:orientation="vertical">
<!--<LinearLayout-->
<!--android:id="@+id/defenseContainer"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="10dp"-->
<!--android:visibility="gone"-->
<!--android:orientation="vertical">-->
<TextView
android:id="@+id/titleDefense"
android:text="@string/defense"
android:textAllCaps="true"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip"/>
<!--<TextView-->
<!--android:id="@+id/titleDefense"-->
<!--android:text="@string/defense"-->
<!--android:textAllCaps="true"-->
<!--android:layout_marginBottom="5dp"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:textStyle="bold"-->
<!--android:textColor="?android:textColorSecondary"-->
<!--android:textSize="14sp"-->
<!--android:gravity="center_vertical"-->
<!--android:paddingLeft="8dip"-->
<!--android:paddingRight="8dip"/>-->
<GridLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/defenseGrid"
android:columnCount="2"
android:rowCount="2">
<!--<GridLayout-->
<!--android:layout_width="fill_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:id="@+id/defenseGrid"-->
<!--android:columnCount="2"-->
<!--android:rowCount="2">-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="0"
android:layout_column="0"
android:id="@+id/CA"
tools:text="@string/CA" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="5"-->
<!--android:layout_row="0"-->
<!--android:layout_column="0"-->
<!--android:id="@+id/CA"-->
<!--tools:text="@string/CA" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/FORT"
tools:text="@string/FORT" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="5"-->
<!--android:layout_row="0"-->
<!--android:layout_column="1"-->
<!--android:id="@+id/FORT"-->
<!--tools:text="@string/FORT" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="1"
android:layout_column="0"
android:id="@+id/REF"
tools:text="@string/REF" />
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="5"-->
<!--android:layout_row="1"-->
<!--android:layout_column="0"-->
<!--android:id="@+id/REF"-->
<!--tools:text="@string/REF" />-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="1"
android:layout_column="1"
android:id="@+id/VOL"
tools:text="@string/VOL" />
</GridLayout>
</LinearLayout>
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
<!--android:typeface="monospace"-->
<!--android:ems="5"-->
<!--android:layout_row="1"-->
<!--android:layout_column="1"-->
<!--android:id="@+id/VOL"-->
<!--tools:text="@string/VOL" />-->
<!--</GridLayout>-->
<!--</LinearLayout>-->
</LinearLayout>
</LinearLayout>

View file

@ -1,5 +1,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.kauron.dungeonmanager.Welcome"
@ -10,7 +11,9 @@
android:background="@color/primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:title="@string/app_name">
android:title="@string/app_name"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
@ -33,7 +36,7 @@
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:id="@+id/playersList"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"

View file

@ -7,13 +7,13 @@
android:layout_height="wrap_content">
<TextView
tools:text="Explosion"
tools:background="@color/encounter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/encounter"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
tools:text="Explosión"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="@color/white"
@ -30,7 +30,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Diario"
tools:text="Daily"
android:id="@+id/freqText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
@ -42,7 +42,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Fuego, arcano"
tools:text="Fire, arcana"
android:id="@+id/keywordsText"
android:layout_toRightOf="@+id/freqText"
android:textColor="@color/black"
@ -53,7 +53,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Acción estándar"
tools:text="Standard action"
android:textColor="@color/black"
android:id="@+id/typeText"
android:layout_below="@+id/freqText"
@ -160,44 +160,18 @@
android:layout_below="@+id/impact"
tools:text="If you are reading this the description has been displayed"
android:layout_alignParentLeft="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Use"
android:text="@string/use"
android:background="@android:color/transparent"
android:textStyle="bold"
android:id="@+id/useButton"
android:layout_below="@+id/linearLayout"
android:layout_gravity="right"
android:layout_below="@+id/otherText"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/otherText"
android:id="@+id/linearLayout">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:visibility="gone"
android:layout_weight="1"
android:textStyle="bold"
android:background="@android:color/transparent"
android:id="@+id/editButton" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/delete"
android:textColor="#ff0000"
android:visibility="gone"
android:textStyle="bold"
android:layout_weight="1"
android:background="@android:color/transparent"
android:id="@+id/deleteButton" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View file

@ -33,7 +33,7 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/negPgBar"
android:id="@+id/negative_hp_bar"
android:layout_weight="2"
android:rotation="180"/>
<TextView
@ -48,10 +48,10 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/pgBar"
android:id="@+id/positive_hp_bar"
android:layout_weight="1"
tools:progress="30"
tools:progressTint="#FF0"/>
tools:progressTint="@color/yellow"/>
</LinearLayout>
<TextView
@ -59,7 +59,7 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Brujo Tiflin"
android:id="@+id/other"
android:id="@+id/class_and_race"
android:layout_above="@+id/progressBar"
android:layout_toRightOf="@+id/name"
android:layout_toEndOf="@+id/name"
@ -70,7 +70,7 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Level 1"
android:id="@+id/level"
android:id="@+id/levelText"
android:layout_above="@+id/progressBar"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

View file

@ -21,7 +21,7 @@
android:layout_height="wrap_content"
tools:text="Melee 1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/extra"
android:id="@+id/range_and_distance"
android:textColor="@android:color/white"
android:layout_below="@+id/name"
android:layout_alignParentLeft="true"
@ -35,9 +35,9 @@
tools:text="(fire, explosion)"
android:textColor="@android:color/white"
android:paddingLeft="10dp"
android:layout_alignBottom="@id/extra"
android:layout_toRightOf="@+id/extra"
android:layout_toEndOf="@+id/extra" />
android:layout_alignBottom="@id/range_and_distance"
android:layout_toRightOf="@+id/range_and_distance"
android:layout_toEndOf="@+id/range_and_distance" />
<TextView
android:layout_width="wrap_content"

View file

@ -2,13 +2,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.kauron.dungeonmanager.Welcome">
<item
android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never"
android:icon="@drawable/ic_action_settings"
android:visible="false"/>
<item
android:id="@+id/action_add_player"

View file

@ -3,7 +3,7 @@
<string name="action_cure">Curar</string>
<string name="action_edit_basics">Editar personaje</string>
<string name="action_finish">Guardar</string>
<string name="adventurer_name">Nombre</string>
<string name="adventurer_name">Nombre del personaje</string>
<string name="cancel">Cancelar</string>
<string name="class_name">Clase</string>
<string name="edit_PG_Title">Sufrir daño</string>
@ -27,7 +27,7 @@
<string name="action_undo">Deshacer</string>
<string name="action_undo_current_pg">Acción deshecha</string>
<string name="curative_efforts">Esfuerzos curativos</string>
<string name="pg">PG</string>
<string name="hp">PG</string>
<string name="action_reset">Borrar datos</string>
<string name="die">Morir</string>
<string name="message_death">Has muerto</string>
@ -63,7 +63,7 @@
<string name="message_no_px">No has ganado ningún PX</string>
<string name="dialog_resolve_max_pg_hint">Máx PG</string>
<string name="dialog_resolve_max_pg_message">No se han podido calcular tus PG a partir de tu nivel</string>
<string name="dialog_resolve_max_pg_title">Atención</string>
<string name="dialog_resolve_max_pg_title">Alerta</string>
<string name="empty_field">Por favor, escribe algo</string>
<string name="action_download">Actualizar app</string>
<string name="message_no_back_button_intro">Tu personaje no se ha guardado</string>
@ -95,7 +95,7 @@
<string name="save_player">Guardar personaje</string>
<string name="title_activity_power_editor">Editor de poderes</string>
<string-array name="freq_array">
<string-array name="frequencies">
<item>Frecuencia</item>
<item>Oportunidad</item>
<item>A voluntad</item>
@ -103,7 +103,7 @@
<item>Diario</item>
</string-array>
<string-array name="actions_array">
<string-array name="actions">
<item>Tipo de acción</item>
<item>Acción estándar</item>
<item>Acción de movimiento</item>
@ -111,7 +111,7 @@
<item>Acción gratuita</item>
</string-array>
<string-array name="ranges_array">
<string-array name="ranges">
<item>Rango de ataque</item>
<item>Cuerpo a cuerpo</item>
<item>A distancia</item>
@ -120,7 +120,7 @@
<item>Aura</item>
</string-array>
<string-array name="atk_array">
<string-array name="atk">
<item>ATK</item>
<item>FUE</item>
<item>CON</item>
@ -130,7 +130,7 @@
<item>CAR</item>
</string-array>
<string-array name="def_array">
<string-array name="def">
<item>DEF</item>
<item>CA</item>
<item>FORT</item>
@ -138,7 +138,7 @@
<item>VOL</item>
</string-array>
<string-array name="attack_array">
<string-array name="attack">
<item>Ataque</item>
<item>Fuerza</item>
<item>Constitución</item>
@ -148,7 +148,7 @@
<item>Carisma</item>
</string-array>
<string-array name="defense_array">
<string-array name="defence">
<item>Defensa</item>
<item>CA</item>
<item>Fortaleza</item>
@ -166,4 +166,5 @@
<string name="title_activity_player_creator">Creador de personaje</string>
<string name="lost_hp">Has perdido %d PG</string>
<string name="level_up">Subir un nivel</string>
<string name="use">Usar</string>
</resources>

View file

@ -2,26 +2,18 @@
<resources>
<color name="primary">#5D4037</color>
<color name="primary_dark">#3E2723</color>
<color name="primary_light">#D7CCC8</color>
<color name="accent">#FF5252</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#727272</color>
<color name="icons">#FFFFFF</color>
<color name="divider">#B6B6B6</color>
<color name="red">#9F0D0A</color>
<color name="red" >#9F0D0A</color>
<color name="yellow">#FFBB00</color>
<color name="green">#4F8C17</color>
<color name="white">#EEEEEE</color>
<color name="black">#000000</color>
<color name="green" >#4F8C17</color>
<color name="white" >#EEEEEE</color>
<color name="black" >#000000</color>
<color name="daily">#33292A</color>
<color name="encounter">#6B0617</color>
<color name="at_will">#4F7448</color>
<color name="daily" >#33292A</color>
<color name="encounter" >#6B0617</color>
<color name="at_will" >#4F7448</color>
<color name="darkened_text">#DDD6D1</color>
<color name="surges_bar">#989F2B</color>
<color name="px_bar">#005874</color>
<!--<color name="primary">#5D4037</color>-->
<!--<color name="primaryDark">#3E2723</color>-->
<color name="px_bar" >#005874</color>
</resources>

View file

@ -4,10 +4,4 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="bar_margin">15dp</dimen>
<dimen name="fab_button_diameter">56dp</dimen>
<dimen name="fab_button_margin_bottom">16dp</dimen>
<dimen name="fab_button_margin_right">16dp</dimen>
<dimen name="elevation_low">1dp</dimen>
<dimen name="elevation_high">8dp</dimen>
</resources>

View file

@ -5,17 +5,17 @@
<string name="attack">Attack</string>
<string name="action_cure">Cure</string>
<string name="action_undo">Undo</string>
<string name="pg">PG</string>
<string name="hp">HP</string>
<string name="die">Die</string>
<string name="CA">AC</string>
<string name="FORT">FORT</string>
<string name="REF">REF</string>
<string name="VOL">WILL</string>
<string name="defense">Defense</string>
<string name="curative_efforts">Curative efforts</string>
<string name="curative_efforts">Surges</string>
<string name="load_text">Load %1$s</string>
<string name="rest_done">Your encounter powers have been restored</string>
<string name="long_rest_done">All your stats have been restored</string>
<string name="long_rest_done">You have rested and restored all your powers</string>
<string name="action_reset">Reset</string>
<string name="message_reset">All the data has been cleared</string>
<string name="reset_confirmation_title">Are you sure?</string>
@ -49,12 +49,12 @@
<string name="level">Level</string>
<string name="max_curative_efforts">Max surges</string>
<string name="max_pg">Max PG</string>
<string name="max_pg">Max HP</string>
<string name="missing_info_error">You need to fill all the information</string>
<string name="no_curative_efforts_error">You don\'t have any surges left!</string>
<string name="maxed_curative">You have reached your maximum level of PG</string>
<string name="maxed_curative">You have reached your maximum level of HP</string>
<string name="suffer_damage">Input the damage suffered</string>
<string name="suffer_damage_hint">PG lost</string>
<string name="suffer_damage_hint">HP lost</string>
<string name="me">Me</string>
<string name="px_awarded_title">Input XP awarded</string>
<string name="px_awarded_hint">XP from the encounter</string>
@ -69,10 +69,10 @@
<string name="CAR">CHA</string>
<string name="SAB">WIS</string>
<string name="action_save">Save</string>
<string name="dialog_resolve_max_pg_hint">Max PG</string>
<string name="dialog_resolve_max_pg_hint">Max HP</string>
<string name="empty_field">Please input something</string>
<string name="dialog_resolve_max_pg_title">Alert</string>
<string name="dialog_resolve_max_pg_message">Couldn\'t compute your max PG based on your level</string>
<string name="dialog_resolve_max_pg_message">Couldn\'t compute your max HP based on your level</string>
<string name="action_download">Update app</string>
<string name="message_no_back_button_intro">Your information hasn\'t been saved</string>
<string name="title_activity_welcome">Welcome</string>
@ -81,7 +81,7 @@
<string name="new_character">New character</string>
<string name="load_character">Load character</string>
<string name="new_character_warning">This will erase any previously existing data saved</string>
<string name="new_attack">New attack</string>
<string name="new_attack">New power</string>
<string name="edit">Edit</string>
<string name="delete">Delete</string>
<string name="title_activity_power_editor">Power Editor</string>
@ -109,9 +109,9 @@
<string name="sure">Are you sure?</string>
<string name="healed">You have restored %d HP</string>
<string name="restored">Values restored</string>
<string name="export">Exportar</string>
<string name="export">Export</string>
<string-array name="freq_array">
<string-array name="frequencies">
<item>Frequency</item>
<item>Opportunity</item>
<item>At will</item>
@ -119,7 +119,7 @@
<item>Daily</item>
</string-array>
<string-array name="actions_array">
<string-array name="actions">
<item>Action type</item>
<item>Standard</item>
<item>Movement</item>
@ -127,7 +127,7 @@
<item>Free</item>
</string-array>
<string-array name="ranges_array">
<string-array name="ranges">
<item>Range</item>
<item>Melee</item>
<item>Ranged</item>
@ -136,7 +136,7 @@
<item>Aura</item>
</string-array>
<string-array name="atk_array">
<string-array name="atk">
<item>ATK</item>
<item>STR</item>
<item>CON</item>
@ -146,7 +146,7 @@
<item>CHA</item>
</string-array>
<string-array name="def_array">
<string-array name="def">
<item>DEF</item>
<item>AC</item>
<item>FORT</item>
@ -154,7 +154,7 @@
<item>WILL</item>
</string-array>
<string-array name="attack_array">
<string-array name="attack">
<item>Attack</item>
<item>Strength</item>
<item>Constitution</item>
@ -164,16 +164,73 @@
<item>Charisma</item>
</string-array>
<string-array name="defense_array">
<string-array name="defense">
<item>Defense</item>
<item>AC</item>
<item>Fortitude</item>
<item>Reflexes</item>
<item>Will</item>
</string-array>
<string-array name="abilities">
<item>Ability</item>
<item>Acrobatics</item>
<item>Arcana</item>
<item>Athletics</item>
<item>Bluff</item>
<item>Diplomacy</item>
<item>Dungeoneering</item>
<item>Endurance</item>
<item>Heal</item>
<item>History</item>
<item>Insight</item>
<item>Intimidate</item>
<item>Nature</item>
<item>Perception</item>
<item>Religion</item>
<item>Stealth</item>
<item>Streetwise</item>
<item>Thievery</item>
</string-array>
<string-array name="classes">
<item>Class</item>
<item>Ardiente</item>
<item>Brujo</item>
<item>Buscador</item>
<item>Clérigo</item>
<item>Explorador</item>
<item>Guerrero</item>
<item>Mago</item>
<item>Mente de Batalla</item>
<item>Monje</item>
<item>Paladín</item>
<item>Pícaro</item>
<item>Psiónico</item>
<item>Sacerdote Rúnico</item>
<item>Señor de la Guerra</item>
</string-array>
<string-array name="races">
<item>Race</item>
<item>Dracónidos</item>
<item>Eladrines</item>
<item>Elfos</item>
<item>Enanos</item>
<item>Gitzerai</item>
<item>Humanos</item>
<item>Medianos</item>
<item>Mente del Fragmento</item>
<item>Minotauro</item>
<item>Salvaje</item>
<item>Semielfo</item>
<item>Tiflin</item>
</string-array>
<string name="title_activity_player_creator">Player Creator</string>
<string name="hello_world">Hello world!</string>
<string name="lost_hp">Lost %d HP</string>
<string name="level_up">Level up</string>
<string name="use">Use</string>
</resources>