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

Neater Code :) #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
29 changes: 23 additions & 6 deletions src/com/watabou/pixeldungeon/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,26 @@

public class Statistics {

/**Amount of gold collected */
public static int goldCollected;

/**Deepest floor reached */
public static int deepestFloor;

/**Total amount of enemies slained */
public static int enemiesSlain;

/**Total food eaten */
public static int foodEaten;

/**Total potions made */
public static int potionsCooked;

/**Total piranhas killed */
public static int piranhasKilled;

public static int nightHunt;

public static int ankhsUsed;

public static float duration;
Expand All @@ -37,21 +50,23 @@ public class Statistics {

public static boolean amuletObtained = false;

/**Resets the stats */
public static void reset() {

//Resetting stats to 0
goldCollected = 0;
deepestFloor = 0;
enemiesSlain = 0;
foodEaten = 0;
foodEaten = 0;
potionsCooked = 0;
piranhasKilled = 0;
nightHunt = 0;
ankhsUsed = 0;

nightHunt = 0;
ankhsUsed = 0;
duration = 0;

qualifiedForNoKilling = false;

//Set amuletObtained to false
amuletObtained = false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I'm sure you are trolling

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//Say "Ok, now I'm sure you are trolling"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guys, the comments are sure not needed, var names are good enough to understand whats going on.


}
Expand All @@ -61,12 +76,13 @@ public static void reset() {
private static final String SLAIN = "enemiesSlain";
private static final String FOOD = "foodEaten";
private static final String ALCHEMY = "potionsCooked";
private static final String PIRANHAS = "priranhas";
private static final String PIRANHAS = "priranhas";
private static final String NIGHT = "nightHunt";
private static final String ANKHS = "ankhsUsed";
private static final String DURATION = "duration";
private static final String DURATION = "duration";
private static final String AMULET = "amuletObtained";

/**Store in bundle */
public static void storeInBundle( Bundle bundle ) {
bundle.put( GOLD, goldCollected );
bundle.put( DEEPEST, deepestFloor );
Expand All @@ -80,6 +96,7 @@ public static void storeInBundle( Bundle bundle ) {
bundle.put( AMULET, amuletObtained );
}

/**Restore from bundle */
public static void restoreFromBundle( Bundle bundle ) {
goldCollected = bundle.getInt( GOLD );
deepestFloor = bundle.getInt( DEEPEST );
Expand Down