Exemple #1
0
        public override Wait NormalTurn(Turn turn)
        {
            HashSet <Creature> targets = new HashSet <Creature>();

            foreach (var part in Parts)
            {
                targets.AddRange(part.Tile.Creatures);
            }

            foreach (var target in targets)
            {
                target.AttackSelf(IceAttack);
                target.TakeDamage(10, Element.Ice);
                target.CheckDead(Vector2.Zero);
            }

            Drift(0, 1, Parts.Count / 2);
            Drift(0, -1, Parts.Count / 2);
            Drift(1, 0, Parts.Count / 2);
            Drift(-1, 0, Parts.Count / 2);

            return(base.NormalTurn(turn));
        }
 public virtual Wait TakeTurn(Turn turn)
 {
     return(Wait.NoWait);
 }
 public virtual Wait StartTurn(Turn turn)
 {
     return(Wait.NoWait);
 }
 public void AddImmediate(Turn turn)
 {
     ImmediateTurns.Add(turn);
 }
 public TurnForceSkill(Turn root, TurnTaker turnTaker, Skill skill) : base(root, turnTaker)
 {
     Skill = skill;
 }
 public Turn(Turn root, TurnTaker turnTaker)
 {
     Queue     = root.Queue;
     TurnTaker = turnTaker;
     Root      = root;
 }
Exemple #7
0
        public override void Update(GameTime gameTime)
        {
            SeenBosses.RemoveWhere(x => x.Destroyed);

            CameraFocus.Update();
            if (CameraFocus.Dead)
            {
                CameraFocus = CameraFocus.MoveNext(Player, 30);
            }
            InputTwinState state = Game.InputState;

            PushObjects();
            Menu.Update(this);

            if (Player.Dead)
            {
                Menu.HandleInput(this);
            }

            PopupHelper.Global.Update(this);
            //PopupManager.Update(this);
            Wait.Update();

            bool cancel = false;

            while (!cancel && Wait.Done && !Player.Dead && CameraFocus.Done)
            {
                var         corpses            = Entities.Where(x => x.Dead && !x.Control.HasImmediateTurns());
                List <Wait> waitForDestruction = new List <Wait>();
                foreach (var corpse in corpses)
                {
                    waitForDestruction.Add(Scheduler.Instance.RunAndWait(corpse.RoutineDestroy()));
                }
                if (waitForDestruction.Any())
                {
                    Wait.Add(new WaitAll(waitForDestruction));
                }

                Enemy foundBoss = Spawner.Bosses.Find(x => !x.Dead && IsBossVisible(x) && !SeenBosses.Contains(x));
                if (foundBoss != null)
                {
                    Wait.Add(Scheduler.Instance.RunAndWait(RoutineBossWarning(foundBoss)));
                    break;
                }

                ActionQueue.Step();

                Turn = ActionQueue.CurrentTurn;
                if (Turn == null)
                {
                    break;
                }

                switch (Turn.Phase)
                {
                case TurnPhase.Start:
                    Wait.Add(Turn.StartTurn());
                    break;

                case TurnPhase.Tick:
                    if (Turn.TurnTaker.Controllable(Player))
                    {
                        Menu.HandleInput(this);
                        cancel = true;
                    }
                    else if (Turn.TakeTurn())
                    {
                        Wait.Add(Turn.Wait);
                    }
                    break;

                case TurnPhase.End:
                    Wait.Add(Turn.EndTurn());
                    break;
                }

                Wait.Update();
            }

            foreach (var obj in GameObjects.GetAndClean(x => x.Destroyed))
            {
                obj.Update();
            }

            foreach (var quest in Quests)
            {
                if (!quest.Completed && quest.PrerequisitesCompleted)
                {
                    quest.Completed = quest.CheckCompletion();
                }
            }

            Vector2 worldPos = Vector2.Transform(new Vector2(InputState.MouseX, InputState.MouseY), Matrix.Invert(WorldTransform));
            int     tileX    = Util.FloorDiv((int)worldPos.X, 16);
            int     tileY    = Util.FloorDiv((int)worldPos.Y, 16);

            TileCursor = new Point(tileX, tileY);
            if (Menu.IsMouseOver(InputState.MouseX, InputState.MouseY))
            {
                TileCursor = null;
            }

            Tooltip = string.Empty;
            if (TileCursor.HasValue && CameraMap != null)
            {
                Tile tile = CameraMap.GetTile(TileCursor.Value.X, TileCursor.Value.Y);
                if (tile != null && tile.IsVisible())
                {
                    tile.AddTooltip(ref Tooltip);
                }
            }
            Tooltip = Tooltip.Trim();
        }
Exemple #8
0
        public override Wait TakeTurn(Turn turn)
        {
            Spawner.TakeTurn(turn);

            return(Wait.NoWait);
        }
 public override Wait EndTurn(Turn turn)
 {
     return(Creature.EndTurn(turn));
 }
Exemple #10
0
 public override Wait TakeTurn(Turn turn)
 {
     return(Creature.TakeTurn(turn));
 }
Exemple #11
0
 public override Wait StartTurn(Turn turn)
 {
     return(Creature.StartTurn(turn));
 }
Exemple #12
0
 public override Wait EndTurn(Turn turn)
 {
     return(World.EndTurn(turn));
 }
Exemple #13
0
 public override Wait TakeTurn(Turn turn)
 {
     return(World.TakeTurn(turn));
 }
Exemple #14
0
 public override Wait StartTurn(Turn turn)
 {
     return(World.StartTurn(turn));
 }
Exemple #15
0
 public virtual Wait EndTurn(Turn turn)
 {
     return(Wait.NoWait);
 }
Exemple #16
0
 public override Wait TakeTurn(Turn turn)
 {
     return(Entity.NormalTurn(turn));
 }
Exemple #17
0
 public void AddImmediate(Turn parent)
 {
     Queue.AddImmediate(new Turn(parent, this));
 }
Exemple #18
0
 public override Wait TakeTurn(Turn turn)
 {
     return(Cloud.NormalTurn(turn));
 }
Exemple #19
0
 public virtual Wait NormalTurn(Turn turn)
 {
     return(Wait.NoWait);
 }
Exemple #20
0
 public Wait EndTurn(Turn turn)
 {
     return(RoguelikeEngine.Wait.NoWait);
 }