General Improvement
Changed class and race attributes to int, built table for class modifiers and simplified its association with the attributes. Added support for level up, currently not working.
This commit is contained in:
parent
ca51347522
commit
d6daf98b74
7 changed files with 293 additions and 194 deletions
|
@ -23,7 +23,7 @@ public class Introduction extends ActionBarActivity {
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
setContentView(com.kauron.dungeonmanager.R.layout.activity_introduction);
|
setContentView(com.kauron.dungeonmanager.R.layout.activity_introduction);
|
||||||
name = (EditText) findViewById(com.kauron.dungeonmanager.R.id.editNameIntro);
|
name = (EditText) findViewById(com.kauron.dungeonmanager.R.id.editNameIntro);
|
||||||
level = (EditText) findViewById(com.kauron.dungeonmanager.R.id.editLevelIntro);
|
level = (EditText) findViewById(com.kauron.dungeonmanager.R.id.editPxIntro);
|
||||||
|
|
||||||
fue = (EditText) findViewById(com.kauron.dungeonmanager.R.id.FUE);
|
fue = (EditText) findViewById(com.kauron.dungeonmanager.R.id.FUE);
|
||||||
con = (EditText) findViewById(com.kauron.dungeonmanager.R.id.CON);
|
con = (EditText) findViewById(com.kauron.dungeonmanager.R.id.CON);
|
||||||
|
@ -37,7 +37,7 @@ public class Introduction extends ActionBarActivity {
|
||||||
new ArrayAdapter<>(
|
new ArrayAdapter<>(
|
||||||
this,
|
this,
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
Player.classStrings
|
Player.CLASS_STRINGS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class Introduction extends ActionBarActivity {
|
||||||
new ArrayAdapter<>(
|
new ArrayAdapter<>(
|
||||||
this,
|
this,
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
Player.raceStrings
|
Player.RACE_STRINGS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -88,12 +88,12 @@ public class Introduction extends ActionBarActivity {
|
||||||
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
||||||
SharedPreferences.Editor ed = p.edit();
|
SharedPreferences.Editor ed = p.edit();
|
||||||
String nameString = name.getText().toString();
|
String nameString = name.getText().toString();
|
||||||
String classString = Player.classStrings[classSpinner.getSelectedItemPosition()];
|
int classInt = classSpinner.getSelectedItemPosition();
|
||||||
String raceString = Player.raceStrings[raceSpinner.getSelectedItemPosition()];
|
int raceInt = raceSpinner.getSelectedItemPosition();
|
||||||
|
|
||||||
int levelInt = 0;
|
int pxInt = 0;
|
||||||
if (!level.getText().toString().isEmpty())
|
if (!level.getText().toString().isEmpty())
|
||||||
levelInt = Integer.parseInt(level.getText().toString());
|
pxInt = Integer.parseInt(level.getText().toString());
|
||||||
|
|
||||||
int fue = 0, con = 0, des = 0, intel = 0, sab = 0, car = 0;
|
int fue = 0, con = 0, des = 0, intel = 0, sab = 0, car = 0;
|
||||||
if (!this.car.getText().toString().isEmpty())
|
if (!this.car.getText().toString().isEmpty())
|
||||||
|
@ -112,9 +112,9 @@ public class Introduction extends ActionBarActivity {
|
||||||
if(getIntent().getExtras().getBoolean("first_time")) {
|
if(getIntent().getExtras().getBoolean("first_time")) {
|
||||||
if (
|
if (
|
||||||
!nameString.isEmpty() &&
|
!nameString.isEmpty() &&
|
||||||
!classString.equals(Player.classStrings[0]) &&
|
classInt != Player.NULL &&
|
||||||
!raceString.equals(Player.raceStrings[0]) &&
|
raceInt != Player.NULL &&
|
||||||
levelInt != 0 &&
|
pxInt != 0 &&
|
||||||
car != 0 &&
|
car != 0 &&
|
||||||
fue != 0 &&
|
fue != 0 &&
|
||||||
con != 0 &&
|
con != 0 &&
|
||||||
|
@ -124,9 +124,9 @@ public class Introduction extends ActionBarActivity {
|
||||||
) {
|
) {
|
||||||
//first save it all
|
//first save it all
|
||||||
ed.putString("playerName", nameString);
|
ed.putString("playerName", nameString);
|
||||||
ed.putString("className", classString);
|
ed.putInt("classInt", classInt);
|
||||||
ed.putString("raceName", raceString);
|
ed.putInt("raceInt", raceInt);
|
||||||
ed.putInt("level", levelInt);
|
ed.putInt("px", pxInt);
|
||||||
|
|
||||||
ed.putInt("fue", fue);
|
ed.putInt("fue", fue);
|
||||||
ed.putInt("car", car);
|
ed.putInt("car", car);
|
||||||
|
@ -141,9 +141,9 @@ public class Introduction extends ActionBarActivity {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!nameString.isEmpty()) ed.putString("playerName", nameString);
|
if (!nameString.isEmpty()) ed.putString("playerName", nameString);
|
||||||
if (!classString.isEmpty()) ed.putString("className", classString);
|
if (classInt != Player.NULL) ed.putInt("classInt", classInt);
|
||||||
if (!raceString.isEmpty()) ed.putString("raceName", raceString);
|
if (raceInt != Player.NULL) ed.putInt("raceInt", raceInt);
|
||||||
if (levelInt != 0) ed.putInt("level", levelInt);
|
if (pxInt != 0) ed.putInt("px", pxInt);
|
||||||
|
|
||||||
if (fue != 0) ed.putInt("fue", fue);
|
if (fue != 0) ed.putInt("fue", fue);
|
||||||
if (car != 0) ed.putInt("car", car);
|
if (car != 0) ed.putInt("car", car);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.kauron.dungeonmanager;
|
package com.kauron.dungeonmanager;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.DialogFragment;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -9,10 +8,11 @@ import android.graphics.Color;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.Log;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -30,7 +30,7 @@ public class MainActivity extends ActionBarActivity{
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(com.kauron.dungeonmanager.R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
undo = false;
|
undo = false;
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
@ -38,13 +38,13 @@ public class MainActivity extends ActionBarActivity{
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
getMenuInflater().inflate(com.kauron.dungeonmanager.R.menu.menu_main, menu);
|
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu (Menu menu) {
|
public boolean onPrepareOptionsMenu (Menu menu) {
|
||||||
menu.findItem(com.kauron.dungeonmanager.R.id.action_undo).setVisible(undo);
|
menu.findItem(R.id.action_undo).setVisible(undo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class MainActivity extends ActionBarActivity{
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
//noinspection SimplifiableIfStatement
|
//noinspection SimplifiableIfStatement
|
||||||
if (id == com.kauron.dungeonmanager.R.id.action_cure) {
|
if (id == R.id.action_cure) {
|
||||||
if(player.getMaxPg() <= player.getPg()){
|
if(player.getMaxPg() <= player.getPg()){
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
|
@ -67,7 +67,7 @@ public class MainActivity extends ActionBarActivity{
|
||||||
healDialog();
|
healDialog();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (id == com.kauron.dungeonmanager.R.id.action_edit_basics) {
|
} else if (id == R.id.action_edit_basics) {
|
||||||
//TODO: try this startChildActivity()
|
//TODO: try this startChildActivity()
|
||||||
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
||||||
Intent intent = new Intent(this, Introduction.class);
|
Intent intent = new Intent(this, Introduction.class);
|
||||||
|
@ -77,32 +77,62 @@ public class MainActivity extends ActionBarActivity{
|
||||||
));
|
));
|
||||||
restoreData();
|
restoreData();
|
||||||
return true;
|
return true;
|
||||||
} else if (id == com.kauron.dungeonmanager.R.id.action_undo) {
|
} else if (id == R.id.action_undo) {
|
||||||
undo();
|
undo();
|
||||||
return true;
|
return true;
|
||||||
} else if (id == com.kauron.dungeonmanager.R.id.action_reset) {
|
} else if (id == R.id.action_reset) {
|
||||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
alert.setTitle(getString(com.kauron.dungeonmanager.R.string.reset_confirmation_title));
|
alert.setTitle(R.string.reset_confirmation_title);
|
||||||
alert.setMessage(getString(com.kauron.dungeonmanager.R.string.reset_confirmation));
|
alert.setMessage(R.string.reset_confirmation);
|
||||||
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
com.kauron.dungeonmanager.R.string.message_reset,
|
R.string.message_reset,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
|
getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
|
||||||
restoreData();
|
restoreData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
alert.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
// Canceled.
|
// Canceled.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
alert.show();
|
alert.show();
|
||||||
|
return true;
|
||||||
|
} else if (id == R.id.action_time_encounter_end) {
|
||||||
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
|
alert.setTitle(R.string.px_awarded_title);
|
||||||
|
final EditText input = new EditText(this);
|
||||||
|
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
|
input.setHint(R.string.px_awarded_hint);
|
||||||
|
alert.setCancelable(false);
|
||||||
|
alert.setView(input);
|
||||||
|
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
try {
|
||||||
|
if (player.addPx(Integer.parseInt(input.getText().toString()))) {
|
||||||
|
//levelUp
|
||||||
|
player.setMaxPgOnLevelUp();
|
||||||
|
((TextView) findViewById(R.id.lvl)).setText(
|
||||||
|
String.valueOf(player.getLevel())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
R.string.message_no_px,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alert.show();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -116,20 +146,19 @@ public class MainActivity extends ActionBarActivity{
|
||||||
updateCurativeString();
|
updateCurativeString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void heal(boolean usesEffort
|
public void heal(boolean usesEffort) {
|
||||||
) {
|
|
||||||
int hasCured = player.recoverPg(Player.USE_CURATIVE_EFFORT, usesEffort);
|
int hasCured = player.recoverPg(Player.USE_CURATIVE_EFFORT, usesEffort);
|
||||||
if (hasCured == Player.NOT_CURED) {
|
if (hasCured == Player.NOT_CURED) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
com.kauron.dungeonmanager.R.string.no_curative_efforts_error,
|
R.string.no_curative_efforts_error,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
} else {
|
} else {
|
||||||
if(hasCured == Player.MAXED){
|
if(hasCured == Player.MAXED){
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
com.kauron.dungeonmanager.R.string.maxed_curative,
|
R.string.maxed_curative,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
}
|
}
|
||||||
|
@ -144,20 +173,20 @@ public class MainActivity extends ActionBarActivity{
|
||||||
|
|
||||||
public void healDialog() {
|
public void healDialog() {
|
||||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
alert.setMessage(com.kauron.dungeonmanager.R.string.new_energies_message)
|
alert.setMessage(R.string.new_energies_message)
|
||||||
.setTitle(com.kauron.dungeonmanager.R.string.new_energies)
|
.setTitle(R.string.new_energies)
|
||||||
.setPositiveButton(com.kauron.dungeonmanager.R.string.me, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.me, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
heal(true);
|
heal(true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(com.kauron.dungeonmanager.R.string.other, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.other, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
heal(false);
|
heal(false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(com.kauron.dungeonmanager.R.string.cancel, new DialogInterface.OnClickListener() {
|
.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
dialog.cancel();
|
dialog.cancel();
|
||||||
|
@ -168,18 +197,18 @@ public class MainActivity extends ActionBarActivity{
|
||||||
|
|
||||||
public void damage(final View view){
|
public void damage(final View view){
|
||||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
alert.setTitle(getString(com.kauron.dungeonmanager.R.string.suffer_damage));
|
alert.setTitle(R.string.suffer_damage);
|
||||||
|
|
||||||
// Set an EditText view to get user input
|
// Set an EditText view to get user input
|
||||||
final EditText input = new EditText(this);
|
final EditText input = new EditText(this);
|
||||||
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
input.setHint(com.kauron.dungeonmanager.R.string.suffer_damage_hint);
|
input.setHint(R.string.suffer_damage_hint);
|
||||||
|
|
||||||
alert.setView(input);
|
alert.setView(input);
|
||||||
|
|
||||||
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
Button pg = (Button) findViewById(com.kauron.dungeonmanager.R.id.pgCurrent);
|
Button pg = (Button) findViewById(R.id.pgCurrent);
|
||||||
try {
|
try {
|
||||||
int preValue = Integer.parseInt(pg.getText().toString());
|
int preValue = Integer.parseInt(pg.getText().toString());
|
||||||
int damage = Integer.parseInt(input.getText().toString());
|
int damage = Integer.parseInt(input.getText().toString());
|
||||||
|
@ -200,7 +229,7 @@ public class MainActivity extends ActionBarActivity{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
alert.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
// Canceled.
|
// Canceled.
|
||||||
}
|
}
|
||||||
|
@ -212,26 +241,26 @@ public class MainActivity extends ActionBarActivity{
|
||||||
private void healthStatusCheck() {
|
private void healthStatusCheck() {
|
||||||
int status = player.getState();
|
int status = player.getState();
|
||||||
int lastState = player.getLastState();
|
int lastState = player.getLastState();
|
||||||
Button pg = (Button) findViewById(com.kauron.dungeonmanager.R.id.pgCurrent);
|
Button pg = (Button) findViewById(R.id.pgCurrent);
|
||||||
pg.setText(String.valueOf(player.getPg()));
|
pg.setText(String.valueOf(player.getPg()));
|
||||||
if (status == Player.MUERTO) {
|
if (status == Player.MUERTO) {
|
||||||
pg.setTextColor(Color.BLACK);
|
pg.setTextColor(Color.BLACK);
|
||||||
pg.setBackgroundColor(Color.RED);
|
pg.setBackgroundColor(Color.RED);
|
||||||
|
|
||||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
alert.setTitle(getString(com.kauron.dungeonmanager.R.string.reset_confirmation_title));
|
alert.setTitle(getString(R.string.reset_confirmation_title));
|
||||||
alert.setMessage(getString(com.kauron.dungeonmanager.R.string.reset_confirmation));
|
alert.setMessage(getString(R.string.reset_confirmation));
|
||||||
alert.setPositiveButton(com.kauron.dungeonmanager.R.string.action_undo, new DialogInterface.OnClickListener() {
|
alert.setPositiveButton(R.string.action_undo, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
undo();
|
undo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
alert.setNegativeButton(com.kauron.dungeonmanager.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) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
com.kauron.dungeonmanager.R.string.message_death,
|
R.string.message_death,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
|
getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
|
||||||
|
@ -246,7 +275,7 @@ public class MainActivity extends ActionBarActivity{
|
||||||
if(lastState != Player.SAME) {
|
if(lastState != Player.SAME) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
com.kauron.dungeonmanager.R.string.state_changed_debilitado,
|
R.string.state_changed_debilitado,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
}
|
}
|
||||||
|
@ -256,19 +285,21 @@ public class MainActivity extends ActionBarActivity{
|
||||||
if(lastState != Player.SAME) {
|
if(lastState != Player.SAME) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
com.kauron.dungeonmanager.R.string.state_changed_malherido,
|
R.string.state_changed_malherido,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(player.getPg() >= player.getMaxPg())
|
||||||
|
pg.setTextColor(Color.GREEN);
|
||||||
|
else
|
||||||
pg.setTextColor(getResources().getColor(
|
pg.setTextColor(getResources().getColor(
|
||||||
com.kauron.dungeonmanager.R.color.abc_primary_text_material_dark
|
R.color.abc_primary_text_material_dark
|
||||||
));
|
));
|
||||||
pg.setBackgroundColor(android.R.drawable.btn_default);
|
pg.setBackgroundColor(android.R.drawable.btn_default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void restoreData(){
|
private void restoreData(){
|
||||||
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
||||||
//restore state
|
//restore state
|
||||||
|
@ -281,10 +312,10 @@ public class MainActivity extends ActionBarActivity{
|
||||||
}
|
}
|
||||||
if(player == null) {
|
if(player == null) {
|
||||||
player = new Player(
|
player = new Player(
|
||||||
p.getString("playerName", getString(com.kauron.dungeonmanager.R.string.adventurer_name)),
|
p.getString("playerName", getString(R.string.adventurer_name)),
|
||||||
p.getString("className", getString(com.kauron.dungeonmanager.R.string.class_name)),
|
p.getInt("classInt", Player.NULL),
|
||||||
p.getString("raceName", getString(com.kauron.dungeonmanager.R.string.race_name)),
|
p.getInt("raceInt", Player.NULL),
|
||||||
p.getInt("level", 1),
|
p.getInt("px", 0),
|
||||||
new int[] {
|
new int[] {
|
||||||
p.getInt("fue", 10),
|
p.getInt("fue", 10),
|
||||||
p.getInt("con", 10),
|
p.getInt("con", 10),
|
||||||
|
@ -296,10 +327,10 @@ public class MainActivity extends ActionBarActivity{
|
||||||
new int[18],
|
new int[18],
|
||||||
new Power[4]);
|
new Power[4]);
|
||||||
} else {
|
} else {
|
||||||
player.setName(p.getString("playerName", getString(com.kauron.dungeonmanager.R.string.adventurer_name)));
|
player.setName(p.getString("playerName", getString(R.string.adventurer_name)));
|
||||||
player.setClassName(p.getString("className", getString(com.kauron.dungeonmanager.R.string.class_name)));
|
player.setClassInt(p.getInt("classInt", Player.NULL));
|
||||||
player.setRaceName(p.getString("raceName", getString(com.kauron.dungeonmanager.R.string.race_name)));
|
player.setRaceInt(p.getInt("raceInt", Player.NULL));
|
||||||
player.setLevel(p.getInt("level", 1));
|
player.setPx(p.getInt("px", 0));
|
||||||
player.setAtk(new int[]{
|
player.setAtk(new int[]{
|
||||||
p.getInt("fue", 10),
|
p.getInt("fue", 10),
|
||||||
p.getInt("con", 10),
|
p.getInt("con", 10),
|
||||||
|
@ -310,67 +341,60 @@ public class MainActivity extends ActionBarActivity{
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(player.getLevel() != 1 && player.getMaxPg() == 0) {
|
||||||
|
pgDialog();
|
||||||
|
}
|
||||||
player.setCurativeEffort(p.getInt("curativeEfforts", player.getCurativeEfforts()));
|
player.setCurativeEffort(p.getInt("curativeEfforts", player.getCurativeEfforts()));
|
||||||
player.setPg(p.getInt("pg", player.getPg()));
|
player.setPg(p.getInt("pg", player.getPg()));
|
||||||
healthStatusCheck();
|
healthStatusCheck();
|
||||||
updateCurativeString();
|
updateCurativeString();
|
||||||
//set restored values to the respective fields
|
//set restored values to the respective fields
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.nameText)).setText(player.getName());
|
((TextView) findViewById(R.id.nameText)).setText(player.getName());
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.raceText)).setText(player.getRaceName());
|
((TextView) findViewById(R.id.raceText)).setText(player.getRaceName());
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.classText)).setText(player.getClassName());
|
((TextView) findViewById(R.id.classText)).setText(player.getClassName());
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.lvl)).setText(String.valueOf(player.getLevel()));
|
((TextView) findViewById(R.id.lvl)).setText(String.valueOf(player.getLevel()));
|
||||||
|
|
||||||
((Button) findViewById(com.kauron.dungeonmanager.R.id.pgCurrent)).setText(String.valueOf(player.getPg()));
|
((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(player.getPg()));
|
||||||
|
|
||||||
//attacks
|
//attacks
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.FUE)).setText(
|
((TextView) findViewById(R.id.FUE)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.FUE) + ":" + player.getFue()
|
getString(R.string.FUE) + ":" + player.getFue()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.CON)).setText(
|
((TextView) findViewById(R.id.CON)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.CON) + ":" + player.getCon()
|
getString(R.string.CON) + ":" + player.getCon()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.DES)).setText(
|
((TextView) findViewById(R.id.DES)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.DES) + ":" + player.getDes()
|
getString(R.string.DES) + ":" + player.getDes()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.INT)).setText(
|
((TextView) findViewById(R.id.INT)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.INT) + ":" + player.getInt()
|
getString(R.string.INT) + ":" + player.getInt()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.SAB)).setText(
|
((TextView) findViewById(R.id.SAB)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.SAB) + ":" + player.getSab()
|
getString(R.string.SAB) + ":" + player.getSab()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.CAR)).setText(
|
((TextView) findViewById(R.id.CAR)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.CAR) + ":" + player.getCar()
|
getString(R.string.CAR) + ":" + player.getCar()
|
||||||
);
|
);
|
||||||
|
|
||||||
//defenses
|
//defenses
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.CA)).setText(
|
((TextView) findViewById(R.id.CA)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.CA) + ": " + player.getCa()
|
getString(R.string.CA) + ": " + player.getCa()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.FORT)).setText(
|
((TextView) findViewById(R.id.FORT)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.FORT) + ":" + player.getFort()
|
getString(R.string.FORT) + ":" + player.getFort()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.REF)).setText(
|
((TextView) findViewById(R.id.REF)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.REF) + ":" + player.getRef()
|
getString(R.string.REF) + ":" + player.getRef()
|
||||||
);
|
);
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.VOL)).setText(
|
((TextView) findViewById(R.id.VOL)).setText(
|
||||||
getString(com.kauron.dungeonmanager.R.string.VOL) + ": " + player.getVol()
|
getString(R.string.VOL) + ": " + player.getVol()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void saveData() {
|
|
||||||
// getSharedPreferences("basics", MODE_PRIVATE).edit()
|
|
||||||
// .putInt("level", player.getLevel())
|
|
||||||
// .putInt("maxPg", player.getMaxPg())
|
|
||||||
// .putInt("pg", player.getPg())
|
|
||||||
// .putInt("maxCurativeEfforts", player.getMaxCurativeEfforts())
|
|
||||||
// .putInt("curativeEfforts", player.getCurativeEfforts())
|
|
||||||
// .apply();
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void updateCurativeString() {
|
private void updateCurativeString() {
|
||||||
((TextView) findViewById(com.kauron.dungeonmanager.R.id.curativeEffortsText)).setText(
|
((TextView) findViewById(R.id.curativeEffortsText)).setText(
|
||||||
getString(
|
getString(
|
||||||
R.string.curative_display_text,
|
R.string.curative_display_text,
|
||||||
player.getCurativeEfforts(),
|
player.getCurativeEfforts(),
|
||||||
|
@ -386,10 +410,10 @@ public class MainActivity extends ActionBarActivity{
|
||||||
private void undo() {
|
private void undo() {
|
||||||
String message = "";
|
String message = "";
|
||||||
if(undoObject == CURRENT_PG){
|
if(undoObject == CURRENT_PG){
|
||||||
((Button) findViewById(com.kauron.dungeonmanager.R.id.pgCurrent)).setText(String.valueOf(undoPreviousValue));
|
((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(undoPreviousValue));
|
||||||
player.setPg(undoPreviousValue);
|
player.setPg(undoPreviousValue);
|
||||||
undoObject = NULL;
|
undoObject = NULL;
|
||||||
message = getString(com.kauron.dungeonmanager.R.string.action_undo_current_pg);
|
message = getString(R.string.action_undo_current_pg);
|
||||||
}
|
}
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
|
@ -399,4 +423,52 @@ public class MainActivity extends ActionBarActivity{
|
||||||
undo = false;
|
undo = false;
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void pgDialog() {
|
||||||
|
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
|
||||||
|
final EditText input = new EditText(this);
|
||||||
|
final AlertDialog d;
|
||||||
|
input.setHint(R.string.dialog_resolve_max_pg_hint);
|
||||||
|
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
|
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||||
|
input.setOnKeyListener(new View.OnKeyListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||||
|
if(keyCode == KeyEvent.FLAG_EDITOR_ACTION) {
|
||||||
|
if (input.getText().toString().isEmpty()){
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
R.string.empty_field,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
pgDialog();
|
||||||
|
} else {
|
||||||
|
player.setMaxPg(Integer.parseInt(input.getText().toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog
|
||||||
|
.setView(input)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setTitle(R.string.dialog_resolve_max_pg_title)
|
||||||
|
.setMessage(R.string.dialog_resolve_max_pg_message)
|
||||||
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (input.getText().toString().isEmpty()){
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
R.string.empty_field,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
pgDialog();
|
||||||
|
} else {
|
||||||
|
player.setMaxPg(Integer.parseInt(input.getText().toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,16 +5,54 @@ public class Player {
|
||||||
/**
|
/**
|
||||||
* Names for the classes
|
* Names for the classes
|
||||||
*/
|
*/
|
||||||
public static final String[] classStrings = {
|
public static final String[] CLASS_STRINGS = {
|
||||||
"Clase", "Ardiente", "Brujo", "Buscador", "Clérigo", "Explorador",
|
"Clase", "Ardiente", "Brujo", "Buscador", "Clérigo", "Explorador",
|
||||||
"Guerrero", "Mago", "Mente de Batalla", "Monje", "Paladín", "Pícaro", "Psiónico",
|
"Guerrero", "Mago", "Mente de Batalla", "Monje", "Paladín", "Pícaro", "Psiónico",
|
||||||
"Sacerdote Rúnico", "Señor de la guerra"
|
"Sacerdote Rúnico", "Señor de la guerra"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Values for classes
|
||||||
|
*/
|
||||||
|
public static final int NULL = 0, 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
|
||||||
|
*/
|
||||||
|
public static final int[] LEVEL_PX = 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
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Values for each class' characteristics
|
||||||
|
*/
|
||||||
|
public static final int[][] CLASS_STATS = new int[][] {
|
||||||
|
//pg on level up
|
||||||
|
{0, 5, 5, 5, 5, 5, 6, 4, 6, 5, 6, 5, 4, 5, 5},
|
||||||
|
//defenses bonus: fort, ref, vol
|
||||||
|
{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
|
||||||
|
{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}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Names for the races
|
* Names for the races
|
||||||
*/
|
*/
|
||||||
public static final String[] raceStrings = new String[] {
|
public static final String[] RACE_STRINGS = new String[] {
|
||||||
"Raza", "Dracónido", "Eladrín", "Elfo", "Enano", "Gitzherai", "Humanos", "Medianos",
|
"Raza", "Dracónido", "Eladrín", "Elfo", "Enano", "Gitzherai", "Humanos", "Medianos",
|
||||||
"Mente del Fragmento", "Minotauro", "Salvaje", "Semielfo", "Tiflin"
|
"Mente del Fragmento", "Minotauro", "Salvaje", "Semielfo", "Tiflin"
|
||||||
};
|
};
|
||||||
|
@ -40,8 +78,8 @@ public class Player {
|
||||||
/**
|
/**
|
||||||
* Names for the abilities
|
* Names for the abilities
|
||||||
*/
|
*/
|
||||||
public static final String[] abilityString = new String[] {
|
public static final String[] ABILITY_STRING = new String[] {
|
||||||
"Acrobacias", "Aguante", "Arcanos", "Atletismo", "Diplomacia", "Dungeons", "Engañar",
|
"Habilidades", "Acrobacias", "Aguante", "Arcanos", "Atletismo", "Diplomacia", "Dungeons", "Engañar",
|
||||||
"Historia", "Hurto", "Intimidar", "Naturaleza", "Percepción", "Perspicacia", "Recursos",
|
"Historia", "Hurto", "Intimidar", "Naturaleza", "Percepción", "Perspicacia", "Recursos",
|
||||||
"Religión", "Sanar", "Sigilo"
|
"Religión", "Sanar", "Sigilo"
|
||||||
};
|
};
|
||||||
|
@ -52,35 +90,45 @@ public class Player {
|
||||||
public static final int OK = 1, MALHERIDO = 2, DEBILITADO = 3, MUERTO = 4, SAME = 5,
|
public static final int OK = 1, MALHERIDO = 2, DEBILITADO = 3, MUERTO = 4, SAME = 5,
|
||||||
USE_CURATIVE_EFFORT = -1, CURED = 1, NOT_CURED = 0, MAXED = -1;
|
USE_CURATIVE_EFFORT = -1, CURED = 1, NOT_CURED = 0, MAXED = -1;
|
||||||
|
|
||||||
private int pg, maxPg;
|
private int pg, maxPg, px;
|
||||||
private int state, lastState;
|
private int state, lastState;
|
||||||
private int curativeEfforts, maxCurativeEfforts;
|
private int curativeEfforts, maxCurativeEfforts;
|
||||||
//TODO: convert race and class to integer values
|
|
||||||
private int classInt, raceInt;
|
private int classInt, raceInt;
|
||||||
private String name, className, raceName;
|
private String name;
|
||||||
private int level;
|
private int level;
|
||||||
|
|
||||||
private int[] atk, def, abilities;
|
private int[] atk, def, abilities;
|
||||||
private Power[] powers;
|
private Power[] powers;
|
||||||
|
|
||||||
public Player(
|
public Player(
|
||||||
String name, String className, String raceName,
|
String name, int classInt, int raceInt,
|
||||||
int level, int[] atk, int[] abilities,
|
int px, int[] atk, int[] abilities,
|
||||||
Power[] powers
|
Power[] powers
|
||||||
){
|
){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.level = level;
|
this.px = px;
|
||||||
this.raceName = raceName;
|
setLevel();
|
||||||
this.className = className;
|
this.raceInt = raceInt;
|
||||||
|
this.classInt = classInt;
|
||||||
this.def = new int[4];
|
this.def = new int[4];
|
||||||
setAtk(atk);
|
setAtk(atk);
|
||||||
setState();
|
setState();
|
||||||
|
pg = maxPg;
|
||||||
|
curativeEfforts = maxCurativeEfforts;
|
||||||
|
|
||||||
this.abilities = abilities;
|
this.abilities = abilities;
|
||||||
this.powers = powers;
|
this.powers = powers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getPx() {return px;}
|
||||||
|
public void setPx (int px) {this.px = px; setLevel();}
|
||||||
|
public boolean addPx(int px) {
|
||||||
|
int lastLevel = level;
|
||||||
|
setPx(this.px + px);
|
||||||
|
return lastLevel < level;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxCurativeEfforts() {return maxCurativeEfforts;}
|
public int getMaxCurativeEfforts() {return maxCurativeEfforts;}
|
||||||
public void setMaxCurativeEfforts(int maxCurativeEfforts) {this.maxCurativeEfforts = maxCurativeEfforts;}
|
public void setMaxCurativeEfforts(int maxCurativeEfforts) {this.maxCurativeEfforts = maxCurativeEfforts;}
|
||||||
|
|
||||||
|
@ -88,10 +136,24 @@ public class Player {
|
||||||
public void setCurativeEffort(int curativeEfforts) {this.curativeEfforts = curativeEfforts;}
|
public void setCurativeEffort(int curativeEfforts) {this.curativeEfforts = curativeEfforts;}
|
||||||
|
|
||||||
public int getLevel() {return level;}
|
public int getLevel() {return level;}
|
||||||
public void setLevel(int level) {this.level = level;}
|
public void setLevel() {
|
||||||
|
for (int i = 0; i < LEVEL_PX.length; i++){
|
||||||
|
if(px < LEVEL_PX[i]) {
|
||||||
|
level = i; return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
level = LEVEL_PX.length;
|
||||||
|
//TODO: substitute level by px and autoconvert
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getMaxPg() {return maxPg;}
|
public int getMaxPg() {return maxPg;}
|
||||||
public void setMaxPg(int maxPg) {this.maxPg = maxPg;}
|
public void setMaxPg(int maxPg) {
|
||||||
|
if(this.maxPg == 0)
|
||||||
|
this.pg = maxPg;
|
||||||
|
this.maxPg = maxPg;
|
||||||
|
}
|
||||||
|
public void setMaxPgOnLevelUp() {maxPg += CLASS_STATS[PG_ON_LEVEL_UP][classInt];}
|
||||||
|
|
||||||
public int getPg() {return pg;}
|
public int getPg() {return pg;}
|
||||||
public void setPg(int pg) {this.pg = pg; setState();}
|
public void setPg(int pg) {this.pg = pg; setState();}
|
||||||
|
@ -137,14 +199,16 @@ public class Player {
|
||||||
public String getName() {return name;}
|
public String getName() {return name;}
|
||||||
public void setName(String name) {this.name = name;}
|
public void setName(String name) {this.name = name;}
|
||||||
|
|
||||||
public String getClassName() {return className;}
|
public int getClassInt() {return classInt;}
|
||||||
public void setClassName(String className) {
|
public void setClassInt(int classInt) {
|
||||||
this.className = className;
|
this.classInt = classInt;
|
||||||
if(atk!=null) setClass();
|
if (atk != null) setClass();
|
||||||
}
|
}
|
||||||
|
public String getClassName() {return CLASS_STRINGS[classInt];}
|
||||||
|
|
||||||
public String getRaceName() {return raceName;}
|
public String getRaceName() {return RACE_STRINGS[raceInt];}
|
||||||
public void setRaceName(String raceName) {this.raceName = raceName;}
|
public void setRaceInt(int raceInt) {this.raceInt= raceInt;}
|
||||||
|
public int getRaceInt() {return raceInt;}
|
||||||
|
|
||||||
//TODO: implement time in the app
|
//TODO: implement time in the app
|
||||||
public void rest(boolean length) {
|
public void rest(boolean length) {
|
||||||
|
@ -156,7 +220,7 @@ public class Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAtk(int[] atk) {this.atk = atk; if(className!=null) setClass();}
|
public void setAtk(int[] atk) {this.atk = atk; if(classInt != NULL) setClass();}
|
||||||
|
|
||||||
public int getFue() {return atk[FUE];}
|
public int getFue() {return atk[FUE];}
|
||||||
public int getCon() {return atk[CON];}
|
public int getCon() {return atk[CON];}
|
||||||
|
@ -169,66 +233,17 @@ public class Player {
|
||||||
public int getRef() {return def[REF];}
|
public int getRef() {return def[REF];}
|
||||||
public int getVol() {return def[VOL];}
|
public int getVol() {return def[VOL];}
|
||||||
|
|
||||||
//TODO: set the pg level dependant
|
|
||||||
//TODO: only setPg if the
|
|
||||||
public void setClass() {
|
public void setClass() {
|
||||||
int pgExtra = 0, curativeEffortsExtra = 0, defCA = 0, defFORT = 0, defVOL = 0, defREF = 0;
|
if(level == 1) maxPg = atk[CON] + CLASS_STATS[INITIAL_PG][classInt];
|
||||||
if(className.equals(classStrings[1])){
|
maxCurativeEfforts = Player.getModifier(atk[CON]) + CLASS_STATS[DAILY_CURATIVE_EFFORTS][classInt];
|
||||||
//Ardiente
|
//TODO: fix ca bonuses!
|
||||||
} else if (className.equals(classStrings[2])) {
|
def[CA] = 10 + level / 2;
|
||||||
//Brujo
|
def[FORT] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[FUE])) +
|
||||||
//TODO: Kauron
|
CLASS_STATS[DEF_FORT][classInt];
|
||||||
pgExtra = 12;
|
def[REF] = 10 + level / 2 + Player.getModifier(Math.max(atk[DES], atk[INT])) +
|
||||||
curativeEffortsExtra = 6;
|
CLASS_STATS[DEF_REF][classInt];
|
||||||
defVOL = defREF = 1;
|
def[VOL] = 10 + level / 2 + Player.getModifier(Math.max(atk[CAR], atk[SAB])) +
|
||||||
} else if (className.equals(classStrings[3])) {
|
CLASS_STATS[DEF_VOL][classInt];
|
||||||
//Buscador
|
|
||||||
} else if (className.equals(classStrings[4])) {
|
|
||||||
//Clérigo
|
|
||||||
//TODO: Gárafran
|
|
||||||
pgExtra = 12;
|
|
||||||
curativeEffortsExtra = 7;
|
|
||||||
defVOL = 2;
|
|
||||||
} else if (className.equals(classStrings[5])) {
|
|
||||||
//Explorador
|
|
||||||
//TODO: Aria Saferi
|
|
||||||
pgExtra = 12;
|
|
||||||
curativeEffortsExtra= 6;
|
|
||||||
defFORT = 1;
|
|
||||||
defREF = 1;
|
|
||||||
} else if (className.equals(classStrings[6])) {
|
|
||||||
//Guerrero
|
|
||||||
} else if (className.equals(classStrings[7])) {
|
|
||||||
//Mago
|
|
||||||
} else if (className.equals(classStrings[8])) {
|
|
||||||
//Mente de Batalla
|
|
||||||
} else if (className.equals(classStrings[9])) {
|
|
||||||
//Monje
|
|
||||||
} else if (className.equals(classStrings[10])) {
|
|
||||||
//Paladín
|
|
||||||
//TODO: Ceaelynna
|
|
||||||
pgExtra = 15;
|
|
||||||
curativeEffortsExtra = 10;
|
|
||||||
defFORT = defREF = defVOL = 1;
|
|
||||||
} else if (className.equals(classStrings[11])) {
|
|
||||||
//Pícaro
|
|
||||||
} else if (className.equals(classStrings[12])) {
|
|
||||||
//Psiónico
|
|
||||||
} else if (className.equals(classStrings[13])) {
|
|
||||||
//Sacerdote rúnico
|
|
||||||
} else {
|
|
||||||
//Señor de la Guerra
|
|
||||||
//TODO: Mushu
|
|
||||||
pgExtra = 12;
|
|
||||||
curativeEffortsExtra = 7;
|
|
||||||
defVOL = 2;
|
|
||||||
}
|
|
||||||
pg = maxPg = atk[CON] + pgExtra;
|
|
||||||
curativeEfforts = maxCurativeEfforts = Player.getModifier(atk[CON]) + curativeEffortsExtra;
|
|
||||||
def[CA] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[FUE])) + defCA;
|
|
||||||
def[FORT] = 10 + level / 2 + Player.getModifier(Math.max(atk[CON], atk[FUE])) + defFORT;
|
|
||||||
def[REF] = 10 + level / 2 + Player.getModifier(Math.max(atk[DES], atk[INT])) + defREF;
|
|
||||||
def[VOL] = 10 + level / 2 + Player.getModifier(Math.max(atk[CAR], atk[SAB])) + defVOL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getModifier(int i) {
|
public static int getModifier(int i) {
|
||||||
|
@ -238,8 +253,4 @@ public class Player {
|
||||||
public int getTotalModifier(int i) {
|
public int getTotalModifier(int i) {
|
||||||
return getModifier(i) + level / 2;
|
return getModifier(i) + level / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLevel (int px) {
|
|
||||||
return 0; //TODO: substitute level by px and autoconvert
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -26,8 +26,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:id="@+id/editLevelIntro"
|
android:id="@+id/editPxIntro"
|
||||||
android:hint="@string/level"
|
android:hint="@string/px"
|
||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -29,22 +29,22 @@
|
||||||
<item
|
<item
|
||||||
android:title="@string/action_time_rest"
|
android:title="@string/action_time_rest"
|
||||||
android:id="@+id/action_time_rest"
|
android:id="@+id/action_time_rest"
|
||||||
android:orderInCategory="2"
|
android:orderInCategory="4"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:title="@string/action_time_day"
|
android:title="@string/action_time_day"
|
||||||
android:id="@+id/action_time_day"
|
android:id="@+id/action_time_day"
|
||||||
android:orderInCategory="5"
|
android:orderInCategory="3"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:title="@string/action_time_long_rest"
|
android:title="@string/action_time_long_rest"
|
||||||
android:id="@+id/action_time_long_rest"
|
android:id="@+id/action_time_long_rest"
|
||||||
android:orderInCategory="4"
|
android:orderInCategory="5"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:title="@string/action_time_encounter_end"
|
android:title="@string/action_time_encounter_end"
|
||||||
android:id="@+id/action_time_encounter_end"
|
android:id="@+id/action_time_encounter_end"
|
||||||
android:orderInCategory="5"
|
android:orderInCategory="2"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,18 @@
|
||||||
<string name="REF">REF</string>
|
<string name="REF">REF</string>
|
||||||
<string name="VOL">VOL</string>
|
<string name="VOL">VOL</string>
|
||||||
<string name="action_time">Avanzar tiempo</string>
|
<string name="action_time">Avanzar tiempo</string>
|
||||||
<string name="action_time_day">Día</string>
|
<string name="action_time_day">Día siguiente</string>
|
||||||
<string name="action_time_encounter_end">Fin de encuentro</string>
|
<string name="action_time_encounter_end">Fin de encuentro</string>
|
||||||
<string name="action_time_long_rest">Descanso largo</string>
|
<string name="action_time_long_rest">Descanso largo</string>
|
||||||
<string name="action_time_rest">Descanso corto</string>
|
<string name="action_time_rest">Descanso corto</string>
|
||||||
<string name="action_time_turn">Turno siguiente</string>
|
<string name="action_time_turn">Turno siguiente</string>
|
||||||
<string name="curative_display_text">Tienes %1$d de %2$d esfuerzos curativos</string>
|
<string name="curative_display_text">Tienes %1$d de %2$d esfuerzos curativos</string>
|
||||||
|
<string name="px">PX</string>
|
||||||
|
<string name="px_awarded_hint">PX del encuentro</string>
|
||||||
|
<string name="px_awarded_title">Introduce los PX ganados</string>
|
||||||
|
<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="empty_field">Por favor, escribe algo</string>
|
||||||
</resources>
|
</resources>
|
|
@ -54,7 +54,11 @@
|
||||||
<string name="suffer_damage">Input the damage suffered</string>
|
<string name="suffer_damage">Input the damage suffered</string>
|
||||||
<string name="suffer_damage_hint">PG lost</string>
|
<string name="suffer_damage_hint">PG lost</string>
|
||||||
<string name="me">Me</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>
|
||||||
|
<string name="message_no_px">You haven\'t won any XP</string>
|
||||||
<string name="other">Otro</string>
|
<string name="other">Otro</string>
|
||||||
|
<string name="px">XP</string>
|
||||||
|
|
||||||
<string name="FUE">FUE</string>
|
<string name="FUE">FUE</string>
|
||||||
<string name="CON">CON</string>
|
<string name="CON">CON</string>
|
||||||
|
@ -63,4 +67,8 @@
|
||||||
<string name="CAR">CAR</string>
|
<string name="CAR">CAR</string>
|
||||||
<string name="SAB">SAB</string>
|
<string name="SAB">SAB</string>
|
||||||
<string name="action_save">Save</string>
|
<string name="action_save">Save</string>
|
||||||
|
<string name="dialog_resolve_max_pg_hint">Max PG</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>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Reference in a new issue