Ejemplo n.º 1
0
        public string CharacterTurnAttack()
        {
            if (ListCharacters.Count <= 0) //check to see if there even is characters
            {
                EndGame();
                Debug.WriteLine("Characters are dead");
                return("EndGame");
            }
            else if (ListMonsters.Count <= 0)
            {
                ResetTurns();

                // turncheckCharacter = numbercharacterdead; //will make current turn be number of characters alive ex: if 3 died add 3 to turn so have to wait if 6 till all mosnters go
                //reset turns for all , character amount still same
                return("refresh");
            }

            if (TurnCharacter == null)
            {
                TurnCharacter = ListCharacters[0];
            }
            if (TurnMonster == null)
            {
                TurnMonster = ListMonsters[0];
            }

            CharacterAttacks(TurnCharacter, TurnMonster);
            EndTurn();


            if (TurnMonster.IsLiving())
            {
                CharacterMessageOutput(TurnCharacter.Name + " attacks " + TurnMonster.Name + CharacterAttack + " HP Remaining: " + TurnMonster.CurrentHealth);
                return("");
            }
            else
            {
                MonsterMessageOutput(TurnCharacter.Name + " attacks " + TurnMonster.Name + CharacterAttack + " Monster Died");
                var data = TurnMonster.DropItems();
                _viewModel.Pool.Add(data);
                _viewModel.battleInstance.score.ItemsDroppedList   += data.ItemDetailString();
                _viewModel.battleInstance.score.MonstersKilledList += TurnMonster.MonsterDetailString();
                //make this a quick function
                _viewModel.DatasetMonster.Remove(TurnMonster); //kill monster
                ListMonsters.Remove(TurnMonster);
                turncheckMonster += 1;                         //adds a count to monsters turn currently so its closer to 6 turns
                numberMonsterDead = numberMonsterDead + 1;     //if monster dead add to monsterdead, will count
                TurnMonster       = null;



                if (ListMonsters.Count == 0)
                {
                    ResetTurns();

                    return("refresh");
                }
                //reloadEntities();
                return("reload");
            }
        }
Ejemplo n.º 2
0
        public void CharacterTurnAttackAuto()
        {
            if (ListCharacters.Count <= 0 || ListMonsters.Count <= 0)
            {
                if (ListCharacters.Count <= 0) //check to see if there even is characters
                {
                    EndGame();
                    Debug.WriteLine("Characters are dead");
                }
                else if (ListMonsters.Count <= 0)
                {
                    ResetTurns();
                    Template_NewRound();                  //resets turns, monsters, turn loader
                    Debug.WriteLine("turn reset ln 380"); //should not be called in auto
                }
            }
            else if (ListCharacters.Count != 0 && ListMonsters.Count != 0)
            {
                if (TurnCharacter == null)
                {
                    TurnCharacter = ListCharacters[0];
                }
                if (TurnMonster == null)
                {
                    TurnMonster = ListMonsters[0];
                }

                CharacterAttacks(TurnCharacter, TurnMonster);
                EndTurn();


                if (TurnMonster.IsLiving())
                {
                    CharacterMessageOutput(TurnCharacter.Name + " attacks " + TurnMonster.Name + CharacterAttack + " HP Remaining: " + TurnMonster.CurrentHealth);
                }
                else
                {
                    CharacterMessageOutput(TurnCharacter.Name + " attacks " + TurnMonster.Name + CharacterAttack + " Monster Died");

                    //_viewModel.Pool.Add(TurnMonster.DropItems());
                    //make this a quick function
                    //ListMonsters.Remove(TurnMonster);
                    for (int i = 0; i < monsterq.Count; i++)
                    {
                        var checker = monsterq.Peek();
                        if (checker.IsDead())
                        {
                            monsterq.Dequeue();
                        }
                        else
                        {
                            monsterq.Enqueue(monsterq.Dequeue());
                        }
                    }
                    var data = TurnMonster.DropItems();
                    _viewModel.Pool.Add(data);
                    _viewModel.battleInstance.score.ItemsDroppedList   += data.ItemDetailString();
                    _viewModel.battleInstance.score.MonstersKilledList += TurnMonster.MonsterDetailString();
                    _viewModel.DatasetMonster.Remove(TurnMonster);     //kill monster
                    turncheckMonster         += 1;                     //adds a count to monsters turn currently so its closer to 6 turns
                    numberMonsterDead         = numberMonsterDead + 1; //if monster dead add to monsterdead, will count
                    TurnMonster               = null;
                    score.MonsterSlainNumber += 1;

                    if (ListMonsters.Count == 0)
                    {
                        ResetTurns();

                        Template_NewRound();//resets turns, monsters, turn loader
                    }
                }
            }
        }