Some new stuff.

This commit is contained in:
Marshall
2012-03-18 20:31:54 -04:00
parent f03577a822
commit 3c0673febf
3 changed files with 27 additions and 4 deletions

View File

@@ -10,7 +10,8 @@ public class GamePlay implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final GamePlay DEFAULT_PROFILE = new GamePlay(); public static final GamePlay DEFAULT_PROFILE = new GamePlay();
public boolean isDefault = false;
public int completionTime; // counts only the current run on the level, public int completionTime; // counts only the current run on the level,
// excluding death games // excluding death games
public int totalTime;// sums all the time, including from previous games if public int totalTime;// sums all the time, including from previous games if
@@ -95,9 +96,11 @@ public class GamePlay implements Serializable {
gp = (GamePlay) in.readObject(); gp = (GamePlay) in.readObject();
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
//e.printStackTrace(); // e.printStackTrace();
System.out.println("Unable to read from GamePlay file: " + fileName + ", initializing a new GamePlay instance."); System.out.println("Unable to read from GamePlay file: " + fileName
+ ", initializing a new GamePlay instance.");
gp = GamePlay.DEFAULT_PROFILE; gp = GamePlay.DEFAULT_PROFILE;
gp.isDefault = true;
} }
return gp; return gp;
} }

View File

@@ -55,23 +55,28 @@ public class PlayerProfile {
public int getBumpSkill() { public int getBumpSkill() {
return skillVector.get(SKILL.BUMP); return skillVector.get(SKILL.BUMP);
} }
public int getCollectSkill() { public int getCollectSkill() {
return skillVector.get(SKILL.COLLECT); return skillVector.get(SKILL.COLLECT);
} }
public int getJumpSkill() { public int getJumpSkill() {
return skillVector.get(SKILL.JUMP); return skillVector.get(SKILL.JUMP);
} }
public int getRunSkill() { public int getRunSkill() {
return skillVector.get(SKILL.RUN); return skillVector.get(SKILL.RUN);
} }
public int getShootSkill() { public int getShootSkill() {
return skillVector.get(SKILL.SHOOT); return skillVector.get(SKILL.SHOOT);
} }
public int getStompSkill() { public int getStompSkill() {
return skillVector.get(SKILL.STOMP); return skillVector.get(SKILL.STOMP);
} }
public double getProbability(ChallengeRewardType crt) { public double getProbability(ChallengeRewardType crt) {
switch (crt) { switch (crt) {
case GAP: case GAP:
return Math.min(.5, (.5) * (skillVector.get(SKILL.JUMP) / 100.0) return Math.min(.5, (.5) * (skillVector.get(SKILL.JUMP) / 100.0)

View File

@@ -81,6 +81,21 @@ public class ProfileMatcher {
TYPE type = null; TYPE type = null;
HashMap<SKILL, Integer> skillVector = new HashMap<SKILL, Integer>(); HashMap<SKILL, Integer> skillVector = new HashMap<SKILL, Integer>();
if (playerMetrics.isDefault) {
skillLevel = SKILL_LEVEL.BEGINNER;
type = TYPE.RUNNER;
skillVector.put(SKILL.BUMP, new Integer(25));
skillVector.put(SKILL.COLLECT, new Integer(25));
skillVector.put(SKILL.JUMP, new Integer(25));
skillVector.put(SKILL.RUN, new Integer(25));
skillVector.put(SKILL.SHOOT, new Integer(25));
skillVector.put(SKILL.STOMP, new Integer(25));
PlayerProfile ret = new PlayerProfile(skillLevel, type, skillVector);
return ret;
}
int skillHolder; int skillHolder;
// Get bump skills. // Get bump skills.