Python:
class AXNPC2(AXNPC):
def __init__(self, replyStockLim: int, outputChance: int):
super().__init__(replyStockLim, outputChance)
self.annoyedQue: AnnoyedQ = AnnoyedQ(5)
def strLearn(self, ear: str):
# learns inputs containing strings that are repeatedly used by others
self.annoyedQue.learn(ear)
if self.annoyedQue.isAnnoyed(ear):
self.responder.insert(ear)
Python:
class AXNPC:
def __init__(self, replyStackLim: int, outputChance: int):
self.responder: RefreshQ = RefreshQ(replyStackLim)
self.dripper = PercentDripper()
if 0 < outputChance < 101:
self.dripper.setLimit(outputChance)
self.cmdBreaker: AXCmdBreaker = AXCmdBreaker("say")
def respond(self) -> str:
if self.dripper.drip():
return self.responder.getRNDElement()
return ""
def respondPlus(self, plus) -> str:
if self.dripper.dripPlus(plus):
return self.responder.getRNDElement()
return ""
def learn(self, ear: str) -> bool:
# say hello there : hello there is learned
temp: str = self.cmdBreaker.extractCmdParam(ear)
if len(temp) == 0:
return False
self.responder.insert(temp)
return True
def strRespond(self, ear: str) -> str:
# respond if ear contains a learned input
if len(ear) == 0:
return ""
if self.dripper.drip() and self.responder.strContainsResponse(ear):
return self.responder.getRNDElement()
return ""
def forceRespond(self) -> str:
return self.responder.getRNDElement()
def setConjuration(self, conjuration: str):
self.cmdBreaker.conjuration = conjuration