Esempio n. 1
0
        protected override bool PerformAbility()
        {
            DungeonMap map    = Game.DungeonMap;
            Player     player = Game.Player;

            if (player.Mana < _manaCost)
            {
                Game.MessageLog.Add($"You don't have enough mana to use this skill. It costs {_manaCost} mana points", Swatch.DbBlood);

                return(false);
            }
            else
            {
                player.Mana -= _manaCost;

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

                return(true);
            }
        }
Esempio n. 2
0
        public void SelectTarget(Point target)
        {
            DungeonMap dungeonmap = 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 (ICell cell in dungeonmap.GetCellsInCircle(target.X, target.Y, _area))
            {
                Monster monster = dungeonmap.GetMonsterAt(cell.X, cell.Y);
                if (monster != null)
                {
                    Game.CommandSystem.Attack(fireballActor, monster);
                    if (Dice.Roll("1D100") < _poisonChance)
                    {
                        if (monster.IsPoisonedImmune == false && _poisonDamage != 0)
                        {
                            monster.State = new MonsterAbnormalState(monster, _poisonLength, "Poisoned", -1, -1, _poisonDamage);
                        }
                    }
                }

                if (dungeonmap.CheckForPlayer(cell.X, cell.Y))
                {
                    Game.CommandSystem.Attack(fireballActor, player);
                    if (Dice.Roll("1D100") < _poisonChance)
                    {
                        if (player.IsPoisonedImmune == false && _poisonDamage != 0)
                        {
                            player.State = new AbnormalState(_poisonLength, "Poisoned", "", -2, -2, -3, 2, _poisonDamage);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public void Draw(RLConsole mapConsole)
        {
            if (IsPlayerTargeting)
            {
                DungeonMap map    = Game.DungeonMap;
                Player     player = Game.Player;
                if (_selectionType == SelectionType.Area)
                {
                    foreach (ICell cell in map.GetCellsInCircle(_cursorPosition.X, _cursorPosition.Y, _area))
                    {
                        mapConsole.SetBackColor(cell.X, cell.Y, Swatch.DbSun);
                    }
                }
                else if (_selectionType == SelectionType.Line)
                {
                    foreach (ICell 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);
            }
        }