예제 #1
0
        public void SetAvatars(Avatar playerAvatar, Avatar enemyAvatar)
        {
            levelUp = false;
            long expGained = 0;

            this.player = playerAvatar;
            this.enemy  = enemyAvatar;

            if (playerAvatar.Alive)
            {
                expGained      = playerAvatar.WinBattle(enemyAvatar);
                battleState[0] = playerAvatar.Name + " has won the battle!";
                battleState[1] = playerAvatar.Name + " has gained " + expGained + " experience";
                if (playerAvatar.CheckLevelUp())
                {
                    battleState[1] += " and gained a level!";
                    foreach (string s in playerAvatar.KnownMoves.Keys)
                    {
                        if (playerAvatar.KnownMoves[s].Unlocked == false && playerAvatar.Level >=
                            playerAvatar.KnownMoves[s].UnlockedAt)
                        {
                            playerAvatar.KnownMoves[s].Unlock();
                            battleState[1] += " " + s + " was unlocked!";
                        }
                    }
                    levelUp = true;
                }
                else
                {
                    battleState[1] += ".";
                }
            }
            else
            {
                expGained      = playerAvatar.LoseBattle(enemyAvatar);
                battleState[0] = playerAvatar.Name + " has lost the battle.";
                battleState[1] = playerAvatar.Name + " has gained " + expGained + " experience";
                if (playerAvatar.CheckLevelUp())
                {
                    battleState[1] += " and gained a level!";
                    foreach (string s in playerAvatar.KnownMoves.Keys)
                    {
                        if (playerAvatar.KnownMoves[s].Unlocked == false && playerAvatar.Level >=
                            playerAvatar.KnownMoves[s].UnlockedAt)
                        {
                            playerAvatar.KnownMoves[s].Unlock();
                            battleState[1] += " " + s + " was unlocked!";
                        }
                    }
                    levelUp = true;
                }
                else
                {
                    battleState[1] += ".";
                }
            }
        }