Example #1
0
        public void RunBattle(CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController)
        {
            _heroes = new HeroParty(this, _ai, NumberOfHeroPartyMembers);
            _monsters = new MonsterParty(this, _ai, NumberOfMonsterPartyMembers);

            Character userControlledCharacter = _heroes[userControlledCharacterType];
            userControlledCharacter.Initialize(this, playerController, userControlledCharacterName);

            int currentTurn = 1;
            do
            {
                DisplayMessage($"\n\tTurn {currentTurn} is about to start:", true);
                foreach (Monster monster in _monsters.Characters)
                {
                    monster.CurrentMana += 10;
                }
                foreach (Hero hero in _heroes.Characters)
                {
                    hero.CurrentMana += 10;
                }
                if (LetPartyAct(_heroes))
                    break;

                if (LetPartyAct(_monsters))
                    break;

                currentTurn++;

            } while (!IsGameFinished);

            if (_heroes.IsEverybodyDead())
                DisplayMessage("\n\tOh noes! The monsters won.\n");
            else
                DisplayMessage("\n\tHurray! Your heroes won this battle!\n");
        }
Example #2
0
        public void RunBattle(CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController)
        {
            //Console.WriteLine("How many allies you want?");
            //int allies = int.Parse(Console.ReadLine());
            // Console.WriteLine("How many monsters you want?");
            // monsters = int.Parse(Console.ReadLine());
            _heroes   = new HeroParty(this, _ai);
            _monsters = new MonsterParty(this, _ai);

            Character userControlledCharacter = _heroes[userControlledCharacterType];

            userControlledCharacter.Initialize(this, playerController, userControlledCharacterName);

            int currentTurn = 1;

            do
            {
                DisplayMessage($"\n\tTurn {currentTurn} is about to start:", true);

                if (LetPartyAct(_heroes))
                {
                    break;
                }

                if (LetPartyAct(_monsters))
                {
                    break;
                }

                currentTurn++;
            } while (!IsGameFinished);

            if (_heroes.IsEverybodyDead())
            {
                DisplayMessage("\n\tOh noes! The monsters won.\n");
            }
            else
            {
                DisplayMessage("\n\tHurray! Your heroes won this battle!\n");
            }
        }
        public void RunBattle(CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController, int numberOfHeroes, int numberOfMonsters)
        {
            _heroes   = new HeroParty(this, _ai, numberOfHeroes);
            _monsters = new MonsterParty(this, _ai, numberOfMonsters);

            Character userControlledCharacter = _heroes[userControlledCharacterType];

            userControlledCharacter.Initialize(this, playerController, userControlledCharacterName);

            int currentTurn = 1;

            do
            {
                DisplayMessage($"\n\tTurn {currentTurn} is about to start:", true);

                if (LetPartyAct(_heroes))
                {
                    break;
                }

                if (LetPartyAct(_monsters))
                {
                    break;
                }
                if (PaladinEffect == true)
                {
                    isPaladinEffectFinished();
                }
                currentTurn++;
            } while (!IsGameFinished);

            if (_heroes.IsEverybodyDead())
            {
                DisplayMessage("\n\tOh noes! The monsters won.\n");
            }
            else
            {
                DisplayMessage("\n\tHurray! Your heroes won this battle!\n");
            }
        }
Example #4
0
        public void RunBattle(CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController, int alliesNumber, int monstersNumber)
        {
            _heroes   = new HeroParty(this, _ai, alliesNumber);
            _monsters = new MonsterParty(this, _ai, monstersNumber);

            Character userControlledCharacter = _heroes[userControlledCharacterType];

            userControlledCharacter.Initialize(this, playerController, userControlledCharacterName);

            int currentTurn = 1;

            do
            {
                DisplayMessage($"\n\tTurn {currentTurn} is about to start:", true);

                if (LetPartyAct(_heroes))
                {
                    break;
                }

                if (LetPartyAct(_monsters))
                {
                    break;
                }

                //TODO regenera 10 mana a tutti i personaggi che usano mana e che hanno il current mana < max mana (senza superare il max mana)

                currentTurn++;
            } while (!IsGameFinished);

            if (_heroes.IsEverybodyDead())
            {
                DisplayMessage("\n\tOh noes! The monsters won.\n");
            }
            else
            {
                DisplayMessage("\n\tHurray! Your heroes won this battle!\n");
            }
        }
Example #5
0
        public void RunBattle(CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController, int alliesAmount, int monstersAmount)
        {
            AiController = new Ai();
            Heroes       = new HeroParty(this, userControlledCharacterType, userControlledCharacterName, playerController, alliesAmount, AiController);
            Monsters     = new MonsterParty(this, monstersAmount, AiController);

            Character userControlledCharacter = Heroes[userControlledCharacterType];

            userControlledCharacter.Initialize(this, playerController, userControlledCharacterName);

            int currentTurn = 1;

            do
            {
                DisplayMessage($"\n\tTurn {currentTurn} is about to start:", true);

                if (LetPartyAct(Heroes))
                {
                    break;
                }

                if (LetPartyAct(Monsters))
                {
                    break;
                }

                currentTurn++;
            } while (!IsGameFinished);

            if (Heroes.IsEverybodyDead())
            {
                DisplayMessage("\n\tOh noes! The monsters won.\n");
            }
            else
            {
                DisplayMessage("\n\tHurray! Your heroes won this battle!\n");
            }
        }
        public void RunBattle(CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController, int [] characterAmount)
        {
            _heroes   = new HeroParty(this, _ai, characterAmount[0]);
            _monsters = new MonsterParty(this, _ai, characterAmount[1]);
            Character userControlledCharacter = _heroes[userControlledCharacterType]; //Vista l'implementazione dovevo ridefinire il consolePlayer, in modo tale che il metodo tornasse direttamente l'oggetto del character scelto dall'utente

            //Piuttosto che il charactertype. Oppure riscrivere un altro metodo per gestire l'eccezione che genera nel momento in cui non crea il character.
            userControlledCharacter.Initialize(this, playerController, userControlledCharacterName);

            int currentTurn = 1;

            do
            {
                DisplayMessage($"\n\tTurn {currentTurn} is about to start:", true);

                if (LetPartyAct(_heroes))
                {
                    break;
                }

                if (LetPartyAct(_monsters))
                {
                    break;
                }

                currentTurn++;
            } while (!IsGameFinished);

            if (_heroes.IsEverybodyDead())
            {
                DisplayMessage("\n\tOh noes! The monsters won.\n");
            }
            else
            {
                DisplayMessage("\n\tHurray! Your heroes won this battle!\n");
            }
        }