Exemplo n.º 1
0
 protected override Task OnLaunchAttack(AttackEvent attackEvent)
 {
     if (Element == Element.火 && random.Next(2) == 0)
     {
         attackEvent.DataBag.DoubleAttack = true;
     }
     return(base.OnLaunchAttack(attackEvent));
 }
Exemplo n.º 2
0
        protected override Task OnAttacked(AttackEvent attackEvent)
        {
            if (Element == Element.金)
            {
                if (random.Next(2) == 0)
                {
                    attackEvent.DataBag.Ineffective = true;
                }
            }

            return(base.OnAttacked(attackEvent));
        }
Exemplo n.º 3
0
        protected override Task OnLaunchAttack(AttackEvent attackEvent)
        {
            if (Element == Element.火)
            {
                if (random.Next(1) == 0)
                {
                    attackEvent.InitiatePlayer.PlayerHost.WriteWarningMessage("你做好了发动攻击的一切准备,就是忘记了带上武器,这一次,你只好无功而返了。");
                    attackEvent.Handled = true;
                }
            }

            return(base.OnLaunchAttack(attackEvent));
        }
Exemplo n.º 4
0
        protected override Task OnAttacked(AttackEvent attackEvent)
        {
            if (Element == Element.金)
            {
                if (random.Next(2) == 0)
                {
                    attackEvent.RecipientPlayer.PlayerHost.WriteWarningMessage("当你正打算用盾牌格挡这一次攻击的时候,却发现盾牌无论如何都找不到了");
                    attackEvent.DataBag.ShieldDisabled = true;
                }
            }
            else if (Element == Element.水)
            {
                if (random.Next(2) == 0)
                {
                    attackEvent.DataBag.DoubleAttack = true;
                }
            }

            return(base.OnAttacked(attackEvent));
        }
Exemplo n.º 5
0
 public async override Task UseCard(SimpleGamePlayer user, SimpleGamePlayer target, CancellationToken token)
 {
     var attackEvent = new AttackEvent(user, target, Element, Point);
     await user.Game.SendGameEvent(attackEvent);
 }
Exemplo n.º 6
0
        protected override async Task OnAttacked(AttackEvent attackEvent)
        {
            var recipient = attackEvent.RecipientPlayer;
            var initiate  = attackEvent.InitiatePlayer;

            if ((bool?)attackEvent.DataBag.ShieldDisabled == true)
            {
                return;
            }



            attackEvent.Handled = true;

            if (attackEvent.Element == null)
            {
                attackEvent.AnnounceAttackIneffective();



                times--;
                if (Element == Element.金)
                {
                    if (times > 0)
                    {
                        recipient.PlayerHost.WriteWarningMessage($"金属性盾牌阻挡了 {attackEvent.AttackPoint} 点攻击,还剩 {times} 次机会。");
                    }

                    else
                    {
                        recipient.PlayerHost.WriteWarningMessage($"金属性盾牌阻挡了 {attackEvent.AttackPoint} 点攻击,防御效果已经失效");
                    }
                }
                else if (Element == Element.木)
                {
                    recipient.HealthPoint += attackEvent.AttackPoint;
                    recipient.PlayerHost.WriteWarningMessage($"木属性的盾牌使得对您的攻击转变为治疗,您获得了 {attackEvent.AttackPoint} 点生命值,目前生命值为 {recipient.HealthPoint} ,防御效果已经失效");
                }
                else if (Element == Element.水)
                {
                    initiate.Purify(true);
                    recipient.PlayerHost.WriteWarningMessage($"水属性的盾牌阻挡了 {attackEvent.AttackPoint} 点攻击,并清除攻击方的一切效果,防御效果已经失效");
                }
                else if (Element == Element.火)
                {
                    recipient.PlayerHost.WriteWarningMessage($"火属性的盾牌阻挡了 {attackEvent.AttackPoint} 点攻击,并对攻击方造成同等伤害,防御效果已经失效");
                    await recipient.Game.SendGameEvent(new AttackEvent( recipient, initiate, null, attackEvent.AttackPoint ));
                }
                else if (Element == Element.土)
                {
                    initiate.Confine();
                    recipient.PlayerHost.WriteWarningMessage($"土属性的盾牌阻挡了 {attackEvent.AttackPoint} 点攻击,并禁锢攻击方一回合,防御效果已经失效");
                }

                else if (Element == null)
                {
                    recipient.PlayerHost.WriteWarningMessage($"您使用盾牌阻挡了 {attackEvent.AttackPoint} 点攻击,防御效果已经失效");
                }

                else
                {
                    throw new InvalidOperationException();
                }
            }
            else
            {
                if (Element == null)
                {
                    recipient.PlayerHost.WriteWarningMessage($"您的盾牌完全无法抵挡{attackEvent.Element}属性的攻击,盾牌已经被击碎");
                    attackEvent.Handled = false;
                    recipient.Effects.RemoveEffect(this);
                }
                else if (attackEvent.Element == Element)
                {
                    recipient.PlayerHost.WriteWarningMessage($"您受到{attackEvent.Element.Name}属性的攻击,与您的盾牌属性相同,盾牌完全没能发挥作用。");
                    attackEvent.Handled = false;
                }
                else if (attackEvent.Element.IsCounteract(Element))
                {
                    attackEvent.AnnounceDoubleAttack();
                    recipient.HealthPoint -= attackEvent.AttackPoint * 2;

                    recipient.PlayerHost.WriteWarningMessage($"您受到{attackEvent.Element.Name}属性的攻击,与您的盾牌属性相克,造成了双倍伤害 {attackEvent.AttackPoint * 2} 点,目前生命值 {recipient.HealthPoint} 点。");
                }

                else if (attackEvent.Element.IsReinforce(Element))
                {
                    attackEvent.AnnounceAttackIneffective();
                    recipient.HealthPoint += attackEvent.AttackPoint;

                    recipient.PlayerHost.WriteWarningMessage($"您受到{attackEvent.Element.Name}属性的攻击,与您的盾牌属性相生,所受伤害变为治疗,增加生命值 {attackEvent.AttackPoint} 点,目前生命值 {recipient.HealthPoint} 点。");
                }
                else
                {
                    attackEvent.AnnounceAttackIneffective();
                    recipient.PlayerHost.WriteWarningMessage($"{Element.Name}属性的盾牌阻挡了 {attackEvent.AttackPoint} 点{attackEvent.Element}属性攻击,防御效果已经失效");
                }

                if (attackEvent.Handled)
                {
                    times = 0;
                }
            }

            if (times == 0)
            {
                recipient.Effects.RemoveEffect(this);
            }
        }