コード例 #1
0
        protected override bool PerformAbility()
        {
            DungeonMap map    = Game.DungeonMap;
            Player     player = Game.Player;

            Game.MessageLog.Add($"{player.Name} performs a whirlwind attack against all adjacent enemies");

            List <Point> monsterLocations = new List <Point>();

            foreach (Cell cell in map.GetCellsInArea(player.X, player.Y, 1))
            {
                foreach (Point monsterLocation in map.GetMonsterLocations())
                {
                    if (cell.X == monsterLocation.X && cell.Y == monsterLocation.Y)
                    {
                        monsterLocations.Add(monsterLocation);
                    }
                }
            }

            foreach (Point monsterLocation in monsterLocations)
            {
                Monster monster = map.GetMonsterAt(monsterLocation.X, monsterLocation.Y);
                if (monster != null)
                {
                    Game.CommandSystem.Attack(player, monster);
                }
            }

            return(true);
        }
コード例 #2
0
 public void Draw()
 {
     if (IsPlayerTargeting)
     {
         DungeonMap map    = Game.DungeonMap;
         Player     player = Game.Player;
         if (_selectionType == SelectionType.Area)
         {
             foreach (Cell cell in map.GetCellsInArea(_cursorPosition.X, _cursorPosition.Y, _area))
             {
                 var instance = GameObject.Instantiate <GameObject>(Game.Items["Effect"], new Vector2(cell.X, cell.Y),
                                                                    Quaternion.identity);
                 instance.transform.SetParent(Game.effectsHolder);
             }
         }
         else if (_selectionType == SelectionType.Line)
         {
             foreach (Cell cell in map.GetCellsAlongLine(player.X, player.Y, _cursorPosition.X, _cursorPosition.Y))
             {
                 var instance = GameObject.Instantiate <GameObject>(Game.Items["Effect"], new Vector2(cell.X, cell.Y),
                                                                    Quaternion.identity);
                 instance.transform.SetParent(Game.effectsHolder);
             }
         }
         var go = GameObject.Instantiate <GameObject>(Game.Items["Effect"], new Vector2(_cursorPosition.X, _cursorPosition.Y),
                                                      Quaternion.identity);
         go.transform.SetParent(Game.effectsHolder);
     }
 }
コード例 #3
0
        protected override bool PerformAbility()
        {
            DungeonMap map    = Game.DungeonMap;
            Player     player = Game.Player;

            foreach (Cell cell in map.GetCellsInArea(player.X, player.Y, _revealDistance))
            {
                if (cell.IsWalkable)
                {
                    map.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
                }
            }

            return(true);
        }
コード例 #4
0
ファイル: Fireball.cs プロジェクト: allisterb/vRogue
        public void SelectTarget(Point target)
        {
            DungeonMap map    = Game.DungeonMap;
            Player     player = Game.Player;

            Game.MessageLog.Add($"{player.Name} casts a {Name}");
            Actor fireballActor = new Actor {
                Attack       = _attack,
                AttackChance = _attackChance,
                Name         = Name
            };

            foreach (Cell cell in map.GetCellsInArea(target.X, target.Y, _area))
            {
                Monster monster = map.GetMonsterAt(cell.X, cell.Y);
                if (monster != null)
                {
                    Game.CommandSystem.Attack(fireballActor, monster);
                }
            }
        }
コード例 #5
0
        public void Draw(RLConsole mapConsole)
        {
            if (IsPlayerTargeting)
            {
                DungeonMap map    = Game.DungeonMap;
                Player     player = Game.Player;
                if (_selectionType == SelectionType.Area)
                {
                    foreach (Cell cell in map.GetCellsInArea(_cursorPosition.X, _cursorPosition.Y, _area))
                    {
                        mapConsole.SetBackColor(cell.X, cell.Y, Swatch.DbSun);
                    }
                }
                else if (_selectionType == SelectionType.Line)
                {
                    foreach (Cell cell in map.GetCellsAlongLine(player.X, player.Y, _cursorPosition.X, _cursorPosition.Y))
                    {
                        mapConsole.SetBackColor(cell.X, cell.Y, Swatch.DbSun);
                    }
                }

                mapConsole.SetBackColor(_cursorPosition.X, _cursorPosition.Y, Swatch.DbLight);
            }
        }
コード例 #6
0
    public void Draw()
    {
        if (IsPlayerTargeting)
        {
            DungeonMap map    = Game.DungeonMap;
            Player     player = Game.Player;
            if (_selectionType == SelectionType.Area)
            {
                foreach (RogueSharp.Cell cell in map.GetCellsInArea(_cursorPosition.X, _cursorPosition.Y, _area))
                {
                    Display.CellAt(0, cell.X, cell.Y).SetContent(" ", Colors.FloorBackground, Swatch.DbSun);
                }
            }
            else if (_selectionType == SelectionType.Line)
            {
                foreach (RogueSharp.Cell cell in map.GetCellsAlongLine(player.X, player.Y, _cursorPosition.X, _cursorPosition.Y))
                {
                    Display.CellAt(0, cell.X, cell.Y).SetContent(" ", Colors.FloorBackground, Swatch.DbSun);
                }
            }

            Display.CellAt(0, _cursorPosition.X, _cursorPosition.Y).SetContent(" ", Colors.FloorBackground, Swatch.DbLight);
        }
    }