Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully functioning character creation #35

Merged
merged 195 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
812c53d
Started to add the character class into the Game.
Mar 30, 2017
d77d250
+ Added references in game_references.xml for
Mar 31, 2017
24335df
Actually pushed the files
Mar 31, 2017
43fdacc
Started to add the character class into the Game.
Mar 30, 2017
bc8c450
+ Added references in game_references.xml for
Mar 31, 2017
1c12e9c
Actually pushed the files
Mar 31, 2017
04cc798
Merge branch 'master' of https://github.com/JayTSmith/mazes_and_minot…
Apr 1, 2017
9a6dee9
+ Changed the code to use AttributeScores rather than just raw Integers.
Apr 4, 2017
03c44fd
+ Added Money enum
Apr 5, 2017
a87431e
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 5, 2017
59b3722
+ Changed Character class to PlayerCharacter
Apr 5, 2017
da35948
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 7, 2017
4a3abbc
+ Changed getCoreStatScore to getScore
Apr 7, 2017
83957e3
+ Modified LevelUp and LevelDown to restore the proper scores rather …
Apr 10, 2017
7d1ef55
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 13, 2017
0d2bde8
Removed the EffectiveLevel property from BaseClass
Apr 13, 2017
250c314
+ Added methods for saving throws in PlayerCharacter.java
Apr 16, 2017
904454a
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 16, 2017
ac9ee74
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 18, 2017
e8dc8ed
Merge branch 'master' of https://github.com/JayTSmith/mazes_and_minot…
Apr 18, 2017
86f56e6
+ Added the Equipment functionality to Barbarian
Apr 20, 2017
a2ec89b
+ Added the equipment functionality to the PlayerCharacter
Apr 20, 2017
6683563
+ Fixed more typos
Apr 20, 2017
28fde6c
+ Changed Portfolio to work with the new method of Character Creation
Apr 20, 2017
22d86c8
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 20, 2017
4a2a6d1
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 24, 2017
dcf49f4
+ Changed mWeapon to mCurrentWeapon
Apr 24, 2017
91b9c46
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 25, 2017
786684d
+ Made getHitTotal function properly
Apr 25, 2017
a96a1d7
+ Removed initialization from PlayerCharacter's constructor.
Apr 25, 2017
519e43f
Merge https://github.com/CIS-Extra/mazes_and_minotaurs
Apr 25, 2017
0c01dcb
Merge branch 'master' of https://github.com/JayTSmith/mazes_and_minot…
Apr 25, 2017
09ed5d3
+ Added GSON lib.
May 9, 2017
7b02b97
Merge https://github.com/CIS-Extra/mazes_and_minotaurs into development
May 9, 2017
7cb8a2a
Fixed loading functionality.
May 10, 2017
7d11444
Added javadoc for SaveAndLoadPerformer
May 10, 2017
e772845
Merge https://github.com/CIS-Extra/mazes_and_minotaurs into development
May 10, 2017
e5331b3
Finished commit.
May 10, 2017
d439588
Changed and added methods to the Util class.
May 15, 2017
e5dff23
Finished with Amazon
May 15, 2017
ee3eb67
Created Centaur (should be ready to implement).
May 15, 2017
7646396
Fixed bugged gold for Amazon and Barb.
May 15, 2017
92de2ca
Created and added Noble
May 15, 2017
5487495
Added and Created Spearman class.
May 15, 2017
eec6f59
Added Battle Fortune to Noble.
May 15, 2017
4ec399f
Setup project on new PC.
JayTSmith Sep 8, 2017
f53c723
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 8, 2017
b06443c
Fully implemented Centaur.
JayTSmith Sep 8, 2017
9b39523
Fully implemented Thief.
JayTSmith Sep 11, 2017
3576fdd
Created Hunter and fully implemented!
JayTSmith Sep 11, 2017
f6f3e2c
Moved getSpecialTalent to Specialist.java
JayTSmith Sep 11, 2017
08758d5
Removed getSpecialTalent from the respective classes.
JayTSmith Sep 11, 2017
a194f37
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 11, 2017
2575374
Added new values.
JayTSmith Sep 12, 2017
ce459f6
Renamed the values.
JayTSmith Sep 12, 2017
2676256
Resolved the TODOs in the code.
JayTSmith Sep 12, 2017
b354d92
Fixed a typo.
JayTSmith Sep 12, 2017
ec95ff5
Removed methods that are inside of the Level Interface, and made getL…
JayTSmith Sep 12, 2017
7e1cf79
Fixed issue #2.
JayTSmith Sep 12, 2017
4e2087a
Added functionality to Patron.
JayTSmith Sep 12, 2017
1e85a40
Fixed Specialist lacking the Level Descriptions.
JayTSmith Sep 12, 2017
7293ca1
Added the instance field for possibleStartWeapons to BaseClass
JayTSmith Sep 13, 2017
e800c12
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 13, 2017
7097c18
Merge branch 'master' into exposure
JayTSmith Sep 13, 2017
eff6621
Updated Barbarian to new format.
JayTSmith Sep 13, 2017
7f965aa
Added the instance field mPossibleWeaponsOfChoice to Warrior.
JayTSmith Sep 13, 2017
fdbe7ca
Changed how Amazon would validate starting weapon.
JayTSmith Sep 13, 2017
c83bd08
Changed Warrior so it would still weaponOfChoice even if argument was…
JayTSmith Sep 13, 2017
1299f0c
Changed Amazon and Barbarian to remove their checking of weaponOfChoice.
JayTSmith Sep 13, 2017
4e19561
Centaur has been brought up-to-date.
JayTSmith Sep 13, 2017
741409c
Noble has been brought up-to-date.
JayTSmith Sep 13, 2017
e8db4bb
Spearman has been brought up-to-date.
JayTSmith Sep 13, 2017
b8d0ffa
Added instance field mPossibleWeaponsOfChoice to Specialist.
JayTSmith Sep 13, 2017
9e0ab4c
Hunter has been brought up-to-date.
JayTSmith Sep 13, 2017
85c6349
Thief has been brought up-to-date.
JayTSmith Sep 13, 2017
31bd8a9
Added safe-checking to Specialist's setWeaponOfChoice
JayTSmith Sep 13, 2017
8c0f346
All available Magicans classes have been brought up-to-date.
JayTSmith Sep 13, 2017
f75c8f0
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 14, 2017
d27db45
Fixed bug with App Crash
JayTSmith Sep 14, 2017
0169ee4
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 14, 2017
7499c0b
Fixed EDC issue where it could return the incorrect values.
JayTSmith Sep 14, 2017
c85f73a
Added Patreon instance field to PlayerCharacter
JayTSmith Sep 14, 2017
799f9c2
Created res/dialog_class_selection.xml
JayTSmith Sep 15, 2017
b68b587
Created the layout of dialog_class_selection.xml
JayTSmith Sep 15, 2017
913eab2
Created the layout of dialog_class_selection.xml
JayTSmith Sep 15, 2017
d9baac9
Created DetailFragment class
JayTSmith Sep 15, 2017
4c80358
Have a very rough version of the new dialog working.
JayTSmith Sep 15, 2017
1809e9e
Still a rough version but slightly improved.
JayTSmith Sep 15, 2017
7961e69
Added a blank construcutor for all subclasses of BaseClass.
JayTSmith Sep 18, 2017
3656988
Added values into the Classes Enum
JayTSmith Sep 18, 2017
6bcbeb2
Created a custom adapter.
JayTSmith Sep 19, 2017
5905a15
Created the layout for weapons in a spinner.
JayTSmith Sep 19, 2017
7b06207
Finalized the layout of the spinner items
JayTSmith Sep 19, 2017
b9a8ca5
Added getters
JayTSmith Sep 19, 2017
009b549
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 19, 2017
8db7102
Changed startGold to startMoney.
JayTSmith Sep 19, 2017
bc5e321
Fixed a massive issue regarding scope in the character package.
JayTSmith Sep 19, 2017
3ec3423
Incomplete update for editing attribute values on the character
JayTSmith Sep 20, 2017
c198a02
Added the ability to edit the Might score.
JayTSmith Sep 20, 2017
24a44e5
Added the edit ability to the rest of the attribute scores.
JayTSmith Sep 20, 2017
80c454f
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 20, 2017
057046b
Modified the layout of attribute editing dialog.
JayTSmith Sep 20, 2017
5503a00
Merge branch 'friday-rough-launch'
JayTSmith Sep 20, 2017
0b8cdca
Merge branch 'master' into create-character
JayTSmith Sep 20, 2017
eb22613
Added the proper values for the labels on the CharacterSheet.
JayTSmith Sep 20, 2017
d8145f7
Adding mCurrentHits functionality.
JayTSmith Sep 20, 2017
2ac02f1
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 21, 2017
1446dfd
Merge branch 'master' into friday-fixup
JayTSmith Sep 21, 2017
8d6136c
Rearranged the layout of the Attribute edit dialog to fix issues of c…
JayTSmith Sep 21, 2017
13d7498
Merge branch 'master' into friday-fixup
JayTSmith Sep 21, 2017
99822ee
Added safe-checking when getting a value from the dialog.
JayTSmith Sep 21, 2017
7e79214
Fixed an issue where it would refresh the UI regardless of change.
JayTSmith Sep 21, 2017
74da8a4
Added value checking onto the setCurHits method of PlayerCharacter.
JayTSmith Sep 21, 2017
c1499f4
Moved StatChangeFragment to fragments package.
JayTSmith Sep 21, 2017
159e2e1
Created the HitsChangeFragment class
JayTSmith Sep 21, 2017
76123fc
Fixed an issue where newInstance wasn't exposed.
JayTSmith Sep 21, 2017
52a2afb
Added the ability to edit hits on the character sheet.
JayTSmith Sep 21, 2017
26394d7
The user can change hits now on the character sheet.
JayTSmith Sep 21, 2017
2ba3113
Fixed an issue causing a crash every time the HitsDialog popped up
JayTSmith Sep 21, 2017
0a220d9
Fixed an issue causing a crash every time the HitsDialog's confirm bu…
JayTSmith Sep 21, 2017
4d62633
Fixed setCurHits allowing bad values.
JayTSmith Sep 21, 2017
d95c2f6
Removed debugPrintScores function from PlayerCharacter.
JayTSmith Sep 21, 2017
4080307
Reformatted some code.
JayTSmith Sep 21, 2017
c73d142
PlayerCharacter now updates curHits when initalizeClass is called.
JayTSmith Sep 21, 2017
c84a1df
Removed unused instance fields from Util.
JayTSmith Sep 21, 2017
1558087
Removed a todo.
JayTSmith Sep 21, 2017
76f0f82
Added a getter for the instance field weapons.
JayTSmith Sep 21, 2017
9435986
MID-WORK COMMIT - This is to simply save work.
JayTSmith Sep 21, 2017
417aa62
Weapon of Choice is now checked when making an attack.
JayTSmith Sep 21, 2017
26d7294
Melee bonus is now properly updated in the GUI.
JayTSmith Sep 21, 2017
3918e09
Merge branch 'friday-fixup'
JayTSmith Sep 21, 2017
67570e5
Disabled some stuff to disable crashing.
JayTSmith Sep 21, 2017
d3bed5b
Merge branch 'master' into create-character
JayTSmith Sep 25, 2017
5142359
Changed the textView's id to make it more unique.
JayTSmith Sep 25, 2017
a7a0345
Implemented a working version of the DetailedDialog.
JayTSmith Sep 25, 2017
396b27c
Removed the WeaponArrayAdapter.
JayTSmith Sep 25, 2017
ef92662
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 25, 2017
437bd24
Merge branch 'master' into create-character
JayTSmith Sep 25, 2017
ae368d7
Updated values in strings.xml
JayTSmith Sep 25, 2017
513bec6
Fixed values in layout and strings.xml
JayTSmith Sep 25, 2017
5498106
Changed layout to simple support layout.
JayTSmith Sep 25, 2017
357edcd
Added safe checking to event handlers in DetailDialog.
JayTSmith Sep 26, 2017
7f623ee
Added a default constructor for Priest.
JayTSmith Sep 26, 2017
00e3f38
Rearranged constructor args to be fitting with other code.
JayTSmith Sep 26, 2017
67c909c
Added getAmmo to Util.
JayTSmith Sep 26, 2017
6c8dd98
Removed unused imports.
JayTSmith Sep 26, 2017
2d24c98
Made getAmmo static.
JayTSmith Sep 26, 2017
e1e9a49
Changed constructors that had RangedWeapons involved in startGear.
JayTSmith Sep 26, 2017
699ea11
Made the dialog swap out the starting weapon with chosen starting wea…
JayTSmith Sep 26, 2017
e504b11
Fixed the error where Centaur would start with weaponOfChoice.
JayTSmith Sep 26, 2017
2340649
Made the dialog properly create an instance with filled in values.
JayTSmith Sep 27, 2017
12e5240
Binded a PlayerCharacter to the newly created instance.
JayTSmith Sep 27, 2017
f8e0d66
Modified the listener's interface.
JayTSmith Sep 27, 2017
d20b508
Made BaseClass serializable.
JayTSmith Sep 27, 2017
5b54ed7
Made a rough version of passing character between the dialog and sheet.
JayTSmith Sep 27, 2017
b8e0bfc
Added throwing knife as a weapon
JayTSmith Sep 27, 2017
57c51c6
Removed System.out statements.
JayTSmith Sep 27, 2017
4eb88ae
Added some error handling to the dialog.
JayTSmith Sep 27, 2017
bc1b646
Fixed bug where the class wasn't fully initialized.
JayTSmith Sep 27, 2017
85569b6
Feature complete, able to transfer newly created character to sheet.
JayTSmith Sep 27, 2017
189a4e3
Removed invalid weapon, "mace".
JayTSmith Sep 27, 2017
ce052c4
Added null handling Noble.
JayTSmith Sep 27, 2017
fe207f5
Added a Club Entry.
JayTSmith Sep 27, 2017
707cfc4
Fixed Noble crash potential.
JayTSmith Sep 27, 2017
f947b83
Implemented the new dialog for all of the classes.
JayTSmith Sep 27, 2017
8202a06
Added more error-handling into the code.
JayTSmith Sep 28, 2017
3cabd50
Merge pull request #22 from JayTSmith/create-character
JayTSmith Sep 28, 2017
3728702
Removed outdated variables.
JayTSmith Sep 28, 2017
22be32f
Fixed a bug where the CreateCharacter and CharcterSheetFragment would…
JayTSmith Sep 28, 2017
23a43ec
Moved most of the code to fill in the fragment into a seperate method.
JayTSmith Sep 28, 2017
ce40d72
Removed unused code.
JayTSmith Sep 28, 2017
0143168
Allows the active character to be perserved after the character changes.
JayTSmith Sep 28, 2017
5d88f5b
Merge pull request #23 from JayTSmith/create-character
JayTSmith Sep 28, 2017
35257c9
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 28, 2017
135fd64
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Sep 28, 2017
90ae4f5
Merge remote-tracking branch 'origin/master'
JayTSmith Sep 28, 2017
b6dd52c
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Oct 2, 2017
20cb7a0
Resolved issue with merge.
JayTSmith Oct 2, 2017
092f056
Added value for Priest.
JayTSmith Oct 2, 2017
20babdf
Added handling in case there is no possible starting weapon.
JayTSmith Oct 2, 2017
f661866
Added handling for lack of a weapon
JayTSmith Oct 2, 2017
920af94
Added handling for the dialog for lack of a weapon as well.
JayTSmith Oct 2, 2017
342bb58
fixed issue #24, discovered issue #25, and fixed issue #25
JayTSmith Oct 2, 2017
6eece21
Removed statements related to debuggging.
JayTSmith Oct 3, 2017
14aeb8e
Added helper methods,
JayTSmith Oct 3, 2017
11e2552
Changed the choice weapon spinner to hide if the user selects a Magic…
JayTSmith Oct 4, 2017
bfc710f
Added resIds to Score enum.
JayTSmith Oct 4, 2017
75791ad
Now have a working implentmention of Noble Heritage.
JayTSmith Oct 4, 2017
d417800
Cleaned up some of the code related to Noble creation.
JayTSmith Oct 4, 2017
78e11a9
Added safe checking to doHeritage.
JayTSmith Oct 4, 2017
1417c84
Merge pull request #26 from JayTSmith/create-character
JayTSmith Oct 4, 2017
2dad760
#27 fixed
JayTSmith Oct 4, 2017
21d6b6d
Merge pull request #28 from JayTSmith/create-character
JayTSmith Oct 4, 2017
94faeb7
Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minot…
JayTSmith Oct 4, 2017
d40e4d2
Merge remote-tracking branch 'origin/master'
JayTSmith Oct 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void afterTextChanged(Editable editable) {
mWitsButton = (Button) rootView.findViewById(R.id.wits_score_button);
mWitsButton.setText(Integer.toString(mBaseClass.getCharacter().getScore(Score.WITS).getScore()));
mLuckButton = (Button) rootView.findViewById(R.id.luck_score_button);
mWitsButton.setText(Integer.toString(mBaseClass.getCharacter().getScore(Score.WITS).getScore()));
mLuckButton.setText(Integer.toString(mBaseClass.getCharacter().getScore(Score.LUCK).getScore()));
mWillButton = (Button) rootView.findViewById(R.id.will_score_button);
mWillButton.setText(Integer.toString(mBaseClass.getCharacter().getScore(Score.WILL).getScore()));
mGraceButton = (Button) rootView.findViewById(R.id.grace_score_button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
Expand All @@ -23,8 +22,10 @@
import com.example.cis.mazeminotaurs.character.classes.BaseClass;
import com.example.cis.mazeminotaurs.character.classes.Classes;
import com.example.cis.mazeminotaurs.character.classes.Magician;
import com.example.cis.mazeminotaurs.character.classes.Noble;
import com.example.cis.mazeminotaurs.character.classes.Specialist;
import com.example.cis.mazeminotaurs.character.classes.Warrior;
import com.example.cis.mazeminotaurs.character.stats.Score;
import com.example.cis.mazeminotaurs.util.Util;

/**
Expand All @@ -42,6 +43,11 @@ public interface DetailDialogListener {
Classes mSelectedClass;
Weapon[] mChoiceWeps;
Weapon[] mStartWeps;

// Noble stuff
Score mPhysicalHeritage = Score.MIGHT;
Score mOtherHeritage = Score.WITS;

// Ints cannot have a null value so this is a replacement for it.
int mSelectedWeapon = -43762;
int mSelectedChoiceWep = -43762;
Expand Down Expand Up @@ -71,16 +77,53 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
mChoiceWeps = getChoiceWeapons();
mStartWeps = getStartWeapons();

if (mChoiceWeps != null) {
System.out.println(mChoiceWeps.toString());
}
if (mStartWeps != null) {
System.out.println(mStartWeps.toString());
// Handling class-specific display options
if (mSelectedClass == Classes.NOBLE) {
Spinner pHeritageSpinner = (Spinner) view.findViewById(R.id.physical_heritage_spinner);
Spinner oHeritageSpinner = (Spinner) view.findViewById(R.id.other_heritage_spinner);

view.findViewById(R.id.physical_heritage_label).setVisibility(View.VISIBLE);
view.findViewById(R.id.other_heritage_label).setVisibility(View.VISIBLE);
pHeritageSpinner.setVisibility(View.VISIBLE);
oHeritageSpinner.setVisibility(View.VISIBLE);

final ArrayAdapter<Score> pSpinItems = new ArrayAdapter<>(getContext(),
R.layout.support_simple_spinner_dropdown_item);
pSpinItems.addAll(Score.getMartialScores());
pHeritageSpinner.setAdapter(pSpinItems);
pHeritageSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
mPhysicalHeritage = pSpinItems.getItem(i);
}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {

}
});

final ArrayAdapter<Score> oSpinItems = new ArrayAdapter<>(getContext(),
R.layout.support_simple_spinner_dropdown_item);
oSpinItems.addAll(Score.getMentalScores());
oHeritageSpinner.setAdapter(oSpinItems);
oHeritageSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
mOtherHeritage = oSpinItems.getItem(i);
}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {

}
});
}

// Populate choice weapons list.
if (mSelectedClass.getJavaClass().getSuperclass() == Magician.class) {
view.findViewById(R.id.choice_weapon_spinner).setEnabled(false);
view.findViewById(R.id.choice_weapon_label).setVisibility(View.GONE);
view.findViewById(R.id.choice_weapon_spinner).setVisibility(View.GONE);
} else {
Spinner choiceSpinner = (Spinner)view.findViewById(R.id.choice_weapon_spinner);
ArrayAdapter<String> spinItems = new ArrayAdapter<>(getContext(),
Expand All @@ -103,13 +146,10 @@ public void onNothingSelected(AdapterView<?> adapterView) {
} else {
spinItems.add(EMPTY_MSG);
choiceSpinner.setEnabled(false);

view.findViewById(R.id.choice_weapon_label).setVisibility(View.GONE);
choiceSpinner.setVisibility(View.GONE);
}
}

final Spinner startSpinner = (Spinner) view.findViewById(R.id.start_weapon_spinner);
Spinner startSpinner = (Spinner) view.findViewById(R.id.start_weapon_spinner);
ArrayAdapter<String> spinItems = new ArrayAdapter<>(getContext(),
R.layout.support_simple_spinner_dropdown_item);
startSpinner.setAdapter(spinItems);
Expand Down Expand Up @@ -235,7 +275,6 @@ public void onClick(DialogInterface dialogInterface, int i) {

if (instance != null) {
// Safely swaps the default weapon from default constructor
//TODO: Add exception for null values aka Hunter.
try {
instance.getStartGear().remove(instance.getPossibleStartWeapons()[0]);
Equipment oldAmmo = Util.getAmmo(instance.getPossibleStartWeapons()[0]);
Expand Down Expand Up @@ -264,6 +303,11 @@ public void onClick(DialogInterface dialogInterface, int i) {
instance.setCharacter(new PlayerCharacter());
instance.getCharacter().setCharClass(instance);
instance.getCharacter().initializeClass();

if (instance instanceof Noble) {
((Noble) instance).doHeritage(mPhysicalHeritage, mOtherHeritage);
}

mListener.onDialogPositiveClick(instance);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
public class Noble extends Warrior implements Level {
private ArrayList<HashMap<Score, Integer>> mScoreLevelChoice = new ArrayList<>();

private Score mPhysicalHeritage = Score.MIGHT;
private Score mOtherHeritage = Score.WITS;
private boolean mHasHeritage = false;

public Noble() {
this(null,null,null,null);
}
Expand All @@ -34,24 +38,11 @@ public Noble(PlayerCharacter playerCharacter, Weapon weaponOfChoice, Score marti
EquipmentDB.getInstance().getWeapon(R.string.sword),
});

Score martialScore;
if (martialHeritage != null && (martialHeritage.equals(Score.MIGHT) || martialHeritage.equals(Score.SKILL))) {
martialScore = martialHeritage;
} else {
martialScore = Score.MIGHT;
}
// Noble - Heroic Heritage
Score mentalScore;
if (mentalHeritage != null &&
(mentalHeritage.equals(Score.WITS) ||
mentalHeritage.equals(Score.WILL) ||
mentalHeritage.equals(Score.GRACE))) {
mentalScore = mentalHeritage;
} else {
mentalScore = Score.WITS;
}
// Noble-Specific things
mPhysicalHeritage = martialHeritage;
mOtherHeritage = mentalHeritage;

Score[] primAttrs = {martialScore, Score.LUCK};
Score[] primAttrs = {mPhysicalHeritage, Score.LUCK};
ArrayList<Score> primAttributes = new ArrayList<>();
Collections.addAll(primAttributes, primAttrs);

Expand All @@ -77,14 +68,8 @@ public Noble(PlayerCharacter playerCharacter, Weapon weaponOfChoice, Score marti
setStartMoney(rolledGold);
setStartGear(startGear);

// TODO find a way to get around this hack-y method.
/* Explanation
If the Noble is chosen for the new character it will crash due to a lack of
Character. However, we still need access to the code of the constructor.
*/
if (getCharacter() != null) {
getCharacter().getScore(martialScore).setScore(getCharacter().getScore(martialScore).getScore() + 2);
getCharacter().getScore(mentalScore).setScore(getCharacter().getScore(mentalScore).getScore() + 2);
doHeritage();
}
}

Expand Down Expand Up @@ -162,8 +147,34 @@ public void doLevelDown() {
}
}

public void doHeritage(Score physical, Score mental) {
private void doHeritage() {
doHeritage(mPhysicalHeritage, mOtherHeritage);
}

public void doHeritage(Score physical, Score other) {
if (!hasHeritage()) {
Score realPhysical;
if (physical != null &&
(physical.equals(Score.MIGHT) || physical.equals(Score.SKILL))) {
realPhysical = physical;
} else {
realPhysical = Score.MIGHT;
}
AttributeScore pScore = getCharacter().getScore(realPhysical);
pScore.setScore(pScore.getScore() + 2);
setPhysicalHeritage(physical);

Score realOther;
if (other != null &&
(other.equals(Score.WITS) || other.equals(Score.WILL) || other.equals(Score.GRACE))) {
realOther = other;
} else {
realOther = Score.WITS;
}
AttributeScore oScore = getCharacter().getScore(realOther);
oScore.setScore(oScore.getScore() + 2);
setOtherHeritage(other);
}
}

public int getBattleFortuneBonus() {
Expand All @@ -177,4 +188,28 @@ public ArrayList<HashMap<Score, Integer>> getScoreLevelChoice() {
public void setScoreLevelChoice(ArrayList<HashMap<Score, Integer>> scoreLevelChoice) {
this.mScoreLevelChoice = scoreLevelChoice;
}

public Score getPhysicalHeritage() {
return mPhysicalHeritage;
}

public void setPhysicalHeritage(Score physicalHeritage) {
mPhysicalHeritage = physicalHeritage;
}

public Score getOtherHeritage() {
return mOtherHeritage;
}

public void setOtherHeritage(Score otherHeritage) {
mOtherHeritage = otherHeritage;
}

public boolean hasHeritage() {
return mHasHeritage;
}

public void setHasHeritage(boolean hasHeritage) {
mHasHeritage = hasHeritage;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
package com.example.cis.mazeminotaurs.character.stats;

import com.example.cis.mazeminotaurs.R;

/**
* Created by jusmith on 3/30/17.
*/

public enum Score {
MIGHT,
GRACE,
SKILL,
WILL,
WITS,
LUCK;
MIGHT(R.string.might),
GRACE(R.string.grace),
SKILL(R.string.skill),
WILL(R.string.will),
WITS(R.string.wits),
LUCK(R.string.luck);

private int mResId;

Score(int resId) {
mResId = resId;
}

public int getResId() {
return mResId;
}

public static Score[] getMentalScores() {
return new Score[]{WILL, WITS, GRACE};
}

public static Score[] getMartialScores() {
return new Score[]{MIGHT, SKILL};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
>

<TextView
android:id="@+id/fixed_class_label"
Expand Down Expand Up @@ -61,4 +62,38 @@
android:layout_column="1"
android:layout_row="3"/>

<TextView
android:id="@+id/physical_heritage_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="4"
android:text="@string/physical_heritage"
android:visibility="gone"/>

<Spinner
android:id="@+id/physical_heritage_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="4"
android:visibility="gone"/>

<TextView
android:id="@+id/other_heritage_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="5"
android:text="@string/other_heritage"
android:visibility="gone"/>

<Spinner
android:id="@+id/other_heritage_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="5"
android:visibility="gone"/>

</GridLayout>
2 changes: 2 additions & 0 deletions MazesAndMinotaurs/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
<string name="class_word">Class: </string>
<string name="weapon_of_choice">Weapon of Choice: </string>
<string name="starting_weapon">Starting Weapon: </string>
<string name="physical_heritage">Physical Heritage: </string>
<string name="other_heritage">Other Heritage: </string>


<!-- Attribute Edit Dialog -->
Expand Down