Added PlayerProfile.getProbability(LevelComponent.TYPE).

This commit is contained in:
Woody Folsom
2012-03-18 13:03:16 -04:00
parent 554e9af319
commit 0bb61eece8
4 changed files with 35 additions and 3 deletions

View File

@@ -1,8 +1,11 @@
package dk.itu.mario.level;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import dk.itu.mario.level.matcher.ProfileMatcher.SKILL;
public class PlayerProfile {
//From Bartle/Yee models of player psychology: achiever, killer, explorer, manipulator
public enum TYPE { BUMPER, COLLECTOR, RUNNER, SHOOTER, JUMPER}
@@ -12,11 +15,20 @@ public class PlayerProfile {
private Set<LevelComponent.TYPE> enabledComponents = new HashSet<LevelComponent.TYPE>();
private SKILL_LEVEL skillLevel;
private Map<SKILL,Integer> skillVector;
private TYPE type;
public PlayerProfile(SKILL_LEVEL skillLevel, TYPE type) {
public PlayerProfile(SKILL_LEVEL skillLevel, TYPE type, Map<SKILL,Integer> skillVector) {
this.skillLevel = skillLevel;
this .type = type;
this.skillVector = skillVector;
for (LevelComponent.TYPE lcType: LevelComponent.TYPE.values()) {
setEnabled(lcType);
}
}
public boolean isEnabled(LevelComponent.TYPE type) {
return enabledComponents.contains(type);
}
public SKILL_LEVEL getSkillLevel() {
@@ -45,6 +57,22 @@ public class PlayerProfile {
}
}
public double getProbability(LevelComponent.TYPE type) {
if (!isEnabled(type)) {
return 0.0;
}
switch (type) {
case BLOCKS:
return 0.3;
case COINS :
return 0.5;
case POWER_UP :
return 0.1;
default :
return 0.1;
}
}
public TYPE getType() {
return type;
}