public override ActionEventData ChooseAction(IEntity entity)
        {
            if (!Resting)
            {
                return(null);
            }

            if (EventSystem.GetStat(entity, "Tension") > 0)
            {
                MessageSystem.Write("Your rest is interrupted!");
                Resting = false;
                return(null);
            }

            var tilt         = entity.Get <TiltFighter>();
            var aura         = entity.Get <AuraFighter>();
            var currentAegis = EventSystem.GetStat(entity, "CurrentAegisLevel");
            var maxAegis     = EventSystem.GetStat(entity, "Aegis");

            if (tilt.Tilt.Current == 0 &&
                aura.Aura.Current == aura.BaseAura &&
                tilt.BrokenTicks == 0 &&
                currentAegis == maxAegis)
            {
                MessageSystem.Write("You finish resting.");
                Resting = false;
                return(null);
            }

            return(new ActionEventData {
                Action = ActionType.Wait, Speed = 1000
            });
        }
Example #2
0
        public override ActionEventData ChooseAction(IEntity entity)
        {
            var currentCoordinate = _positionSystem.CoordinateOf(entity);

            if (Path.FirstOrDefault() == currentCoordinate)
            {
                Path.Remove(currentCoordinate);
            }

            if (Path.Any())
            {
                SetWaitingForInputIfPlayer(entity, false);

                if (_playerSystem.Player == entity && _eventRuleSystem.GetStat(entity, "Tension") > 0)
                {
                    _messageSystem.Write("You can't auto-walk when tension is this high.");
                    EndPath(entity);
                    return(null);
                }

                var coordinate = Path.First();
                var vector     = currentCoordinate - coordinate;

                if (CantReach(vector))
                {
                    EndPath(entity);
                }

                return(new ActionEventData {
                    Action = ActionType.Move, Parameters = vector.ToString(), Speed = entity.Get <Actor>().Speed
                });
            }
            else
            {
                EndPath(entity);
                return(null);
            }
        }