コード例 #1
0
        public static bool ConfuseScroll(Entity target)
        {
            var cell = new SelectCellDialog(0).Show();

            if (cell != null)
            {
                var enemy = Program.Game.Entities.FirstOrDefault(e => e.HasComponent <FighterComponent>() && e.X == cell.X && e.Y == cell.Y);

                if (enemy != null)
                {
                    MessageLog.Add($"{enemy.Name} is confused.", Color.LightBlue);
                    enemy.GetComponent <FighterComponent>().ApplyStatus(new ConfusionEffect(ConfuseTurns));

                    return(true);
                }
            }

            MessageLog.Add($"Confuse scroll can not hit any monsters.", Color.Orange);
            return(false);
        }
コード例 #2
0
        public static bool FireballScroll(Entity target)
        {
            var cell = new SelectCellDialog(FireballRadius).Show();

            if (cell != null)
            {
                MessageLog.Add("The fireball explodes!", Color.Red);

                var victims = Program.Game.Entities.Where(e => e.HasComponent <FighterComponent>() && e.DistanceTo(cell.X, cell.Y) <= FireballRadius);

                foreach (var victim in victims)
                {
                    MessageLog.Add($"{victim.Name} is burned for {FireballDamage} HP!", Color.Red);
                    victim.GetComponent <FighterComponent>().Damage(FireballDamage, null, ElementType.Fire);
                }

                return(true);
            }

            return(false);
        }