Skip to content

Commit

Permalink
Added the rest of the documentation for the code. (#78)
Browse files Browse the repository at this point in the history
* Removed outdated todo comment.

* Added documentation for CharManageFragment.

* Added documentation for ExperienceDialogFragment.

* Added documentation for LevelStatSelectDialogFragment. Also fixed typo.

* Added documentation for LevelResultDialogFragment. Also added details.

* Added documentation for HitsChangeFragment.

* Added documentation for InventoryFragment.

* Added documentation for StatChangeFragment.

* Added package-info to fragments package.

* Added documentation for AttributePriorityDialog.

* Added documentation for DetailDialogFragment. Also fixed more typos.

* Added a package-info to NewCharacter.dialogs package.

* Added missing ol tag.

* Added documentation for CharacterCreationFragment.

* Added documentation for CreateCharacter.

* Added package-info to NewCharacter package.

* Added authors to package-infos.

* Added documentation to CompanionFragment.

* Removed an incorrect statement in the javadoc.

* Added documentation to PlayerManualFragment.

* Added documentation to WebsiteFragment.

* Added package-info to web_resource package.

* Added documentation for everything related to Equipment.

* Added documentation for AttackResultFragment.

* Added documentation for AttributeScore.

* Added documentation for AttributeScoreGenerator.

* Added documentation for CharacterAdapter.

* Added docs for CharacterSelection and CharacterDeletion fragments.

* Added docs to CharacterManageActivity.

* Added docs to CharacterPlayActivity. Also added author tag to CharacterManage.

* Added docs to CharacterSheetFragment.

* Added docs to the rest of the classes.

* Added package-info to the base level package.
  • Loading branch information
JayTSmith authored Dec 12, 2017
1 parent 04da9eb commit f0adac5
Show file tree
Hide file tree
Showing 30 changed files with 814 additions and 185 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
package com.example.cis.mazeminotaurs;

/**
* Created by Thorin Schmidt on 3/20/2017.
* This class serves as a container for data related to an armor piece.
*
* @author Thorin Schmidt on 3/20/2017.
*/

public class Armor extends Equipment {

//instance variables
/**
* The bonus defense granted by wearing this armor piece.
*/
private int mDefenseBonus;

/**
* {@inheritDoc}
*
* @param resId The name of the armor.
* @param encumberance The encumberance value of the armor.
* @param quantity The number the player is holding.
* @param costInSp The cost of the armor in silver.
* @param longDescription The description of the armor.
* @param defenseBonus The defense bonus of the armor.
*/
public Armor(String resId, int encumberance, int quantity, double costInSp, String longDescription, int defenseBonus) {
super(resId, encumberance, quantity, costInSp, longDescription);
mDefenseBonus = defenseBonus;
}

/**
* Getter for the mDefenseBonus property.
* @return the value of mDefenseBonus
*/
public int getDefenseBonus() {
return mDefenseBonus;
}

/**
* Setter for the mDefenseBonus property.
* @param defenseBonus the new value of mDefenseBonus
*/
public void setDefenseBonus(int defenseBonus) {
mDefenseBonus = defenseBonus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,73 @@
import com.example.cis.mazeminotaurs.rollDice.rollDice;

/**
* Created by Thorin Schmidt on 4/13/2017.
* This fragment displays the results of an attack roll and damage roll of the
* equipped weapon.
* The user can also click to get a second damage roll for critical damage.
* @author Thorin Schmidt on 4/13/2017.
*/

public class AttackResultFragment extends DialogFragment {

/**
* The index of the character in the Portfolio singleton.
*/
int mCurrentCharacterIndex;

/**
* The list of all of the player's characters.
*/
Portfolio mPortfolio;

/**
* The character that is currently being used.
*/
PlayerCharacter mCurrentCharacter;

/**
* The score modifier being used, based on weapon type.
*/
int mMod;

/**
* The first attack roll, based on D20 values.
*/
int mAttackRoll1;

/**
* The second attack roll, based on D20 values. Used for special situations.
*/
int mAttackRoll2;

/**
* The first damage roll, based on the weapon's damageDie.
*/
int mDamage1;

/**
* The second damgage roll, based on the weapon's damageDie. Used for special
* situations.
*/
int mDamage2;

/**
* The type of attack being done. (Melee or Ranged)
*/
String mAttackType;

/**
* The sum of the attack roll and modifier. (mAttack1 and mMod)
*/
int mTotal1;

/**
* The sum of the attack roll and modifier. (mAttack2 and mMod)
*/
int mTotal2;

/*
* These are widgets found in the layout.
*/
Button mCritButton;

static AttackResultFragment newInstance(int characterIndex) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
package com.example.cis.mazeminotaurs;

/**
* This serves as a container for a player's scores.
* Created by Thorin Schmidt on 3/18/2017.
*/

public class AttributeScore {

//instance variables
/**
* The score's value.
*/
int mScore;

/**
* The modifier of the score, based on the score's value.
*/
int mModifier;

/**
* The description of the score's value.
*/
String mDescription;

//private methods
Expand Down Expand Up @@ -81,20 +93,37 @@ else if(this.mScore <= 20){

//public methods

/**
* Default constructor
*
* @param score the value of the score.
*/
public AttributeScore(int score) {
this.mScore = score;
this.updateModifier();
}

/**
* Getter for the mScore property.
* @return the value of mScore.
*/
public int getScore() {
return mScore;
}

/**
* Setter for the mScore property.
* @param score the new value of mScore.
*/
public void setScore(int score) {
this.mScore = score;
this.updateModifier();
}

/**
* Getter for the mModifier property.
* @return the value of mModifier.
*/
public int getModifier() {
return mModifier;
}
Expand All @@ -104,6 +133,10 @@ public void setModifier(int modifier) {
this.modifier = modifier;
}*/

/**
* Getter for the mDescription property.
* @return the value of mDescription.
*/
public String getDescription() {
return mDescription;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,33 @@
import java.util.Random;

/**
* Created by Thorin Schmidt on 3/18/2017.
* This is a helper class for generating a valid set of AttributeScores.
* @author Thorin Schmidt on 3/18/2017.
*/

public class AttributeScoreGenerator {
//random number generator
/**
* An instance of Random for generating numbers.
*/
Random dieRoller = new Random();

//private methods
/**
* A helper method for generating a new score value.
*
* @return a score value between 8 - 18
*/
private AttributeScore nextScore(){
int rollOne = dieRoller.nextInt(6)+1;
int rollTwo = dieRoller.nextInt(6)+1;

return new AttributeScore(rollOne+rollTwo+6);
}

/**
* Returns an array of AttributeScores that are valid according to the rules
* of Mazes and Minotaurs.
* @return a valid array of AttributeScores.
*/
public AttributeScore[] nextValidSet(){

AttributeScore[] attributes = new AttributeScore[6];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,36 @@

import com.example.cis.mazeminotaurs.character.PlayerCharacter;

import java.util.ArrayList;

/**
* Created by jsmith on 10/18/17.
* This adapter is meant to display every character present in portfolio.
* @author jsmith on 10/18/17.
*/

public class CharacterAdapter extends BaseAdapter {
/**
* A reference to the Portfolio singleton.
*/
private Portfolio mPortfolio = Portfolio.get();

/**
* The context that we use to create our layout.
*/
private Context mContext;

/**
* Default constructor
*
* @param context the context to create the layout.
*/
public CharacterAdapter(Context context) {
mContext = context;
}

/**
* A helper method to remove a character based on index within the portfolio.
* This also calls {@code notifyDataSetChanged}.
* @param i the index of the character to remove
*/
public void removeCharacter(int i) {
mPortfolio.deletePlayerCharacter(mPortfolio.getPlayerCharacter(i));
notifyDataSetChanged();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
import android.widget.Toast;

/**
* This is the old fragment used for deleting characters.
* @see CharacterManageActivity
* @deprecated
* Created by jsmith on 10/19/17.
*
* @author jsmith on 10/19/17.
*/

public class CharacterDeletionFragment extends Fragment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@
import com.example.cis.mazeminotaurs.fragments.CharManageFragment;
import com.example.cis.mazeminotaurs.util.CommonStrings;

/**
* This activity displays a list of characters found in the portfolio.
* The user can select one of the characters to make them active or to delete them.
* @author jsmith
*/
public class CharacterManageActivity extends AppCompatActivity implements CharManageFragment.ManagementListener {

/*
* These are the widgets found in the layout.
*/
ListViewCompat mListView;

/**
* This adapters fetches the characters from the portfolio to display in
* the list view.
*/
CharacterAdapter mAdapter;

@Override
Expand All @@ -31,8 +44,10 @@ protected void onCreate(Bundle savedInstanceState) {
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
// Opens a manage dialog where the user can select or delete.
CharManageFragment dialog = new CharManageFragment();
Bundle args = new Bundle();
// Grabs the character to use as an argument.
args.putSerializable(CommonStrings.CHARACTER_ARG.getValue(), mAdapter.getItem(i));
dialog.setListener(CharacterManageActivity.this);
dialog.setArguments(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import android.view.MenuItem;

/**
* Created by JayTSmith on 11/17/17.
* This fragment serves as a container for the character sheet and related fragments.
* The user does nothing to interact with this.
* @author jsmith on 11/17/17.
*/

public class CharacterPlayActivity extends AppCompatActivity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
import android.widget.ListView;

/**
* This is the old fragment for selecting the active character.
* @see CharacterManageActivity
* @deprecated
* Created by jsmith on 10/18/17.
*
* @author jsmith on 10/18/17.
*/

public class CharacterSelectionFragment extends Fragment {
Expand Down
Loading

0 comments on commit f0adac5

Please sign in to comment.