예제 #1
0
        private static async Task DoContinualLight(Player attacker, Room room)
        {
            _taskRunnning   = true;
            attacker.Status = Player.PlayerStatus.Busy;


            await Task.Delay(500);

            if (_target == null)
            {
                var castingTextAttacker = $"A bright {_color} ball of light is released by your hands and hovers in the air.";

                HubContext.Instance.SendToClient(castingTextAttacker, attacker.HubGuid);

                foreach (var character in room.players)
                {
                    if (character != attacker)
                    {
                        var roomMessage = $"{ Helpers.ReturnName(attacker, character, string.Empty)} releases a {_color} bright ball of light which hovers in the air.";

                        HubContext.Instance.SendToClient(roomMessage, character.HubGuid);
                    }
                }

                var ballOfLight = Light.BallOfLight();
                ballOfLight.description = new Description()
                {
                    exam = $"A bright {_color} ball of light hovers here.",
                    look = $"A bright {_color} ball of light hovers here.",
                    room = $"A bright {_color} ball of light hovers here."
                };
                ballOfLight.name     = $"A bright {_color} ball of light";
                ballOfLight.location = Item.Item.ItemLocation.Room;


                room.items.Add(ballOfLight);
            }
            else
            {
                var castingTextAttacker = $"The {_target.name} glows a bright {_color} colour.";

                var castingTextRoom = $"The {_target.name} glows a bright {_color} colour.";

                HubContext.Instance.SendToClient(castingTextAttacker, attacker.HubGuid);
                HubContext.Instance.BroadcastToRoom(castingTextRoom, room.players, attacker.HubGuid, true);

                _target.itemFlags.Add(Item.Item.ItemFlags.glow);
            }
            Player.SetState(attacker);
            _target       = null;
            _taskRunnning = false;
        }