Rete-based rule system (Drools) correctly fires the appropriate actions when Player's Profile meets certain criteria, based on the rules in rules/LevelTunerRules.drl.

This commit is contained in:
Woody Folsom
2012-03-17 18:08:56 -04:00
parent 1d9eae7af0
commit 109c2d099a
14 changed files with 153 additions and 143 deletions

View File

@@ -0,0 +1,70 @@
package dk.itu.mario.level;
import java.util.HashSet;
import java.util.Set;
public class PlayerProfile {
//From Bartle/Yee models of player psychology: achiever, killer, explorer, manipulator
public enum TYPE { RUNNER, SHOOTER, JUMPER, BUMPER}
//Dreyfus model of skill acquisition:
public enum SKILL_LEVEL { NOVICE, BEGINNER, COMPETENT, PROFICIENT, EXPERT}
private Set<LevelComponent.TYPE> enabledComponents = new HashSet<LevelComponent.TYPE>();
private SKILL_LEVEL skillLevel;
private TYPE type;
public PlayerProfile(SKILL_LEVEL skillLevel, TYPE type) {
this.skillLevel = skillLevel;
this .type = type;
}
public SKILL_LEVEL getSkillLevel() {
return skillLevel;
}
public int getJumpSkill() {
switch (type) {
case JUMPER :
switch (skillLevel) {
case NOVICE :
return 20;
case BEGINNER :
return 40;
case COMPETENT :
return 60;
case PROFICIENT :
return 80;
case EXPERT :
return 100;
default :
return 0;
}
default :
return 0;
}
}
public TYPE getType() {
return type;
}
public void setDisabled(LevelComponent.TYPE type) {
if (enabledComponents.contains(type)) {
System.out.println("Component type disabled: " + type);
enabledComponents.remove(type);
}
}
public void setEnabled(LevelComponent.TYPE type) {
if (!enabledComponents.contains(type)) {
System.out.println("Component type enabled: " + type);
enabledComponents.add(type);
}
}
@Override
public String toString() {
return skillLevel + " " + type;
}
}