コード例 #1
0
 //普通攻击
 public string GetAttacked(Competitor Attacker)
 {
     //普通攻击命中
     if (ProbabilityFunction(Attacker.HitRate))
     {
         int    PreviousHealth = Health;
         string Result         = null;
         //物理攻击
         if (Attacker.IsPhysical == true)
         {
             int AttackValue = Attacker.Attack - Defense;
             AttackValue = AttackValue * Attacker.AttackPercentage / 100;
             if (AttackValue < 0)
             {
                 Result += ($"{Attacker.GetName()}普通攻击未对{this.GetName()}造成伤害\n");
             }
             else
             {
                 if (Health >= AttackValue)
                 {
                     Health -= AttackValue;
                 }
                 else
                 {
                     Health = 0;
                 }
                 Result += ($"{Attacker.GetName()}普通攻击对{this.GetName()}造成{PreviousHealth - Health}点伤害\n");
             }
         }
         //元素攻击
         else
         {
             int AttackValue = Attacker.Attack;
             AttackValue = AttackValue * Attacker.AttackPercentage / 100;
             if (Health >= AttackValue)
             {
                 Health -= AttackValue;
             }
             else
             {
                 Health = 0;
             }
             Result += ($"{Attacker.GetName()}普通攻击对{this.GetName()}造成{PreviousHealth - Health}点伤害\n");
         }
         Result += ($"{this.GetName()}剩下{Health}点生命值\n");
         return(Result);
     }
     //普通攻击未命中
     else
     {
         return($"{Attacker.GetName()}普通攻击未命中\n");
     }
 }
コード例 #2
0
 //布洛妮娅1技能:天使重构,对敌人
 //攻击后25%概率发射钻头,造成4次12点伤害
 public string EffectedByBronya_Cyberangel(Competitor User)
 {
     try
     {
         if (User.GetName() != "Bronya")
         {
             throw new UserMismatchingException(User);
         }
         if (ProbabilityFunction(25))
         {
             int PreviousHealth = Health;
             for (int i = 1; i <= 4; i++)
             {
                 if (ProbabilityFunction(User.HitRate))
                 {
                     int AttackValue = 12 - Defense;
                     AttackValue = AttackValue * User.AttackPercentage / 100;
                     if (Health >= AttackValue)
                     {
                         Health -= AttackValue;
                     }
                     else
                     {
                         Health = 0;
                         break;
                     }
                 }
             }
             return(($"{User.GetName()}发动技能天使重构,对{this.GetName()}造成{PreviousHealth - Health}点伤害\n")
                    + ($"{this.GetName()}剩下{Health}点体力\n"));
         }
         else
         {
             return(null);
         }
     }
     catch (UserMismatchingException)
     {
         return(null);
     }
 }
コード例 #3
0
 //符华技能:形之笔墨,对敌人
 //每三个回合发动一次,造成18点元素伤害,降低对手25%命中率,可叠加
 public string EffectedByFuHua(Competitor User)
 {
     try
     {
         if (User.GetName() != "FuHua")
         {
             throw new UserMismatchingException(User);
         }
         if (ProbabilityFunction(User.HitRate))
         {
             int AttackValue     = 18 * User.AttackPercentage / 100;
             int PreviousHealth  = Health;
             int PreviousHitRate = HitRate;
             if (Health >= AttackValue)
             {
                 Health -= AttackValue;
             }
             else
             {
                 Health = 0;
             }
             if (HitRate >= 25)
             {
                 HitRate -= 25;
             }
             else
             {
                 HitRate = 0;
             }
             return($"{User.GetName()}发动技能形之笔墨,对{this.GetName()}造成{PreviousHealth - Health}点伤害,降低{PreviousHitRate - HitRate}%命中率\n");
         }
         else
         {
             return($"{User.GetName()}发动技能形之笔墨未命中\n");
         }
     }
     catch (UserMismatchingException)
     {
         return(null);
     }
 }
コード例 #4
0
 //丽塔2技能:完美心意,对敌人
 //效果,进入魅惑状态2回合
 public string EffectedByRitaRossweisse_Mind(Competitor User)
 {
     try
     {
         if (User.GetName() != "RitaRossweisse")
         {
             throw new UserMismatchingException(User);
         }
         IsCharmed   = true;
         CharmedTime = 2;
         if (HasBeenCharmed == false)
         {
             AttackPercentage = AttackPercentage * 40 / 100;
         }
         HasBeenCharmed = true;
         return($"{User.GetName()}对{this.GetName()}使用魅惑技能,使其进入魅惑状态两回合(期间不能使用技能),永久降低60%伤害\n");
     }
     catch (UserMismatchingException)
     {
         return(null);
     }
 }
コード例 #5
0
 //姬子1技能:真爱不死,对自己
 //对非单人队伍造成伤害提升100%
 public string EffectedByHimeko_Love(Competitor Defender)
 {
     try
     {
         if (this.GetName() != "Himeko")
         {
             throw new UserMismatchingException(this);
         }
         if (Defender.GetName() == "KallenAndSakura")
         {
             AttackPercentage += 100;
             return($"{this.GetName()}发动技能真爱不死,提升100%伤害\n");
         }
         else
         {
             return(null);
         }
     }
     catch (UserMismatchingException)
     {
         return(null);
     }
 }
コード例 #6
0
 //芽衣1技能:崩坏世界的歌姬,对敌人
 //效果:攻击时有30%概率麻痹对方一回合
 public string EffectedByRaidenMei_Singer(Competitor User)
 {
     try
     {
         if (User.GetName() != "RaidenMei")
         {
             throw new UserMismatchingException(User);
         }
         if (ProbabilityFunction(30))
         {
             IsParalysis = true;
             return($"{User.GetName()}发动技能崩坏世界的歌姬,使{this.GetName()}麻痹一回合\n");
         }
         else
         {
             return(null);
         }
     }
     catch (UserMismatchingException)
     {
         return(null);
     }
 }
コード例 #7
0
 //渡鸦2技能:别墅小岛,对敌人
 //每三个回合发动一次,给与对方7次16点伤害
 public string EffectedByCorvusCorax_Island(Competitor User)
 {
     try
     {
         if (User.GetName() != "CorvusCorax")
         {
             throw new UserMismatchingException(User);
         }
         int PreviousHealth = Health;
         for (int i = 1; i <= 7; i++)
         {
             if (ProbabilityFunction(User.HitRate))
             {
                 int AttackValue = 16 - Defense;
                 AttackValue = AttackValue * User.AttackPercentage / 100;
                 if (Health > AttackValue)
                 {
                     Health -= AttackValue;
                 }
                 else
                 {
                     Health = 0;
                     break;
                 }
             }
             else
             {
             }
         }
         return(($"{User.GetName()}发动技能别墅小岛对{this.GetName()}造成{PreviousHealth - Health}点伤害\n")
                + ($"{this.GetName()}剩下{Health}点体力\n"));
     }
     catch (UserMismatchingException)
     {
         return(null);
     }
 }
コード例 #8
0
 //德莉莎2技能:在线踢人,对敌人
 //效果,造成5*16伤害
 public string EffectedByTheresaApocalypse_Kick(Competitor User)
 {
     try
     {
         if (User.GetName() != "TheresaApocalypse")
         {
             throw new UserMismatchingException(User);
         }
         int PreviousHealth = Health;
         for (int i = 1; i <= 5; i++)
         {
             if (ProbabilityFunction(User.HitRate))
             {
                 int AttackValue = 16 - Defense;
                 AttackValue = AttackValue * User.AttackPercentage / 100;
                 if (Health > AttackValue)
                 {
                     Health -= AttackValue;
                 }
                 else
                 {
                     Health = 0;
                     break;
                 }
             }
             else
             {
             }
         }
         return($"{User.GetName()}发动技能在线踢人,对{this.GetName()}造成{PreviousHealth - Health}点伤害\n");
     }
     catch (UserMismatchingException)
     {
         return(null);
     }
 }