this.AIChibiConditions = this.AIChibiConditions || {}; (function() { "use strict"; // CONDITIONS ================================================================= var AnyTargetToConversation = function() { this.initialize(); } AnyTargetToConversation.prototype = new AILeafNode; AnyTargetToConversation.prototype.name = 'AnyTargetToConversation'; AnyTargetToConversation.prototype.update = function(target, fdelta) { if (target.relationTarget !== null && target.relationStatus != 'talk') { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var AnyConversationRequest = function() { this.initialize(); } AnyConversationRequest.prototype = new AILeafNode; AnyConversationRequest.prototype.name = 'AnyConversationRequest'; AnyConversationRequest.prototype.update = function(target, fdelta) { if (target.relationInvite !== null) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var InConversation = function() { this.initialize(); } InConversation.prototype = new AILeafNode; InConversation.prototype.name = 'InConversation'; InConversation.prototype.update = function(target, fdelta) { if (target.relationStatus == 'talk') { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsConversationGood = function() { this.initialize(); } IsConversationGood.prototype = new AILeafNode; IsConversationGood.prototype.name = 'IsConversationGood'; IsConversationGood.prototype.update = function(target, fdelta) { if (target.relationGood >= CONST.GOOD_CONVERSATION) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var PartnerAskedSomething = function() { this.initialize(); } PartnerAskedSomething.prototype = new AILeafNode; PartnerAskedSomething.prototype.name = 'PartnerAskedSomething'; PartnerAskedSomething.prototype.update = function(target, fdelta) { if (target.relationQuestion != null) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsMyTurnInChat = function() { this.initialize(); } IsMyTurnInChat.prototype = new AILeafNode; IsMyTurnInChat.prototype.name = 'IsMyTurnInChat'; IsMyTurnInChat.prototype.update = function(target, fdelta) { if (target.relationMyTurn) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsShitted = function() { this.initialize(); } IsShitted.prototype = new AILeafNode; IsShitted.prototype.name = 'IsShitted'; IsShitted.prototype.update = function(target, fdelta) { if (target.shitted) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsRunning = function() { this.initialize(); } IsRunning.prototype = new AILeafNode; IsRunning.prototype.name = 'IsRunning'; IsRunning.prototype.update = function(target, fdelta) { if (target.relationStatus == 'running') { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsWet = function() { this.initialize(); } IsWet.prototype = new AILeafNode; IsWet.prototype.name = 'IsWet'; IsWet.prototype.update = function(target, fdelta) { if (target.wet) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsLoserConversation = function() { this.initialize(); } IsLoserConversation.prototype = new AILeafNode; IsLoserConversation.prototype.name = 'IsLoserConversation'; IsLoserConversation.prototype.update = function(target, fdelta) { if (target.relationBad >= CONST.LOSER_CONVERSATION) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsMaxTocos = function() { this.initialize(); } IsMaxTocos.prototype = new AILeafNode; IsMaxTocos.prototype.name = 'IsMaxTocos'; IsMaxTocos.prototype.update = function(target, fdelta) { if (target.relationTocos >= CONST.MAX_TOCOS) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsBored = function() { this.initialize(); } IsBored.prototype = new AILeafNode; IsBored.prototype.name = 'IsBored'; IsBored.prototype.update = function(target, fdelta) { if (target.relationStatus == 'bored') { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var CanMarry = function() { this.initialize(); } CanMarry.prototype = new AILeafNode; CanMarry.prototype.name = 'CanMarry'; CanMarry.prototype.update = function(target, fdelta) { if (target.relationStatus != 'running' && target.relationGood >= CONST.WINNER_CONVERSATION) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsPartnerDistant = function() { this.initialize(); } IsPartnerDistant.prototype = new AILeafNode; IsPartnerDistant.prototype.name = 'IsPartnerDistant'; IsPartnerDistant.prototype.update = function(target, fdelta) { var dx = Math.abs(target.relationTarget.x - target.x); if (dx > 120) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ // CONDITIONS ================================================================= var IsWalkingForced = function() { this.initialize(); } IsWalkingForced.prototype = new AILeafNode; IsWalkingForced.prototype.name = 'IsWalkingForced'; IsWalkingForced.prototype.update = function(target, fdelta) { if (target.forceWalk) { return AISUCCESS; } return AIFAILURE; } // ============================================================================ window.AIChibiConditions.AnyTargetToConversation = AnyTargetToConversation; window.AIChibiConditions.AnyConversationRequest = AnyConversationRequest; window.AIChibiConditions.InConversation = InConversation; window.AIChibiConditions.IsConversationGood = IsConversationGood; window.AIChibiConditions.PartnerAskedSomething = PartnerAskedSomething; window.AIChibiConditions.IsMyTurnInChat = IsMyTurnInChat; window.AIChibiConditions.IsShitted = IsShitted; window.AIChibiConditions.IsRunning = IsRunning; window.AIChibiConditions.IsWet = IsWet; window.AIChibiConditions.IsLoserConversation = IsLoserConversation; window.AIChibiConditions.IsMaxTocos = IsMaxTocos; window.AIChibiConditions.IsBored = IsBored; window.AIChibiConditions.CanMarry = CanMarry; window.AIChibiConditions.IsPartnerDistant = IsPartnerDistant; window.AIChibiConditions.IsWalkingForced = IsWalkingForced; }());