Ejemplo n.º 1
0
        private void attack(int min, int max, string targetGroup)
        {
            switch (targetGroup)
            {
            case "enemies":
                for (int c = 0; c < targets.Count; c++)
                {
                    currentTarget = c;
                    int AC = accuracyCheck();
                    if (targets[c].team != user.team && AC > 0)
                    {
                        Combat.output(user.Name + " hits " + targets[c].Name + " with " + Name);
                        float dmg = getDamage();
                        if (AC == 2)
                        {
                            dmg = criticalHit(dmg);
                        }                                                //critical hit
                        targets[c].damage(dmg, element, false);
                    }
                    else
                    {
                        Combat.output(user.Name + " missed " + targets[c].Name + " with " + Name, textColor: System.Drawing.Color.BurlyWood);
                    }
                }
                break;

            /*  foreach (Character c in targets)
             * {
             *    int AC = accuracyCheck();
             *    if (c.team != user.team && AC > 0)
             *    {
             *        Combat.output(user.Name + " hits " + c.Name + " with " + Name);
             *        float dmg = getDamage();
             *        if (AC == 2) { dmg = criticalHit(dmg); } //critical hit
             *        c.damage(dmg, element, false);
             *    }
             *    else { Combat.output(user.Name + " missed " + c.Name + " with " + Name, textColor: System.Drawing.Color.BurlyWood); }
             * }*/

            case "allies":
                for (int c = 0; c < targets.Count; c++)
                {
                    currentTarget = c;
                    int AC = accuracyCheck();
                    if (targets[c].team == user.team && targets[c] != user && AC > 0)
                    {
                        Combat.output(user.Name + " hits " + targets[c].Name + " with " + Name);
                        float dmg = getDamage();
                        if (AC == 2)
                        {
                            dmg = criticalHit(dmg);
                        }                                                //critical hit
                        targets[c].damage(dmg, element, false);
                    }
                    else
                    {
                        Combat.output(user.Name + " missed " + targets[c].Name + " with " + Name, textColor: System.Drawing.Color.BurlyWood);
                    }
                }
                break;

            case "self":
                for (int c = 0; c < targets.Count; c++)
                {
                    currentTarget = c;
                    int AC = accuracyCheck();
                    if (targets[c] == user && AC > 0)
                    {
                        Combat.output(user.Name + " hits themself with " + Name);
                        float dmg = getDamage();
                        if (AC == 2)
                        {
                            dmg = criticalHit(dmg);
                        }                                                //critical hit
                        targets[c].damage(dmg, element, false);
                    }
                    else
                    {
                        Combat.output(user.Name + " missed themself with " + Name, textColor: System.Drawing.Color.BurlyWood);
                    }
                }
                break;

            default:
                Combat.output("What happened here? Attack no targets?");
                break;
            }
        }
Ejemplo n.º 2
0
 private bool addStatus(string status, int stacks, int chance, string target, bool endFlag)
 {
     if (target == "enemies")
     {
         foreach (Character c in targets)
         {
             if (c.team != user.team)
             {
                 if (Combat.rollCheck(chance, 101))
                 {
                     c.addStatus(status);
                 }
             }
         }
         if (endFlag)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     if (target == "allies")
     {
         foreach (Character c in targets)
         {
             if (c.team == user.team && c != user)
             {//use on allies and not self
                 if (Combat.rollCheck(chance, 101))
                 {
                     c.addStatus(status);
                 }
             }
         }
         if (endFlag)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     if (target == "self")
     {
         if (Combat.rollCheck(chance, 101))
         {
             user.addStatus(status);
         }
         if (endFlag)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     return(true);
 }