コード例 #1
0
 public Combat_Shelved(Character player, Character npc, ControlStatus cs)
 {
     _player = player;
     _npc    = npc;
     //TODO: This is ghetto
     Cs = cs;
 }
コード例 #2
0
        public Combat_Shelved(Character[] participants, ControlStatus cs)
        {
            if (participants.Length == 2)
            {
                _player = participants[0];
                _npc    = participants[1];
                //TODO: This is ghetto
                Cs = cs;
            }

            else
            {
                throw new ArgumentOutOfRangeException("Combat must have exactly 2 participants.");
            }

            PlayerTurn = u.RollInitiative(_player, _npc);

            // Placeholder for combat rounds
            while (_continue)
            {
                if (PlayerTurn)
                {
                    // Wait for input...
                    PlayerTurn = false;
                }

                else
                {
                    switch (Npc.Humour)
                    {
                    case "angry":
                        if (r.Next(0, 2) == 0)
                        {
                            _player = PrimaryAttack(Npc, Player);
                        }

                        else
                        {
                            _player = SecondaryAttack(Npc, Player);
                        }

                        break;

                    case "rampaging":
                        if (r.Next(0, 2) == 0)
                        {
                            _player = PrimaryAttack(Npc, Player, true);
                        }

                        else
                        {
                            _player = SecondaryAttack(Npc, Player, true);
                        }

                        break;
                    }

                    PlayerTurn = true;
                }

                if (Player.CurrentHealth <= 0)
                {
                    a.Message = "Player " + Player.Name + " has been killed!";
                    _continue = false;
                }

                else if (Npc.CurrentHealth <= 0)
                {
                    a.Message = Npc.Name + " has been slain!";
                    _continue = false;
                }

                _roundCount++;
            }
        }