Changed package name
This commit is contained in:
parent
f5fbf9b5fa
commit
2501b899fd
9 changed files with 95 additions and 94 deletions
|
|
@ -3,9 +3,8 @@ apply plugin: 'com.android.application'
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 21
|
compileSdkVersion 21
|
||||||
buildToolsVersion "21.1.2"
|
buildToolsVersion "21.1.2"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.ddns.kauron.dungeonmanager"
|
applicationId 'com.kauron.dungeonmanager'
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 1
|
versionCode 1
|
||||||
|
|
@ -17,9 +16,11 @@ android {
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
productFlavors {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.ddns.kauron.dungeonmanager" >
|
package="com.kauron.dungeonmanager" >
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
android:label="@string/title_activity_introduction" >
|
android:label="@string/title_activity_introduction" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="com.ddns.kauron.dungeonmanager.MainActivity" />
|
android:value=".MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.kauron.dungeonmanager;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class HealthDialogFragment extends DialogFragment {
|
||||||
|
//TODO: convert to method and dialog, without class
|
||||||
|
|
||||||
|
static HealthDialogFragment newInstance(int curativeEfforts) {
|
||||||
|
HealthDialogFragment f = new HealthDialogFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putInt("curativeEfforts", curativeEfforts);
|
||||||
|
f.setArguments(args);
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HealthDialogListener {
|
||||||
|
public void heal(DialogFragment dialog, boolean uses);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HealthDialogListener mListener;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
try{
|
||||||
|
mListener = (HealthDialogListener) activity;
|
||||||
|
}catch(ClassCastException e){
|
||||||
|
throw new ClassCastException(activity.toString() + " must implement HealthDialogListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
builder.setMessage(com.ddns.kauron.dungeonmanager.R.string.new_energies_message)
|
||||||
|
.setTitle(com.ddns.kauron.dungeonmanager.R.string.new_energies)
|
||||||
|
.setPositiveButton(com.ddns.kauron.dungeonmanager.R.string.me, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
mListener.heal(HealthDialogFragment.this, true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(com.ddns.kauron.dungeonmanager.R.string.other, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
mListener.heal(HealthDialogFragment.this, false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNeutralButton(com.ddns.kauron.dungeonmanager.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
158
app/src/main/java/com/kauron/dungeonmanager/Introduction.java
Normal file
158
app/src/main/java/com/kauron/dungeonmanager/Introduction.java
Normal file
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.kauron.dungeonmanager;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
|
public class Introduction extends ActionBarActivity {
|
||||||
|
|
||||||
|
EditText name, level;
|
||||||
|
EditText fue, con, des, sab, intel, car;
|
||||||
|
Spinner classSpinner, raceSpinner;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
setContentView(com.ddns.kauron.dungeonmanager.R.layout.activity_introduction);
|
||||||
|
name = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.editNameIntro);
|
||||||
|
level = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.editLevelIntro);
|
||||||
|
|
||||||
|
fue = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.FUE);
|
||||||
|
con = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.CON);
|
||||||
|
des = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.DES);
|
||||||
|
sab = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.SAB);
|
||||||
|
intel = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.INT);
|
||||||
|
car = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.CAR);
|
||||||
|
|
||||||
|
classSpinner = (Spinner) findViewById(com.ddns.kauron.dungeonmanager.R.id.classSpinner);
|
||||||
|
classSpinner.setAdapter(
|
||||||
|
new ArrayAdapter<>(
|
||||||
|
this,
|
||||||
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
|
Player.classStrings
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
raceSpinner = (Spinner) findViewById(com.ddns.kauron.dungeonmanager.R.id.raceSpinner);
|
||||||
|
raceSpinner.setAdapter(
|
||||||
|
new ArrayAdapter<>(
|
||||||
|
this,
|
||||||
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
|
Player.raceStrings
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(com.ddns.kauron.dungeonmanager.R.menu.menu_introduction, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle action bar item clicks here. The action bar will
|
||||||
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
//noinspection SimplifiableIfStatement
|
||||||
|
if (id == com.ddns.kauron.dungeonmanager.R.id.action_finish) {
|
||||||
|
if(finished()) {
|
||||||
|
this.finish();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
com.ddns.kauron.dungeonmanager.R.string.missing_info_error,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: fix this
|
||||||
|
private boolean finished() {
|
||||||
|
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor ed = p.edit();
|
||||||
|
String nameString = name.getText().toString();
|
||||||
|
String classString = Player.classStrings[classSpinner.getSelectedItemPosition()];
|
||||||
|
String raceString = Player.raceStrings[raceSpinner.getSelectedItemPosition()];
|
||||||
|
|
||||||
|
int levelInt = 0;
|
||||||
|
if (!level.getText().toString().isEmpty())
|
||||||
|
levelInt = 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.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.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(getIntent().getExtras().getBoolean("first_time")) {
|
||||||
|
if (
|
||||||
|
!nameString.isEmpty() &&
|
||||||
|
!classString.equals(Player.classStrings[0]) &&
|
||||||
|
!raceString.equals(Player.raceStrings[0]) &&
|
||||||
|
levelInt != 0 &&
|
||||||
|
car != 0 &&
|
||||||
|
fue != 0 &&
|
||||||
|
con != 0 &&
|
||||||
|
des != 0 &&
|
||||||
|
intel != 0 &&
|
||||||
|
sab != 0
|
||||||
|
) {
|
||||||
|
//first save it all
|
||||||
|
ed.putString("playerName", nameString);
|
||||||
|
ed.putString("className", classString);
|
||||||
|
ed.putString("raceName", raceString);
|
||||||
|
ed.putInt("level", levelInt);
|
||||||
|
|
||||||
|
ed.putInt("fue", fue);
|
||||||
|
ed.putInt("car", car);
|
||||||
|
ed.putInt("int", intel);
|
||||||
|
ed.putInt("sab", sab);
|
||||||
|
ed.putInt("con", con);
|
||||||
|
ed.putInt("des", des);
|
||||||
|
|
||||||
|
ed.putBoolean("saved", true);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!nameString.isEmpty()) ed.putString("playerName", nameString);
|
||||||
|
if (!classString.isEmpty()) ed.putString("className", classString);
|
||||||
|
if (!raceString.isEmpty()) ed.putString("raceName", raceString);
|
||||||
|
if (levelInt != 0) ed.putInt("level", levelInt);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
ed.apply();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
396
app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
Normal file
396
app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
Normal file
|
|
@ -0,0 +1,396 @@
|
||||||
|
package com.kauron.dungeonmanager;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.InputType;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
|
public class MainActivity extends ActionBarActivity
|
||||||
|
implements HealthDialogFragment.HealthDialogListener{
|
||||||
|
|
||||||
|
public static final int CURRENT_PG = 1, NULL = 0;
|
||||||
|
|
||||||
|
public Player player;
|
||||||
|
private boolean undo;
|
||||||
|
private int undoObject, undoPreviousValue;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(com.ddns.kauron.dungeonmanager.R.layout.activity_main);
|
||||||
|
undo = false;
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(com.ddns.kauron.dungeonmanager.R.menu.menu_main, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu (Menu menu) {
|
||||||
|
menu.findItem(com.ddns.kauron.dungeonmanager.R.id.action_undo).setVisible(undo);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle action bar item clicks here. The action bar will
|
||||||
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
//noinspection SimplifiableIfStatement
|
||||||
|
if (id == com.ddns.kauron.dungeonmanager.R.id.action_cure) {
|
||||||
|
showHealthDialog();
|
||||||
|
return true;
|
||||||
|
} else if (id == com.ddns.kauron.dungeonmanager.R.id.action_edit_basics) {
|
||||||
|
//TODO: try this startChildActivity()
|
||||||
|
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
||||||
|
Intent intent = new Intent(this, Introduction.class);
|
||||||
|
startActivity(intent.putExtra(
|
||||||
|
"first_time",
|
||||||
|
!p.getBoolean("saved", false)
|
||||||
|
));
|
||||||
|
restoreData();
|
||||||
|
return true;
|
||||||
|
} else if (id == com.ddns.kauron.dungeonmanager.R.id.action_undo) {
|
||||||
|
undo();
|
||||||
|
return true;
|
||||||
|
} else if (id == com.ddns.kauron.dungeonmanager.R.id.action_reset) {
|
||||||
|
|
||||||
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
|
alert.setTitle(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation_title));
|
||||||
|
alert.setMessage(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation));
|
||||||
|
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
com.ddns.kauron.dungeonmanager.R.string.message_reset,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
|
||||||
|
restoreData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
// Canceled.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.show();
|
||||||
|
// } else if (id == R.id.action_save) {
|
||||||
|
// saveData();
|
||||||
|
// } else if (id == R.id.action_load) {
|
||||||
|
// restoreData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showHealthDialog(){
|
||||||
|
DialogFragment dialog = HealthDialogFragment.newInstance(player.getCurativeEfforts());
|
||||||
|
dialog.show(getFragmentManager(), "HealthDialogFragment");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
Log.e("UTIL", "pause");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
Log.e("UTIL", "resume");
|
||||||
|
restoreData();
|
||||||
|
healthStatusCheck();
|
||||||
|
updateCurativeString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
Log.e("UTIL", "stop");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
Log.e("UTIL", "destroy");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void heal(DialogFragment dialog, boolean uses) {
|
||||||
|
int hasCured = player.recoverPg(Player.USE_CURATIVE_EFFORT, uses);
|
||||||
|
if (hasCured == Player.NOT_CURED) {
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
com.ddns.kauron.dungeonmanager.R.string.no_curative_efforts_error,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
} else {
|
||||||
|
if(hasCured == Player.MAXED){
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
com.ddns.kauron.dungeonmanager.R.string.maxed_curative,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
}
|
||||||
|
getSharedPreferences("basics", MODE_PRIVATE).edit()
|
||||||
|
.putInt("pg", player.getPg())
|
||||||
|
.putInt("curativeEfforts", player.getCurativeEfforts())
|
||||||
|
.apply();
|
||||||
|
updateCurativeString();
|
||||||
|
healthStatusCheck();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void damage(final View view){
|
||||||
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
|
alert.setTitle(getString(com.ddns.kauron.dungeonmanager.R.string.suffer_damage));
|
||||||
|
|
||||||
|
// Set an EditText view to get user input
|
||||||
|
final EditText input = new EditText(this);
|
||||||
|
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
|
input.setHint(com.ddns.kauron.dungeonmanager.R.string.suffer_damage_hint);
|
||||||
|
|
||||||
|
alert.setView(input);
|
||||||
|
|
||||||
|
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
Button pg = (Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent);
|
||||||
|
try {
|
||||||
|
int preValue = Integer.parseInt(pg.getText().toString());
|
||||||
|
int damage = Integer.parseInt(input.getText().toString());
|
||||||
|
player.losePg(damage);
|
||||||
|
pg.setText(
|
||||||
|
String.valueOf(player.getPg())
|
||||||
|
);
|
||||||
|
//finished correctly, then apply values to undo's
|
||||||
|
undo = true;
|
||||||
|
undoPreviousValue = preValue;
|
||||||
|
undoObject = CURRENT_PG;
|
||||||
|
getSharedPreferences("basics", MODE_PRIVATE).edit()
|
||||||
|
.putInt("pg", player.getPg())
|
||||||
|
.apply();
|
||||||
|
healthStatusCheck();
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
// Canceled.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void healthStatusCheck() {
|
||||||
|
int status = player.getState();
|
||||||
|
int lastState = player.getLastState();
|
||||||
|
Button pg = (Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent);
|
||||||
|
pg.setText(String.valueOf(player.getPg()));
|
||||||
|
if (status == Player.MUERTO) {
|
||||||
|
pg.setTextColor(Color.BLACK);
|
||||||
|
pg.setBackgroundColor(Color.RED);
|
||||||
|
|
||||||
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||||
|
alert.setTitle(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation_title));
|
||||||
|
alert.setMessage(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation));
|
||||||
|
alert.setPositiveButton(com.ddns.kauron.dungeonmanager.R.string.action_undo, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
undo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.setNegativeButton(com.ddns.kauron.dungeonmanager.R.string.die, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
com.ddns.kauron.dungeonmanager.R.string.message_death,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply();
|
||||||
|
restoreData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.show();
|
||||||
|
} else if (status == Player.DEBILITADO) {
|
||||||
|
pg.setBackgroundColor(android.R.drawable.btn_default);
|
||||||
|
pg.setTextColor(Color.RED);
|
||||||
|
if(lastState != Player.SAME) {
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
com.ddns.kauron.dungeonmanager.R.string.state_changed_debilitado,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
}
|
||||||
|
} else if (status == Player.MALHERIDO) {
|
||||||
|
pg.setBackgroundColor(android.R.drawable.btn_default);
|
||||||
|
pg.setTextColor(Color.YELLOW);
|
||||||
|
if(lastState != Player.SAME) {
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
com.ddns.kauron.dungeonmanager.R.string.state_changed_malherido,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pg.setTextColor(getResources().getColor(
|
||||||
|
com.ddns.kauron.dungeonmanager.R.color.abc_primary_text_material_dark
|
||||||
|
));
|
||||||
|
pg.setBackgroundColor(android.R.drawable.btn_default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void restoreData(){
|
||||||
|
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
|
||||||
|
//restore state
|
||||||
|
if (!p.getBoolean("saved", false)) {
|
||||||
|
Intent intent = new Intent(this, Introduction.class);
|
||||||
|
startActivity(intent.putExtra(
|
||||||
|
"first_time",
|
||||||
|
!p.getBoolean("saved", false)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if(player == null) {
|
||||||
|
player = new Player(
|
||||||
|
p.getString("playerName", getString(com.ddns.kauron.dungeonmanager.R.string.adventurer_name)),
|
||||||
|
p.getString("className", getString(com.ddns.kauron.dungeonmanager.R.string.class_name)),
|
||||||
|
p.getString("raceName", getString(com.ddns.kauron.dungeonmanager.R.string.race_name)),
|
||||||
|
p.getInt("level", 1),
|
||||||
|
new int[] {
|
||||||
|
p.getInt("fue", 10),
|
||||||
|
p.getInt("con", 10),
|
||||||
|
p.getInt("des", 10),
|
||||||
|
p.getInt("int", 10),
|
||||||
|
p.getInt("sab", 10),
|
||||||
|
p.getInt("car", 10),
|
||||||
|
},
|
||||||
|
new int[18],
|
||||||
|
new Power[4]);
|
||||||
|
} else {
|
||||||
|
player.setName(p.getString("playerName", getString(com.ddns.kauron.dungeonmanager.R.string.adventurer_name)));
|
||||||
|
player.setClassName(p.getString("className", getString(com.ddns.kauron.dungeonmanager.R.string.class_name)));
|
||||||
|
player.setRaceName(p.getString("raceName", getString(com.ddns.kauron.dungeonmanager.R.string.race_name)));
|
||||||
|
player.setLevel(p.getInt("level", 1));
|
||||||
|
//TODO: restore pg
|
||||||
|
player.setAtk(new int[]{
|
||||||
|
p.getInt("fue", 10),
|
||||||
|
p.getInt("con", 10),
|
||||||
|
p.getInt("des", 10),
|
||||||
|
p.getInt("int", 10),
|
||||||
|
p.getInt("sab", 10),
|
||||||
|
p.getInt("car", 10),
|
||||||
|
});
|
||||||
|
healthStatusCheck();
|
||||||
|
updateCurativeString();
|
||||||
|
}
|
||||||
|
//set restored values to the respective fields
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.nameText)).setText(player.getName());
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.raceText)).setText(player.getRaceName());
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.classText)).setText(player.getClassName());
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.lvl)).setText(String.valueOf(player.getLevel()));
|
||||||
|
|
||||||
|
((Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent)).setText(String.valueOf(player.getPg()));
|
||||||
|
|
||||||
|
//attacks
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.FUE)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.FUE) + ":" + player.getFue()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.CON)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.CON) + ":" + player.getCon()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.DES)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.DES) + ":" + player.getDes()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.INT)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.INT) + ":" + player.getInt()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.SAB)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.SAB) + ":" + player.getSab()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.CAR)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.CAR) + ":" + player.getCar()
|
||||||
|
);
|
||||||
|
|
||||||
|
//defenses
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.CA)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.CA) + ": " + player.getCa()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.FORT)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.FORT) + ": " + player.getFort()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.REF)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.REF) + ": " + player.getRef()
|
||||||
|
);
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.VOL)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.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() {
|
||||||
|
((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.curativeEffortsText)).setText(
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.curative_display_text1) + " " +
|
||||||
|
player.getCurativeEfforts() + " " +
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.curative_display_text2) + " " +
|
||||||
|
player.getMaxCurativeEfforts() + " " +
|
||||||
|
getString(com.ddns.kauron.dungeonmanager.R.string.curative_display_text3)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void undo() {
|
||||||
|
String message = "";
|
||||||
|
if(undoObject == CURRENT_PG){
|
||||||
|
((Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent)).setText(String.valueOf(undoPreviousValue));
|
||||||
|
player.setPg(undoPreviousValue);
|
||||||
|
undoObject = NULL;
|
||||||
|
message = getString(com.ddns.kauron.dungeonmanager.R.string.action_undo_current_pg);
|
||||||
|
}
|
||||||
|
Toast.makeText(
|
||||||
|
getApplicationContext(),
|
||||||
|
message,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
undo = false;
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
245
app/src/main/java/com/kauron/dungeonmanager/Player.java
Normal file
245
app/src/main/java/com/kauron/dungeonmanager/Player.java
Normal file
|
|
@ -0,0 +1,245 @@
|
||||||
|
package com.kauron.dungeonmanager;
|
||||||
|
|
||||||
|
public class Player {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Names for the classes
|
||||||
|
*/
|
||||||
|
public static final String[] classStrings = {
|
||||||
|
"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"
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Names for the races
|
||||||
|
*/
|
||||||
|
public static final String[] raceStrings = new String[] {
|
||||||
|
"Raza", "Dracónido", "Eladrín", "Elfo", "Enano", "Gitzherai", "Humanos", "Medianos",
|
||||||
|
"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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Values for defenses
|
||||||
|
*/
|
||||||
|
public static final int CA = 0, FORT = 1, REF = 2, VOL = 3;
|
||||||
|
|
||||||
|
//TODO: develop abilities
|
||||||
|
/**
|
||||||
|
* 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[] abilityString = new String[] {
|
||||||
|
"Acrobacias", "Aguante", "Arcanos", "Atletismo", "Diplomacia", "Dungeons", "Engañar",
|
||||||
|
"Historia", "Hurto", "Intimidar", "Naturaleza", "Percepción", "Perspicacia", "Recursos",
|
||||||
|
"Religión", "Sanar", "Sigilo"
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Values for the current living state
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
private int pg, maxPg;
|
||||||
|
private int state, lastState;
|
||||||
|
private int curativeEfforts, maxCurativeEfforts;
|
||||||
|
//TODO: convert race and class to integer values
|
||||||
|
private int classInt, raceInt;
|
||||||
|
private String name, className, raceName;
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
private int[] atk, def, abilities;
|
||||||
|
private Power[] powers;
|
||||||
|
|
||||||
|
public Player(
|
||||||
|
String name, String className, String raceName,
|
||||||
|
int level, int[] atk, int[] abilities,
|
||||||
|
Power[] powers
|
||||||
|
){
|
||||||
|
this.name = name;
|
||||||
|
this.level = level;
|
||||||
|
this.raceName = raceName;
|
||||||
|
this.className = className;
|
||||||
|
this.def = new int[4];
|
||||||
|
setAtk(atk);
|
||||||
|
setState();
|
||||||
|
|
||||||
|
this.abilities = abilities;
|
||||||
|
this.powers = powers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMaxCurativeEfforts() {return maxCurativeEfforts;}
|
||||||
|
public void setMaxCurativeEfforts(int maxCurativeEfforts) {this.maxCurativeEfforts = maxCurativeEfforts;}
|
||||||
|
|
||||||
|
public int getCurativeEfforts() {return curativeEfforts;}
|
||||||
|
public void setCurativeEffort(int curativeEfforts) {this.curativeEfforts = curativeEfforts;}
|
||||||
|
|
||||||
|
public int getLevel() {return level;}
|
||||||
|
public void setLevel(int level) {this.level = level;}
|
||||||
|
|
||||||
|
public int getMaxPg() {return maxPg;}
|
||||||
|
public void setMaxPg(int maxPg) {this.maxPg = maxPg;}
|
||||||
|
|
||||||
|
public int getPg() {return pg;}
|
||||||
|
public void setPg(int pg) {this.pg = pg; setState();}
|
||||||
|
public void losePg(int damage) {
|
||||||
|
pg -= damage;
|
||||||
|
setState();
|
||||||
|
}
|
||||||
|
public int recoverPg(int recovered, boolean uses) {
|
||||||
|
if(recovered == USE_CURATIVE_EFFORT){
|
||||||
|
if(uses && curativeEfforts <= 0) return NOT_CURED;
|
||||||
|
else {
|
||||||
|
if(uses && pg < maxPg) curativeEfforts--;
|
||||||
|
if (pg < 0) {
|
||||||
|
pg = 0;
|
||||||
|
} else {
|
||||||
|
pg += maxPg / 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (pg < 0) {
|
||||||
|
pg = 0;
|
||||||
|
} else {
|
||||||
|
pg += recovered;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setState();
|
||||||
|
|
||||||
|
if (pg > maxPg) {pg = maxPg; return MAXED;}
|
||||||
|
|
||||||
|
return CURED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastState() {return lastState == state ? SAME : lastState;}
|
||||||
|
public 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;
|
||||||
|
else state = OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {return name;}
|
||||||
|
public void setName(String name) {this.name = name;}
|
||||||
|
|
||||||
|
public String getClassName() {return className;}
|
||||||
|
public void setClassName(String className) {
|
||||||
|
this.className = className;
|
||||||
|
if(atk!=null) setClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRaceName() {return raceName;}
|
||||||
|
public void setRaceName(String raceName) {this.raceName = raceName;}
|
||||||
|
|
||||||
|
//TODO: implement time in the app
|
||||||
|
public void rest(boolean length) {
|
||||||
|
if(length) {
|
||||||
|
curativeEfforts = maxCurativeEfforts;
|
||||||
|
for(Power p : powers){
|
||||||
|
if(p != null) p.recover();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAtk(int[] atk) {this.atk = atk; if(className!=null) setClass();}
|
||||||
|
|
||||||
|
public int getFue() {return atk[FUE];}
|
||||||
|
public int getCon() {return atk[CON];}
|
||||||
|
public int getSab() {return atk[SAB];}
|
||||||
|
public int getCar() {return atk[CAR];}
|
||||||
|
public int getDes() {return atk[DES];}
|
||||||
|
public int getInt() {return atk[INT];}
|
||||||
|
public int getCa() {return def[CA];}
|
||||||
|
public int getFort() {return def[FORT];}
|
||||||
|
public int getRef() {return def[REF];}
|
||||||
|
public int getVol() {return def[VOL];}
|
||||||
|
|
||||||
|
//TODO: set the pg level dependant
|
||||||
|
//TODO: only setPg if the
|
||||||
|
public void setClass() {
|
||||||
|
int pgExtra = 0, curativeEffortsExtra = 0, defCA = 0, defFORT = 0, defVOL = 0, defREF = 0;
|
||||||
|
if(className.equals(classStrings[1])){
|
||||||
|
//Ardiente
|
||||||
|
} else if (className.equals(classStrings[2])) {
|
||||||
|
//Brujo
|
||||||
|
//TODO: Kauron
|
||||||
|
pgExtra = 12;
|
||||||
|
curativeEffortsExtra = 6;
|
||||||
|
defVOL = defREF = 1;
|
||||||
|
} else if (className.equals(classStrings[3])) {
|
||||||
|
//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) {
|
||||||
|
return i / 2 - 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalModifier(int i) {
|
||||||
|
return getModifier(i) + level / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getLevel (int px) {
|
||||||
|
return 0; //TODO: substitute level by px and autoconvert
|
||||||
|
}
|
||||||
|
}
|
||||||
24
app/src/main/java/com/kauron/dungeonmanager/Power.java
Normal file
24
app/src/main/java/com/kauron/dungeonmanager/Power.java
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.kauron.dungeonmanager;
|
||||||
|
|
||||||
|
public class Power {
|
||||||
|
public static final int DIARIO = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, OPORTUNIDAD = 4;
|
||||||
|
|
||||||
|
private boolean used;
|
||||||
|
private int type;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
public Power(String name, int type){
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
used = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName(){return name;}
|
||||||
|
public int getType(){return type;}
|
||||||
|
|
||||||
|
public boolean isUsed(){return used;}
|
||||||
|
|
||||||
|
public void use(){used = true;}
|
||||||
|
public void recover(){used = false;}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
tools:context="com.ddns.kauron.dungeonmanager.Introduction">
|
tools:context="com.ddns.kauron.com.kauron.dungeonmanager.Introduction">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="com.ddns.kauron.dungeonmanager.Introduction">
|
tools:context="com.kauron.dungeonmanager.Introduction">
|
||||||
<item android:id="@+id/action_finish"
|
<item android:id="@+id/action_finish"
|
||||||
android:title="@string/action_finish"
|
android:title="@string/action_finish"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
|
|
|
||||||
Reference in a new issue