Skip to content

Commit

Permalink
Quick Fix on the Issues regarding Magician Creation (#34)
Browse files Browse the repository at this point in the history
* Started to add the character class into the Game.

* + Added references in game_references.xml for
    - Genders
    - Classes
    - Levels
+ Finalized Warrior Type Classes along with Base Classes
+ Created Barbarian Class
+ Created Util Class to provide helper functions and values
+ Removed CharClass
+ Renamed Core to Score to better explain usage.

* Actually pushed the files

* Started to add the character class into the Game.

* + Added references in game_references.xml for
    - Genders
    - Classes
    - Levels
+ Finalized Warrior Type Classes along with Base Classes
+ Created Barbarian Class
+ Created Util Class to provide helper functions and values
+ Removed CharClass
+ Renamed Core to Score to better explain usage.

* Actually pushed the files

* + Changed the code to use AttributeScores rather than just raw Integers.
+ Created a basic form of Amazon
+ Swapped the ResId in Barbarian for the ResId defined in the Enum.

* + Added Money enum
+ Added Money property to Character
+ Improved the functionality of Barbarian
    - Added LevelUp
    - Added LevelDown
    - Added property to track user choices of leveling up
+ Added Money strings to game_references.xml

+ Created Magician abstract class
+ Created mEffectiveLevel property in base class to ease the burden of leveling up and down.

* + Changed Character class to PlayerCharacter

* + Changed getCoreStatScore to getScore

* + Modified LevelUp and LevelDown to restore the proper scores rather than calculated scores.
---WARNING---
Changes made in a sleepy state, they may not be implemented properly or effectively.

* Removed the EffectiveLevel property from BaseClass
Removed the updateLevel method
Added an example of getting modifier to CharacterSheet

* + Added methods for saving throws in PlayerCharacter.java
    +getAthleticProwess
    +getDangerEvasion
    +getMysticFortitude
    +getPhysicalVigor
    +getCharisma

* + Added the Equipment functionality to Barbarian
+ Changed some int arguments to use Weapon instead
+ Added some documentation to PlayerCharacter
+ Also fixed some typos in method names in PlayerCharacter.

* + Added the equipment functionality to the PlayerCharacter
    - Weapon Attribute
    - Weapon of Choice checking
+ Added weapon of choice to specialist

* + Fixed more typos
+ Added the initializeClass method to ease the burden of switching classes at first.

* + Changed Portfolio to work with the new method of Character Creation

* + Changed mWeapon to mCurrentWeapon
+ Added getWeapons method to PlayerCharacter
+ Fixed issue where PlayerCharacter wouldn't have a weapon equipped.

* + Made getHitTotal function properly
+ Improved documentation on the PlayerCharacter class

* + Removed initialization from PlayerCharacter's constructor.

* + Added GSON lib.
+ Added Saving Functionality
+ Broken Load Functionality at the moment.

* Fixed loading functionality.

* Added javadoc for SaveAndLoadPerformer

* Finished commit.

* Changed and added methods to the Util class.
* Added javadoc to signature roll(int)
* Added method roll(int, int) with javadoc

Started to add Amazon PlayerCharacter class.

* Finished with Amazon

* Created Centaur (should be ready to implement).

* Fixed bugged gold for Amazon and Barb.

* Created and added Noble
Fixed bug where Barb's weapon of choice would always be set to Barb Axe.

* Added and Created Spearman class.
Added Heroic Heritage to Nobles.

* Added Battle Fortune to Noble.

* Setup project on new PC.
Multiple files changed to resolve errors.

* Fully implemented Centaur.
* Finished up the constructor.

* Fully implemented Thief.

* Created Hunter and fully implemented!

Specialist.java:
* Added Special Talent Method

Thief.java:
* Implemented Special Talent Method

* Moved getSpecialTalent to Specialist.java

* Removed getSpecialTalent from the respective classes.

* Added new values.

* Renamed the values.

* Resolved the TODOs in the code.

* Fixed a typo.

* Removed methods that are inside of the Level Interface, and made getLevelDescription abstract.

* Fixed issue #2.

* Added functionality to Patron.

* Fixed Specialist lacking the Level Descriptions.

* Added the instance field for possibleStartWeapons to BaseClass
Also, added the fully implemented feature into Amazon.

* Updated Barbarian to new format.

* Added the instance field mPossibleWeaponsOfChoice to Warrior.
Made the setter for mWeaponOfChoice check if it is valid.

* Changed how Amazon would validate starting weapon.

* Changed Warrior so it would still weaponOfChoice even if argument wasn't valid.

* Changed Amazon and Barbarian to remove their checking of weaponOfChoice.

* Centaur has been brought up-to-date.

* Noble has been brought up-to-date.

* Spearman has been brought up-to-date.

* Added instance field mPossibleWeaponsOfChoice to Specialist.

* Hunter has been brought up-to-date.

* Thief has been brought up-to-date.

* Added safe-checking to Specialist's setWeaponOfChoice

* All available Magicans classes have been brought up-to-date.

* Fixed bug with App Crash

* Fixed EDC issue where it could return the incorrect values.

* Added Patreon instance field to PlayerCharacter

* Created res/dialog_class_selection.xml

* Created the layout of dialog_class_selection.xml

* Created the layout of dialog_class_selection.xml

* Created DetailFragment class

* Have a very rough version of the new dialog working.

* Still a rough version but slightly improved.

* Added a blank construcutor for all subclasses of BaseClass.

* Added values into the Classes Enum

* Created a custom adapter.

* Created the layout for weapons in a spinner.

* Finalized the layout of the spinner items

* Added getters

* Changed startGold to startMoney.

* Fixed a massive issue regarding scope in the character package.

* Incomplete update for editing attribute values on the character

* Added the ability to edit the Might score.

* Added the edit ability to the rest of the attribute scores.

* Modified the layout of attribute editing dialog.

* Added the proper values for the labels on the CharacterSheet.

* Adding mCurrentHits functionality.

* Rearranged the layout of the Attribute edit dialog to fix issues of cropping.

* Added safe-checking when getting a value from the dialog.

* Fixed an issue where it would refresh the UI regardless of change.

* Added value checking onto the setCurHits method of PlayerCharacter.

* Moved StatChangeFragment to fragments package.

* Created the HitsChangeFragment class

* Fixed an issue where newInstance wasn't exposed.

* Added the ability to edit hits on the character sheet.

* The user can change hits now on the character sheet.

* Fixed an issue causing a crash every time the HitsDialog popped up

* Fixed an issue causing a crash every time the HitsDialog's confirm button was pressed

* Fixed setCurHits allowing bad values.

* Removed debugPrintScores function from PlayerCharacter.

* Reformatted some code.

* PlayerCharacter now updates curHits when initalizeClass is called.

* Removed unused instance fields from Util.

* Removed a todo.

* Added a getter for the instance field weapons.

* MID-WORK COMMIT - This is to simply save work.

* Weapon of Choice is now checked when making an attack.

* Melee bonus is now properly updated in the GUI.

* Disabled some stuff to disable crashing.

* Changed the textView's id to make it more unique.

* Implemented a working version of the DetailedDialog.

* Removed the WeaponArrayAdapter.

* Updated values in strings.xml

* Fixed values in layout and strings.xml

* Changed layout to simple support layout.

* Added safe checking to event handlers in DetailDialog.

* Added a default constructor for Priest.

* Rearranged constructor args to be fitting with other code.

* Added getAmmo to Util.

* Removed unused imports.

* Made getAmmo static.

* Changed constructors that had RangedWeapons involved in startGear.

* Made the dialog swap out the starting weapon with chosen starting weapon.

* Fixed the error where Centaur would start with weaponOfChoice.

* Made the dialog properly create an instance with filled in values.

* Binded a PlayerCharacter to the newly created instance.

* Modified the listener's interface.

* Made BaseClass serializable.

* Made a rough version of passing character between the dialog and sheet.

* Added throwing knife as a weapon

* Removed System.out statements.

* Added some error handling to the dialog.

* Fixed bug where the class wasn't fully initialized.

* Feature complete, able to transfer newly created character to sheet.

* Removed invalid weapon, "mace".

* Added null handling Noble.

* Added a Club Entry.

* Fixed Noble crash potential.

* Implemented the new dialog for all of the classes.

* Added more error-handling into the code.

* Removed outdated variables.

* Fixed a bug where the CreateCharacter and CharcterSheetFragment would both be visible.

* Moved most of the code to fill in the fragment into a seperate method.

* Removed unused code.

* Allows the active character to be perserved after the character changes.

* Merge branch 'master' of https://github.com/CIS-Extra/mazes_and_minotaurs

# Conflicts:
#	MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/CharacterSheetFragment.java
#	MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/NewCharacter/CreateCharacter.java
#	MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/rollDice/rollDice.java
#	MazesAndMinotaurs/instapk.log

* Resolved issue with merge.

* Added value for Priest.

* Added handling in case there is no possible starting weapon.

* Added handling for lack of a weapon

* Added handling for the dialog for lack of a weapon as well.

* fixed issue #24, discovered issue #25, and fixed issue #25
JayTSmith authored and Thorin Schmidt committed Oct 2, 2017
1 parent f18038f commit 8dfd952
Showing 6 changed files with 69 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -184,10 +184,17 @@ public void onClick(View v){
});

mAttackType = (TextView) rootView.findViewById(R.id.attack_title_view);
mAttackType.setText(mSheetPlayerCharacter.getCurrentWeapon().getWeaponType());
if (mSheetPlayerCharacter.getCurrentWeapon() != null) {
mAttackType.setText(mSheetPlayerCharacter.getCurrentWeapon().getWeaponType());
} else {
mAttackType.setText("-");
}

mAttackButton = (Button) rootView.findViewById(R.id.attack_button);
if(mSheetPlayerCharacter.getCurrentWeapon().getWeaponType() == R.string.melee) {
if (mSheetPlayerCharacter.getCurrentWeapon() == null) {
mAttackButton.setText("-");
}
else if(mSheetPlayerCharacter.getCurrentWeapon().getWeaponType() == R.string.melee) {
mAttackButton.setText(Integer.toString(mSheetPlayerCharacter.getMeleeMod()));
}
else{
@@ -197,24 +204,30 @@ public void onClick(View v){
@Override
public void onClick(View v){
//just for testing, replace these with calls to character methods
int weaponType = mSheetPlayerCharacter.getCurrentWeapon().getWeaponType();
boolean woc = false;
if (mSheetPlayerCharacter.getCharClass() instanceof Warrior) {
woc = ((Warrior) mSheetPlayerCharacter.getCharClass()).getWeaponOfChoice() == mSheetPlayerCharacter.getCurrentWeapon();
} else if (mSheetPlayerCharacter.getCharClass() instanceof Specialist) {
woc = ((Specialist) mSheetPlayerCharacter.getCharClass()).getWeaponOfChoice() == mSheetPlayerCharacter.getCurrentWeapon();
if (mSheetPlayerCharacter.getCurrentWeapon() != null) {
int weaponType = mSheetPlayerCharacter.getCurrentWeapon().getWeaponType();
boolean woc = false;
if (mSheetPlayerCharacter.getCharClass() instanceof Warrior) {
woc = ((Warrior) mSheetPlayerCharacter.getCharClass()).getWeaponOfChoice() == mSheetPlayerCharacter.getCurrentWeapon();
} else if (mSheetPlayerCharacter.getCharClass() instanceof Specialist) {
woc = ((Specialist) mSheetPlayerCharacter.getCharClass()).getWeaponOfChoice() == mSheetPlayerCharacter.getCurrentWeapon();
}
onAttackClick(weaponType, woc);
}
onAttackClick(weaponType, woc);
}
});

mEquippedWeaponButton = (Button) rootView.findViewById(R.id.equipped_weapon_button);
//Get equipped weapon from character Class
//int equippedWeaponID = R.string.barb_axe;
Weapon equippedWeapon = mSheetPlayerCharacter.getCurrentWeapon();
Log.i(TAG, equippedWeapon.toString());
int equippedWeaponID = equippedWeapon.getResId();
mEquippedWeaponButton.setText(equippedWeaponID);
if (equippedWeapon != null) {
int equippedWeaponID = equippedWeapon.getResId();
mEquippedWeaponButton.setText(equippedWeaponID);
} else {
mEquippedWeaponButton.setText("-");
}

mEquippedWeaponButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -429,12 +442,15 @@ private void populateSheet(PlayerCharacter character) {
} else if (character.getWeapons() != null && character.getWeapons().size() > 0){
wepToDisplay = character.getWeapons().get(0);
}
mEquippedWeaponButton.setText(wepToDisplay.getResId());
mAttackType.setText(wepToDisplay.getWeaponType());
if (wepToDisplay.getWeaponType() == R.string.melee) {
mAttackButton.setText(Integer.toString(character.getMeleeMod()));
} else {
mAttackButton.setText(Integer.toString(character.getMissileMod()));

if (wepToDisplay != null) {
mEquippedWeaponButton.setText(wepToDisplay.getResId());
mAttackType.setText(wepToDisplay.getWeaponType());
if (wepToDisplay.getWeaponType() == R.string.melee) {
mAttackButton.setText(Integer.toString(character.getMeleeMod()));
} else {
mAttackButton.setText(Integer.toString(character.getMissileMod()));
}
}

mMightButton.setText(Integer.toString(character.getScore(Score.MIGHT).getScore()));
@@ -456,10 +472,11 @@ private void populateSheet(PlayerCharacter character) {
if (!(character.getCharClass() instanceof Warrior)) {
mMagicTitleView.setVisibility(View.VISIBLE);
if (character.getCharClass() instanceof Magician) {
mMagicStrengthButton.setText(((Magician) character.getCharClass()).getMysticalStrength());
mTotalPowerButton.setText(((Magician) character.getCharClass()).getPowerPoints());
mCurrentPowerButton.setText(((Magician) character.getCharClass()).getPowerPoints());
mTalentBonusButton.setText(((Magician) character.getCharClass()).getSpecialTalent());
Magician instance = (Magician) character.getCharClass();
mMagicStrengthButton.setText(Integer.toString(instance.getMysticalStrength()));
mTotalPowerButton.setText(Integer.toString(instance.getPowerPoints()));
mCurrentPowerButton.setText(Integer.toString(instance.getPowerPoints()));
mTalentBonusButton.setText(Integer.toString(instance.getSpecialTalent()));

mMagicStrengthTitleView.setVisibility(View.VISIBLE);
mTotalPowerTitleView.setVisibility(View.VISIBLE);
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
mMagicianGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
switch (checkedId) {
switch (checkedId){
case R.id.elementalist_radio:
mClassInformation = getResources().getString(R.string.elementalist_class);
mClass = "Elementalist";
@@ -196,4 +196,3 @@ public void onDialogPositiveClick(BaseClass instance) {
.commit();
}
}

Original file line number Diff line number Diff line change
@@ -135,7 +135,13 @@ private void updateStatButtons() {
mMFButton.setText(Integer.toString(character.getMysticFortitude()));
mPVButton.setText(Integer.toString(character.getPhysicalVigor()));
mInitButton.setText(Integer.toString(character.getInitiative()));
mWeaponNameButton.setText(character.getWeapons().get(0).getResId());
mWeaponTypeButton.setText(character.getWeapons().get(0).getWeaponType());
if (character.getCurrentWeapon() != null) {
mWeaponNameButton.setText(character.getCurrentWeapon().getResId());
mWeaponTypeButton.setText(character.getCurrentWeapon().getWeaponType());
}
else {
mWeaponNameButton.setText("-");
mWeaponTypeButton.setText("-");
}
}
}
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
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;
@@ -70,6 +71,13 @@ 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());
}

// Populate choice weapons list.
if (mSelectedClass.getJavaClass().getSuperclass() == Magician.class) {
view.findViewById(R.id.choice_weapon_spinner).setEnabled(false);
@@ -95,6 +103,9 @@ 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);
}
}

@@ -114,7 +125,7 @@ public void onNothingSelected(AdapterView<?> adapterView) {
}
});

if (mStartWeps == null) {
if (selectedClass == Classes.HUNTER) {
spinItems.add(EMPTY_MSG);
String newText = String.format("%s/%s",
getContext().getString(R.string.weapon_of_choice),
@@ -123,6 +134,9 @@ public void onNothingSelected(AdapterView<?> adapterView) {
((TextView) view.findViewById(R.id.choice_weapon_label)).setText(newText);
view.findViewById(R.id.start_weapon_label).setVisibility(View.GONE);
startSpinner.setVisibility(View.GONE);
} else if (mStartWeps == null) {
view.findViewById(R.id.start_weapon_label).setVisibility(View.GONE);
startSpinner.setVisibility(View.GONE);
}
else if (mStartWeps.length > 0) {
spinItems.addAll(getWeaponNames(mStartWeps));
@@ -157,7 +171,7 @@ private Weapon[] getChoiceWeapons() {
if (mSelectedClass.getJavaClass().getSuperclass() == Warrior.class) {
Warrior wClass = (Warrior) instance;
return wClass.getPossibleWeaponsOfChoice();
} else {
} if (mSelectedClass.getJavaClass().getSuperclass() == Specialist.class) {
Specialist sClass = (Specialist) instance;
return sClass.getPossibleWeaponsOfChoice();
}
@@ -175,7 +189,7 @@ private Weapon[] getStartWeapons(){
if (mSelectedClass.getJavaClass().getSuperclass() == Warrior.class) {
Warrior wClass = (Warrior) instance;
return wClass.getPossibleStartWeapons();
} else {
} if (mSelectedClass.getJavaClass().getSuperclass() == Specialist.class) {
Specialist sClass = (Specialist) instance;
return sClass.getPossibleStartWeapons();
}
Original file line number Diff line number Diff line change
@@ -475,7 +475,9 @@ public void setCharClass(BaseClass aClass) {
public void initializeClass(){
getMoney().put(Money.SILVER, getCharClass().getStartMoney());
getInventory().addAll(getCharClass().getStartGear());
setCurrentWeapon(getWeapons().get(0));
if (getWeapons().size() > 0) {
setCurrentWeapon(getWeapons().get(0));
}
setCurHits(getHitTotal());
}

Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ public enum Classes {
LYRIST(R.string.lyrist, Lyrist.class),
NOBLE(R.string.noble, Noble.class),
NYMPH(R.string.nymph, Nymph.class),
PRIEST,
PRIEST(R.string.priest, Priest.class),
SHAPESHIFTER,
SORCEROR(R.string.sorceror, Sorcerer.class),
SPEARMAN(R.string.spearman, Spearman.class),

0 comments on commit 8dfd952

Please sign in to comment.