示例#1
0
        public BehaviourTreeBuilder Build(BehaviourTreeBuilder builder, params object[] args)
        {
            NWCreature self = (NWCreature)args[0];

            return(builder.Do("RandomWalk", t =>
            {
                if (self.IsInCombat || !_enmity.IsEnmityTableEmpty(self))
                {
                    if (_.GetCurrentAction(self.Object) == NWScript.ACTION_RANDOMWALK)
                    {
                        self.ClearAllActions();
                    }

                    return BehaviourTreeStatus.Failure;
                }

                if (_.GetCurrentAction(self.Object) == NWScript.ACTION_INVALID &&
                    _.IsInConversation(self.Object) == NWScript.FALSE &&
                    _.GetCurrentAction(self.Object) != NWScript.ACTION_RANDOMWALK &&
                    _random.Random(100) <= 25)
                {
                    self.AssignCommand(() => _.ActionRandomWalk());
                }
                return BehaviourTreeStatus.Running;
            }));
        }
示例#2
0
        public bool Run(object[] args)
        {
            NWCreature self = (NWCreature)args[0];

            if (self.IsInCombat || !_enmity.IsEnmityTableEmpty(self))
            {
                if (_.GetCurrentAction(self.Object) == NWScript.ACTION_RANDOMWALK)
                {
                    self.ClearAllActions();
                }

                return(false);
            }

            if (_.GetCurrentAction(self.Object) == NWScript.ACTION_INVALID &&
                _.IsInConversation(self.Object) == NWScript.FALSE &&
                _.GetCurrentAction(self.Object) != NWScript.ACTION_RANDOMWALK &&
                _random.Random(100) <= 25)
            {
                self.AssignCommand(() => _.ActionRandomWalk());
            }
            return(true);
        }