package skills;
import AXJava.AXGamification;
import LivinGrimoire.DiSkillV2;
import LivinGrimoire.Neuron;
public class GamificationP extends DiSkillV2 {
// the grind side of the game, see GamificationN for the reward side
private int gain = 1;
private DiSkillV2 skill;
private AXGamification axGamification = new AXGamification();
public GamificationP(DiSkillV2 skill) {
this.skill = skill;
}
public void setGain(int gain) {
if (gain >0){
this.gain = gain;}
}
public AXGamification getAxGamification() {
// shallow ref
return axGamification;
}
@Override
public void output(Neuron noiron) {
// skill activation increases gaming credits
if (outAlg != null) {axGamification.incrementBy(gain);}
super.output(noiron);
}
}
package LivinGrimoire;
import java.util.ArrayList;
public class DiSkillV2 {
protected Kokoro kokoro = new Kokoro(new AbsDictionaryDB()); // consciousness, shallow ref class to enable interskill communications
protected DISkillUtils diSkillUtils = new DISkillUtils();
protected Algorithm outAlg = null; // skills output
protected int outpAlgPriority = -1; // defcon 1->5
public DiSkillV2() {
super();
}
// skill triggers and algorithmic logic
public void input(String ear, String skin, String eye) {
}
// extraction of skill algorithm to run (if there is one)
public void output(Neuron noiron) {
if (outAlg != null) {
noiron.insertAlg(this.outpAlgPriority,outAlg);
outpAlgPriority = -1;
outAlg = null;
}
}
public void setKokoro(Kokoro kokoro) {
// use this for telepathic communication between different chobits objects
this.kokoro = kokoro;
}
// in skill algorithm building shortcut methods:
protected void setVerbatimAlg(int priority, String... sayThis){
// build a simple output algorithm to speak string by string per think cycle
// uses varargs param
this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm(sayThis);
this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
}
protected void setVerbatimAlgFromList(int priority, ArrayList<String> sayThis){
// build a simple output algorithm to speak string by string per think cycle
// uses list param
this.outAlg = this.diSkillUtils.algBuilder(new APVerbatim(sayThis));
this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
}
protected void algPartsFusion(int priority,Mutatable... algParts){
// build a custom algorithm out of a chain of algorithm parts(actions)
this.outAlg = this.diSkillUtils.algBuilder(algParts);
this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
}
public Boolean pendingAlgorithm(){
// is an algorithm pending?
return this.outAlg != null;
}
}
package skills;
import AXJava.AXGamification;
import LivinGrimoire.DiSkillV2;
import LivinGrimoire.Neuron;
public class GamificationP extends DiSkillV2 {
// the grind side of the game, see GamificationN for the reward side
private int gain = 1;
private DiSkillV2 skill;
private AXGamification axGamification = new AXGamification();
public GamificationP(DiSkillV2 skill) {
this.skill = skill;
}
public void setGain(int gain) {
if (gain >0){
this.gain = gain;}
}
public AXGamification getAxGamification() {
// shallow ref
return axGamification;
}
@Override
public void input(String ear, String skin, String eye) {
skill.input(ear, skin, eye);
}
@Override
public void output(Neuron noiron) {
// skill activation increases gaming credits
if (skill.pendingAlgorithm()) {axGamification.incrementBy(gain);}
skill.output(noiron);
}
}
package AXJava;
public class AXGamification {
// this auxiliary module can add fun to tasks, skills, and abilities simply by
// tracking their usage, and maximum use count.
private int counter = 0;
private int max = 0;
public int getCounter() {
return counter;
}
public int getMax() {
return max;
}
public void resetCount(){
counter = 0;
}
public void resetAll(){
max = 0;
counter = 0;
}
public void increment(){
counter++;
if (counter > max) {
max = counter;
}
}
public void incrementBy(int n){
counter+= n;
if (counter > max) {
max = counter;
}
}
public Boolean reward(int cost){
// game grind points used for rewards
// consumables, items or upgrades this makes games fun
if (cost>counter){return false;}
counter-=cost;
return true;
}
public Boolean surplus(int cost){
// has surplus for reward?
if (cost>counter){return false;}
return true;
}
}
package skills;
import AXJava.AXGamification;
import LivinGrimoire.DiSkillV2;
import LivinGrimoire.Neuron;
public class GamificationN extends DiSkillV2 {
private AXGamification axGamification;
private int cost = 3;
private DiSkillV2 skill;
public GamificationN(DiSkillV2 skill, GamificationP rewardBank) {
this.skill = skill;
axGamification = rewardBank.getAxGamification();
}
public void setCost(int cost) {
this.cost = cost;
}
@Override
public void input(String ear, String skin, String eye) {
// engage skill only if a reward is possible
if (axGamification.surplus(cost)){skill.input(ear, skin, eye);}
}
@Override
public void output(Neuron noiron) {
// charge reward if an algorithm is pending
if (skill.pendingAlgorithm()) {axGamification.reward(cost);skill.output(noiron);}
}
}