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,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions /> <resourceExtensions />
<wildcardResourcePatterns> <wildcardResourcePatterns>
<entry name="!?*.java" /> <entry name="!?*.java" />
@ -12,6 +11,7 @@
<entry name="!?*.flex" /> <entry name="!?*.flex" />
<entry name="!?*.kt" /> <entry name="!?*.kt" />
<entry name="!?*.clj" /> <entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns> </wildcardResourcePatterns>
<annotationProcessing> <annotationProcessing>
<profile default="true" name="Default" enabled="false"> <profile default="true" name="Default" enabled="false">
@ -20,4 +20,3 @@
</annotationProcessing> </annotationProcessing>
</component> </component>
</project> </project>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

View file

@ -3,9 +3,9 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="LOCAL" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1" /> <option name="gradleJvm" value="1.8" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
@ -16,4 +16,3 @@
</option> </option>
</component> </component>
</project> </project>

View file

@ -1,16 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="AndroidLintButtonOrder" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintDeprecated" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintInvalidId" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintRelativeOverlap" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
</profile>
</component>

View file

@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

View file

@ -3,8 +3,21 @@
<component name="EntryPointsManager"> <component name="EntryPointsManager">
<entry_points version="2.0" /> <entry_points version="2.0" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" 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.7" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project> </project>

View file

@ -7,4 +7,3 @@
</modules> </modules>
</component> </component>
</project> </project>

View file

@ -1,5 +0,0 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

View file

@ -4,4 +4,3 @@
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?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="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> <module external.linked.project.id="DungeonManager" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle"> <facet type="java-gradle" name="Java-Gradle">
<configuration> <configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" /> <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration> </configuration>
</facet> </facet>
</component> </component>
@ -16,4 +17,3 @@
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle"> <facet type="android-gradle" name="Android-Gradle">
<configuration> <configuration>
@ -12,8 +12,9 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" /> <option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> <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="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="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" /> <option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> <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="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" /> <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="support-v4-22.0.0" level="project" />
<orderEntry type="library" exported="" name="snackbar-2.10.6" 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="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> </component>
</module> </module>

View file

@ -97,7 +97,7 @@ public class Introduction extends ActionBarActivity {
} }
private boolean finished() { private boolean finished() {
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE); SharedPreferences p = getSharedPreferences(Welcome.PREFERENCES, MODE_PRIVATE);
SharedPreferences.Editor ed = p.edit(); SharedPreferences.Editor ed = p.edit();
String nameString = name.getText().toString().trim(); String nameString = name.getText().toString().trim();
int classInt = classSpinner.getSelectedItemPosition(); int classInt = classSpinner.getSelectedItemPosition();

View file

@ -19,9 +19,11 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.nispok.snackbar.Snackbar; import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager; import com.nispok.snackbar.SnackbarManager;
import com.nispok.snackbar.listeners.ActionClickListener;
public class MainActivity extends ActionBarActivity { public class MainActivity extends ActionBarActivity {
@ -30,7 +32,6 @@ public class MainActivity extends ActionBarActivity {
public Player player; public Player player;
private boolean undo; private boolean undo;
private int undoObject, undoPreviousValue; private int undoObject, undoPreviousValue;
//TODO: change curativeEffortsBar() color
private ProgressBar pgBar, negPgBar, xpBar, curativeEffortsBar; private ProgressBar pgBar, negPgBar, xpBar, curativeEffortsBar;
private Button pgCurrent; private Button pgCurrent;
@ -128,9 +129,7 @@ public class MainActivity extends ActionBarActivity {
boolean levelUp = player.addPx(Integer.parseInt(input.getText().toString())); boolean levelUp = player.addPx(Integer.parseInt(input.getText().toString()));
if (levelUp) { if (levelUp) {
//levelUp //levelUp
//TODO: update defenses //TODO: improve leveling up by using a sliding guide
//TODO: add attack points when necessary
//TODO: improve leveling up
player.setMaxPgOnLevelUp(); player.setMaxPgOnLevelUp();
lvl.setText( lvl.setText(
String.valueOf(player.getLevel()) String.valueOf(player.getLevel())
@ -274,10 +273,21 @@ public class MainActivity extends ActionBarActivity {
undo = true; undo = true;
undoPreviousValue = preValue; undoPreviousValue = preValue;
undoObject = CURRENT_PG; 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(); p.edit().putInt("pg", player.getPg()).apply();
pgUpdate(); pgUpdate();
invalidateOptionsMenu(); invalidateOptionsMenu();
} catch (Exception e) {} } catch (Exception e) {
}
} }
}); });
@ -326,7 +336,9 @@ public class MainActivity extends ActionBarActivity {
alert.setNegativeButton(R.string.die, new DialogInterface.OnClickListener() { alert.setNegativeButton(R.string.die, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { 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( // SnackbarManager.show(
// Snackbar // Snackbar
// .with(this) // .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() { private void undo() {
String message = ""; String message = "";
if(undoObject == CURRENT_PG){ if(undoObject == CURRENT_PG){
@ -539,9 +547,9 @@ public class MainActivity extends ActionBarActivity {
input.requestFocus(); input.requestFocus();
} }
//TODO: fix the display of maxPg and levelUp //TODO: fix incrementeProgressBar
//TODO: set up a partial barCommand to raise only between the ratios, then a manager, then another //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 //if pgBar, change color accordingly with the pg
private void incrementProgressBar(final ProgressBar progressBar, final TextView textView, private void incrementProgressBar(final ProgressBar progressBar, final TextView textView,
final int factor, final int factor,
final boolean setMax, int max, 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; 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 // * Values for abilities
// */ // */
@ -104,7 +105,7 @@ class Player {
private int classInt, raceInt; private int classInt, raceInt;
private String name; private String name;
private int level; private int level;
//TODO: use dice class //TODO: use dice dialogs
private int[] atk, def, abilities; private int[] atk, def, abilities;
//TODO: implement fully operational powers displayed as cards //TODO: implement fully operational powers displayed as cards
private Power[] powers; private Power[] powers;
@ -152,7 +153,6 @@ class Player {
} }
} }
level = LEVEL_PX.length; level = LEVEL_PX.length;
//TODO: substitute level by px and autoconvert
} }
@ -225,13 +225,13 @@ class Player {
pg = maxPg; pg = maxPg;
curativeEfforts = maxCurativeEfforts; curativeEfforts = maxCurativeEfforts;
for (Power p : powers) for (Power p : powers)
if (p != null && p.getFrequency() == Power.DIARIO) if (p != null)
p.recover(); p.recover(Power.DIARIO);
setState(); setState();
} }
for (Power p : powers) for (Power p : powers)
if (p != null && p.getFrequency() == Power.ENCUENTRO) if (p != null)
p.recover(); p.recover(Power.ENCUENTRO);
} }
void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();} void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();}
@ -250,8 +250,8 @@ class Player {
void setClass() { void setClass() {
if(level == 1) maxPg = atk[CON] + CLASS_STATS[INITIAL_PG][classInt]; if(level == 1) maxPg = atk[CON] + CLASS_STATS[INITIAL_PG][classInt];
maxCurativeEfforts = Player.getModifier(atk[CON]) + CLASS_STATS[DAILY_CURATIVE_EFFORTS][classInt]; maxCurativeEfforts = Player.getModifier(atk[CON]) + CLASS_STATS[DAILY_CURATIVE_EFFORTS][classInt];
//TODO: fix ca bonuses! //TODO: implement armor!
def[CA] = 10 + level / 2; 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[FORT] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[FUE])) +
CLASS_STATS[DEF_FORT][classInt]; 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[DES], atk[INT])) +

View file

@ -1,64 +1,61 @@
package com.kauron.dungeonmanager; package com.kauron.dungeonmanager;
class Power { public class Power {
public static final int MELEE = 1, AREA = 2, RANGED = 3; /**frequencies*/
public static final int DIARIO = 4, A_VOLUNTAD = 2, ENCUENTRO = 3, OPORTUNIDAD = 1; 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 boolean used;
private int frequency, range, distance; private int freq, action, distance, range, objectives;
private String name, keywords; private String name, description;
private int atk, def; private String[] keywords; //fire, spell...
/** An array filled with the maximum damage of each die. private int atk, def; //constants from Player to denote atk and defense
* The position 0 is the damage that doesn't depend on dies. private int[] damage; //the max sizes of the different 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
Power(String name, int frequency, int range, int distance, String keywords, int atk, int def, int[] damage){ public Power(String name, String desc, int freq, int action, int distance, String[] keywords,
this.name = name; int atk, int def, int[] damage){
this.keywords = keywords;
this.frequency = frequency;
this.range = range;
this.distance = distance;
this.atk = atk;
this.def = def;
this.damage = damage;
used = false; used = false;
this.name = name; this.description = desc;
this.freq = freq; this.action = action;
this.distance = distance;
} }
String getName(){return name;} public String getName(){return name;}
int getFrequency() {return frequency;} public String getDescription() {return description;}
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;}
boolean isUsed(){return used;} boolean isUsed(){return used;}
void use(){ public boolean use(){
if(frequency >= ENCUENTRO && !used) if (!used) {
used = true; 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_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:id="@+id/classSpinner" android:id="@+id/classSpinner"
tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" /> android:spinnerMode="dropdown" />
<Spinner <Spinner
@ -55,7 +56,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:id="@+id/raceSpinner" android:id="@+id/raceSpinner"
android:spinnerMode="dialog" /> tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" />
</LinearLayout> </LinearLayout>
<GridLayout <GridLayout
@ -143,4 +145,24 @@
android:hint="@string/CAR"/> android:hint="@string/CAR"/>
</GridLayout> </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> </RelativeLayout>