- Greatly improved the challenge/reward probability function and usage. Removed some unnecessary fields and resorted the members of PCGLevel to make it easier to read.

This commit is contained in:
Marshall
2012-03-18 14:51:27 -04:00
parent 5ae5edd961
commit 1f1f23a6c3
2 changed files with 544 additions and 480 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,16 @@ public class PlayerProfile {
BUMPER, COLLECTOR, RUNNER, SHOOTER, JUMPER BUMPER, COLLECTOR, RUNNER, SHOOTER, JUMPER
} }
/*
* Certain probabilities are boosted by this constant based on the player's
* type.
*/
public static final double TYPE_MULTIPLIER = 1.25;
public enum ChallengeRewardType {
GAP, ENEMY, HARDER_ENEMY, JUMP, COIN, BLOCK, POWERUP
};
// Dreyfus model of skill acquisition: // Dreyfus model of skill acquisition:
public enum SKILL_LEVEL { public enum SKILL_LEVEL {
NOVICE, BEGINNER, COMPETENT, PROFICIENT, EXPERT NOVICE, BEGINNER, COMPETENT, PROFICIENT, EXPERT
@@ -64,20 +74,34 @@ public class PlayerProfile {
} }
} }
public double getProbability(LevelComponent.TYPE type) { public double getProbability(ChallengeRewardType crt) {
if (!isEnabled(type)) { // if (!isEnabled(type)) {
return 0.0; // return 0.0;
} // }
// SKILLs: { BUMP, COLLECT, JUMP, RUN, SHOOT, STOMP } switch (crt) {
// TYPEs: { BUMPER, COLLECTOR, RUNNER, SHOOTER, JUMPER} case GAP:
return Math.min(.5, (.5) * (skillVector.get(SKILL.JUMP) / 100.0)
switch (type) { * ((type == TYPE.JUMPER) ? TYPE_MULTIPLIER : 1));
case BLOCKS: case ENEMY:
return (.5) * (skillVector.get(SKILL.BUMP) / 100.0); double skillSet = ((100 - skillVector.get(SKILL.RUN)) / 100.0)
case COINS: * ((type == TYPE.RUNNER) ? -1 * TYPE_MULTIPLIER : 1);
return (.5) * (skillVector.get(SKILL.COLLECT) / 100.0); skillSet += (skillVector.get(SKILL.STOMP) / 100.0);
case POWER_UP: skillSet /= 2;
return Math.min(.5, (.5) * skillSet);
case HARDER_ENEMY:
return Math.min(.5, (.5) * (skillVector.get(SKILL.SHOOT) / 100.0)
* ((type == TYPE.SHOOTER) ? TYPE_MULTIPLIER : 1));
case JUMP:
return Math.min(.5, (.5) * (skillVector.get(SKILL.JUMP) / 100.0)
* ((type == TYPE.JUMPER) ? TYPE_MULTIPLIER : 1));
case BLOCK:
return Math.min(.5, (.5) * (skillVector.get(SKILL.BUMP) / 100.0)
* ((type == TYPE.BUMPER) ? TYPE_MULTIPLIER : 1));
case COIN:
return Math.min(.5, (.5) * (skillVector.get(SKILL.COLLECT) / 100.0)
* ((type == TYPE.COLLECTOR) ? TYPE_MULTIPLIER : 1));
case POWERUP:
double skillMod = 0; double skillMod = 0;
switch (skillLevel) { switch (skillLevel) {
case BEGINNER: case BEGINNER: