Exemple #1
0
        public static void Handle(IBattleEntity target, IBattleEntity sender, BCardDto bcard)
        {
            var random = ChickenContainer.Instance.Resolve <IRandomGenerator>();

            if (random.Next() >= bcard.FirstData)
            {
                return;
            }

            CardDto card = ChickenContainer.Instance.Resolve <ICardService>().GetById(bcard.SecondData);

            if (card == null)
            {
                Log.Debug($"Couldn't find any buff with card Id : {bcard.SecondData}");
                return;
            }

            var buff = new BuffContainer(card, sender.Level);

            target.AddBuff(buff);
            if (target is IPlayerEntity player)
            {
                player.SendPacketAsync(player.GenerateBfPacket(buff));
            }
        }