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:
70
src/dk/itu/mario/level/PlayerProfile.java
Normal file
70
src/dk/itu/mario/level/PlayerProfile.java
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user