1
0
Fork 0

Merged versions

This commit is contained in:
Carlos Galindo 2015-04-07 09:28:31 +02:00
parent d423aedd33
commit 553da8d43a
16 changed files with 132 additions and 129 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="DungeonManager" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="DungeonManager" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
@ -12,8 +12,9 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
@ -86,11 +87,10 @@
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" />
<orderEntry type="library" exported="" name="snackbar-2.10.6" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
</component>
</module>
</module>

View file

@ -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();

View file

@ -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,

View file

@ -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])) +

View file

@ -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;}
}

View file

@ -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" />
<Spinner
@ -55,7 +56,8 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/raceSpinner"
android:spinnerMode="dialog" />
tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" />
</LinearLayout>
<GridLayout
@ -143,4 +145,24 @@
android:hint="@string/CAR"/>
</GridLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/thirdLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/new_attack"
android:id="@+id/new_attack_button" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView" />
</LinearLayout>
</RelativeLayout>