コード例 #1
0
ファイル: Gladiator.cs プロジェクト: Marcotte173/Upstairs
 public bool SurrenderCheck(Gladiator a, Gladiator b)
 {
     if (SeverelyInjured(head) || SeverelyInjured(torso) || Disabled(leftArm) || Disabled(rightArm) || Disabled(legs))
     {
         if (Disabled(leftArm) && Disabled(rightArm))
         {
             Combat.surrender = true;
             Console.Clear();
             Return.CombatDisplay(a, b);
             Write.Line(0, 24, $"With no means of defending themselves, {name} surrenders");
             return(true);
         }
         if (Owner != null)
         {
             int surrenderRoll = Return.RandomInt(0, Owner.prestige);
             if (SeverelyInjured(head))
             {
                 surrenderRoll += Owner.prestige / 6;
             }
             if (SeverelyInjured(torso))
             {
                 surrenderRoll += Owner.prestige / 6;
             }
             if (Disabled(leftArm))
             {
                 surrenderRoll += Owner.prestige / 6;
             }
             if (Disabled(rightArm))
             {
                 surrenderRoll += Owner.prestige / 6;
             }
             if (Disabled(legs))
             {
                 surrenderRoll += Owner.prestige / 6;
             }
             if (surrenderRoll > Owner.prestige)
             {
                 Combat.surrender = true;
                 Console.Clear();
                 Return.CombatDisplay(a, b);
                 Write.Line(0, 24, $"Displaying heartbreaking cowardice, {name} surrenders");
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #2
0
ファイル: Combat.cs プロジェクト: Marcotte173/Upstairs
    public static void Start(Gladiator a, Gladiator b)
    {
        Console.Clear();
        if (a.Owner.player || b.Owner.player)
        {
            Write.Line(50, 12, "Welcome to the " + Color.BLOOD + "Arena" + Color.RESET + "!");
            Write.Line(30, 14, $"The next match to take place will be between {Color.NAME + a.name + Color.RESET} and {Color.NAME + b.name + Color.RESET}");
            Write.KeyPress(0, 28);
        }
        int round = 0;

        while (winner == null)
        {
            Console.Clear();
            Event();
            for (int i = 0; i < 6; i++)
            {
                Console.Clear();
                Attack(a, b);
                if (a.Owner.player || b.Owner.player)
                {
                    Return.CombatDisplay(a, b);
                }
                if (a.Disabled(a.head) || a.Disabled(a.torso))
                {
                    break;
                }
                if (b.Disabled(b.head) || b.Disabled(b.torso))
                {
                    break;
                }
                if (a.Owner.player || b.Owner.player)
                {
                    Thread.Sleep(100);
                }
                round++;
            }
            if (a.SurrenderCheck(a, b))
            {
                winner    = b;
                loser     = a;
                surrender = true;
            }
            if (b.SurrenderCheck(a, b))
            {
                winner    = a;
                loser     = b;
                surrender = true;
            }
            if (a.Disabled(a.head) || a.Disabled(a.torso))
            {
                winner = b;
                loser  = a;
            }
            if (b.Disabled(b.head) || b.Disabled(b.torso))
            {
                loser  = b;
                winner = a;
            }
        }
        if (a.Owner.player || b.Owner.player)
        {
            Write.KeyPress(0, 26);
        }
        Recap(winner, loser);
        winner    = null;
        loser     = null;
        surrender = false;
    }