Esempio n. 1
0
    public float EffectivenessAgainst(DeltemonClass delt)
    {
        MajorClass m1 = delt.deltdex.major1;
        MajorClass m2 = delt.deltdex.major2;

        return(EffectivenessValue(GetEffectivenessAgainst(m1, m2)));
    }
Esempio n. 2
0
 public UseMoveAction(BattleState state, MoveClass move)
 {
     State         = state;
     Move          = move;
     AttackingDelt = IsPlayer ? state.PlayerState.DeltInBattle : state.OpponentState.DeltInBattle;
     DefendingDelt = IsPlayer ? state.OpponentState.DeltInBattle : state.PlayerState.DeltInBattle;
 }
Esempio n. 3
0
        // Animate Health bar decreasing
        public IEnumerator AnimateHurtDelt(bool isPlayer)
        {
            DeltemonClass defender  = isPlayer ? State.PlayerState.DeltInBattle : State.OpponentState.DeltInBattle;
            Slider        healthBar = isPlayer ? BattleManager.Inst.BattleUI.PlayerHealthBar : BattleManager.Inst.BattleUI.OppHealthBar;

            if (defender.health < 1)
            {
                defender.health = 0;
            }

            float health    = defender.health;
            float damage    = healthBar.value - health;
            float increment = health <= 0 ? damage / 30 : damage / 50; // If delt is DA'd, increment faster

            // Animate health decrease
            while (healthBar.value > health)
            {
                healthBar.value -= increment;

                BattleManager.Inst.BattleUI.UpdateHealthBarColor(isPlayer, defender);

                string healthText = GameManager.Inst.pork ? (int)healthBar.value + "/PORK" : (int)healthBar.value + "/" + (int)defender.GPA;
                BattleManager.Inst.BattleUI.UpdateHealthBarText(healthText);

                // Animation delay
                yield return(new WaitForSeconds(0.01f));

                // Set proper value at end of animation
                if (healthBar.value < health)
                {
                    healthBar.value = health;
                }
                yield return(null);
            }
        }
Esempio n. 4
0
        // Use this for initialization
        void Start()
        {
            animateMessage     = true;
            messageOver        = false;
            isMessageToDisplay = false;
            endMessage         = false;
            inBattle           = false;
            queueHead          = new UIQueueItem();
            activeDelt         = null;
            activeItem         = null;
            secondMoveLoaded   = -1;

            currentUI = UIMode.World;

            // Set All UI except Movement as inactive
            MessageUI.gameObject.SetActive(false);
            BattleUI.gameObject.SetActive(false);
            BagMenuUI.gameObject.SetActive(false);
            ItemsUI.gameObject.SetActive(false);
            PosseUI.gameObject.SetActive(false);
            DeltDexUI.gameObject.SetActive(false);
            fade.gameObject.SetActive(false);
            SettingsUI.SetActive(false);

            StartCoroutine(messageWorker());
        }
Esempio n. 5
0
    public float GetMoveDamage(DeltemonClass attackingDelt, DeltemonClass defendingDelt, BattleState state, bool isPlayerAttacking)
    {
        float levelDamage    = (((2 * (float)attackingDelt.level) + 10)) / 250;
        float atkDefModifier = 1;
        float otherMods      = 1;

        // Determine damage based on attacker and defender stats
        if (movType == moveType.PowerAtk)
        {
            atkDefModifier = (attackingDelt.Power + state.GetStatAddition(isPlayerAttacking, DeltStat.Power)) /
                             (defendingDelt.Courage + state.GetStatAddition(!isPlayerAttacking, DeltStat.Courage));
        }
        else // is moveType.TruthAtk
        {
            atkDefModifier = (attackingDelt.Truth + state.GetStatAddition(isPlayerAttacking, DeltStat.Truth)) /
                             (defendingDelt.Faith + state.GetStatAddition(!isPlayerAttacking, DeltStat.Faith));
        }

        // Extra damage if move is same major as Delt
        if (majorType == attackingDelt.deltdex.major1 || majorType == attackingDelt.deltdex.major2)
        {
            otherMods = 1.5f;
        }

        float rawDamage = ((levelDamage * atkDefModifier * damage) + 2) * otherMods;

        return(rawDamage * EffectivenessAgainst(defendingDelt));
    }
Esempio n. 6
0
        // Add new delt to party/bank, and deltdex if needed
        public void AddDelt(DeltemonClass newDelt)
        {
            // Add to deltdex if it is not present
            AddDeltDex(newDelt.deltdex);

            // Add to party/bank if party is full
            if (deltPosse.Count >= 6)
            {
                // Convert Delt to data and heal
                DeltemonData houseDelt = convertDeltToData(newDelt);
                houseDelt.health = houseDelt.stats[0];
                houseDelt.status = statusType.None;

                houseDelts.Add(houseDelt);
                SortHouseDelts();
            }
            else
            {
                DeltemonClass playerNewDelt = Instantiate(newDelt, this.transform);

                // Instantiate new Delt's moves so prefabs don't get altered
                foreach (MoveClass move in playerNewDelt.moveset)
                {
                    Instantiate(move, playerNewDelt.transform);
                }

                deltPosse.Add(playerNewDelt);
            }
        }
Esempio n. 7
0
        // Delt Give Item click
        public void GiveDeltItemButtonPress()
        {
            // Remove move overviews if are up
            if (CloseMoveOverviews())
            {
                return;
            }

            // Make Delt white again (in case switch was pressed)
            root.transform.GetChild(overviewDeltIndex + 1).gameObject.GetComponent <Image>().color = Color.white;

            // Set active Delt
            activeDelt = GameManager.Inst.deltPosse[overviewDeltIndex];

            // If delt has item remove it
            if (activeDelt.item != null)
            {
                GameManager.Inst.AddItem(activeDelt.item);
                root.transform.GetChild(overviewDeltIndex + 1).transform.GetChild(4).GetComponent <Image>().sprite = noStatus;
                activeDelt.item = null;
            }

            // If item was already selected for giving
            // Note: Selected item must be holdable, megaevolve, usable, or move
            if (UIManager.Inst.ItemsUI.activeItem != null)
            {
                UIManager.Inst.ItemsUI.UseItem();
            }
            else
            {
                StartCoroutine(AnimateUIClose());
                UIManager.Inst.ItemsUI.Open();
            }
        }
Esempio n. 8
0
        public void SelectLoadFile(PlayerData load)
        {
            deltPosse.Clear();

            for (byte i = 0; i < load.partySize; i++)
            {
                deltPosse.Add(convertDataToDelt(load.deltPosse[i], this.transform));
            }

            currentStartingDelt = deltPosse[0];
            UIManager.SwitchLocationAndScene(Mathf.Floor(load.xLoc), Mathf.Floor(load.yLoc), load.sceneName);
            coins        = load.coins;
            playerName   = load.playerName;
            lastTownName = load.lastTownName;
            timePlayed   = load.timePlayed;
            battlesWon   = load.battlesWon;

            // Load player settings
            curSceneName          = load.sceneName;
            pork                  = load.pork;
            UIManager.scrollSpeed = load.scrollSpeed;
            PlayerMovement.Inst.ChangeGender(load.isMale);
            PlayerMovement.Inst.hasDormkicks      = load.allItems.Exists(id => id.itemName == "DormKicks");
            MusicManager.Inst.maxVolume           = load.musicVolume;
            MusicManager.Inst.audiosource.volume  = load.musicVolume;
            SoundEffectManager.Inst.source.volume = load.FXVolume;

            // Load lists back
            allItems          = new List <ItemData>(load.allItems);
            houseDelts        = new List <DeltemonData>(load.houseDelts);
            deltDex           = new List <DeltDexData>(load.deltDex);
            sceneInteractions = new List <SceneInteractionData>(load.sceneInteractions);
        }
Esempio n. 9
0
        void TryLearnNewMove(DeltemonClass delt)
        {
            // If Delt can learn a new move
            LevelUpMove newMove = delt.deltdex.levelUpMoves.Find(lum => lum.level == delt.level);

            if (newMove == null)
            {
                return;
            }

            // If the player doesn't have a full moveset yet
            if (delt.moveset.Count < 4)
            {
                // Instantiate and learn new move
                MoveClass move = BattleManager.Inst.InstantiateMove(newMove.move, delt.transform);
                delt.moveset.Add(move);

                BattleManager.AddToBattleQueue(string.Format("{0} has learned the move {1}!", delt.nickname, newMove.move.moveName));
            }
            // Player must choose to either switch a move or not learn new move
            else
            {
                BattleManager.Inst.BattleUI.PresentNewMoveUI(delt);
                BattleManager.AddToBattleQueue(string.Format("{0} can learn the move {1}!", delt.nickname, newMove.move.moveName));

                // Load new move into move overview
                // Note: This temporarily sets move as 5th move in Delt moveset
                UIManager.Inst.PosseUI.SetLevelUpMove(newMove.move, delt);

                // REFACTOR_TODO: Goal: Use 0 wait until/wait while/etc in this game
                //yield return new WaitUntil(() => finishNewMove);

                //finishNewMove = false;
            }
        }
Esempio n. 10
0
        // REFACTOR_TODO: This function should not be doing this much work
        // Animate Health bar increasing
        public IEnumerator AnimateHealDelt(bool isPlayer)
        {
            DeltemonClass delt      = isPlayer ? State.PlayerState.DeltInBattle : State.OpponentState.DeltInBattle;
            Slider        healthBar = isPlayer ? BattleManager.Inst.BattleUI.PlayerHealthBar : BattleManager.Inst.BattleUI.OppHealthBar;

            float health    = delt.health;
            float heal      = health - healthBar.value;                   // Amount needed to heal
            float increment = health == delt.GPA ? heal / 30 : heal / 50; // If was a full heal, increment faster

            // Animate health decrease
            while (healthBar.value < health)
            {
                healthBar.value += increment;

                BattleManager.Inst.BattleUI.UpdateHealthBarColor(isPlayer, delt);

                // Update player health text
                if (isPlayer)
                {
                    string healthBarText = GameManager.Inst.pork ? (int)healthBar.value + "/PORK" : (int)healthBar.value + "/" + (int)delt.GPA;
                    BattleManager.Inst.BattleUI.UpdateHealthBarText(healthBarText);
                }

                // Animation delay
                yield return(new WaitForSeconds(0.01f));

                // So animation doesn't take infinite time
                if (healthBar.value > health)
                {
                    healthBar.value = health;
                }
                yield return(null);
            }
        }
Esempio n. 11
0
        // Initialize variables
        void Start()
        {
            UIMan            = UIManager.Inst;
            GameMan          = GameManager.Inst;
            hasHealed        = false;
            posseDeltsLoaded = false;
            majorSelected    = false;
            hasTriggered     = false;
            HouseSwitchIn    = null;
            HouseDeltIndex   = -1;
            PosseDeltIndex   = -1;
            houseMove        = -1;
            posseMove        = -1;
            majorQuery       = new List <MajorClass>();
            queryResults     = new List <DeltemonData>();

            itemQuery  = false;
            levelQuery = 1;
            nameQuery  = "";
            pinQuery   = 1;

            // Set door to go to back to last town
            DoorAction           shopDoor  = this.transform.GetChild(0).GetComponent <DoorAction>();
            TownRecoveryLocation townRecov = GameMan.FindTownRecov();

            shopDoor.xCoordinate = townRecov.RecovX;
            shopDoor.yCoordinate = townRecov.RecovY;
            shopDoor.sceneName   = townRecov.townName;
        }
Esempio n. 12
0
        // User clicks Swap Item
        public void RemoveDeltItemButtonPress()
        {
            DeltemonClass overviewDelt = GameManager.Inst.deltPosse[overviewDeltIndex];
            ItemClass     removedItem  = overviewDelt.item;

            overviewDelt.item = null;
            GameManager.Inst.AddItem(removedItem, 1, false);
        }
Esempio n. 13
0
        IEnumerator CheckAttackingDeltStatus(PlayerBattleState player, bool isPlayer)
        {
            DeltemonClass  attacker = player.DeltInBattle;
            BattleAnimator animator = BattleManager.Inst.Animator;

            if (!AttackingStatusEffects.Contains(attacker.curStatus))
            {
                yield break;
            }

            StatusAffectData statusData = GetAttackingStatusEffect(attacker.curStatus);

            BattleManager.AddToBattleQueue(
                message: attacker.nickname + statusData.StatusActiveText,
                enumerator: animator.DeltAnimation(statusData.AnimationAndSoundKey, isPlayer)
                );

            if (attacker.curStatus != statusType.Drunk)
            {
                // If Delt comes down
                if (Random.Range(0, 100) <= statusData.ChanceToRemove)
                {
                    BattleManager.AddToBattleQueue(attacker.nickname + statusData.StatusRemovalText);
                    BattleManager.Inst.StatusChange(isPlayer, statusType.None);
                }
                else
                {
                    BattleManager.AddToBattleQueue(attacker.nickname + statusData.StatusContinueText);
                }
            }
            else
            {
                // If Delt hurts himself
                if (Random.Range(0, 100) <= 30)
                {
                    attacker.health = attacker.health - (attacker.GPA * 0.05f);
                    BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("Hurt", isPlayer));
                    BattleManager.AddToBattleQueue(attacker.nickname + " hurt itself in it's drunkeness!");

                    // REFACTOR_TODO: Find proper location for this
                    //yield return BattleManager.Inst.StartCoroutine(BattleManager.Inst.Animator.AnimateHurtDelt(isPlayer));

                    // Player DA's // REFACTOR_TODO: This should be in the hurt function
                    if (attacker.health <= 0)
                    {
                        attacker.health = 0;
                        BattleManager.AddToBattleQueue(attacker.nickname + " has DA'd for being too Drunk!");
                        BattleManager.Inst.StatusChange(isPlayer, statusType.DA);
                    }
                }
                // Attacker relieved from Drunk status
                else if (Random.Range(0, 100) <= 27)
                {
                    BattleManager.AddToBattleQueue(attacker.nickname + " has sobered up!");
                    BattleManager.Inst.StatusChange(isPlayer, statusType.None);
                }
            }
        }
Esempio n. 14
0
        // Prepare MoveOneOverview with new move info
        public void SetLevelUpMove(MoveClass newMove, DeltemonClass curPlayerDelt)
        {
            overviewDeltIndex = GameManager.Inst.deltPosse.IndexOf(curPlayerDelt);

            // Temporarily add new move as 5th move
            curPlayerDelt.moveset.Add(newMove);

            MoveClick(4);
        }
Esempio n. 15
0
        // Calculates and message prompts user with coins won from wild battle
        public override int GetCoinsWon()
        {
            DeltemonClass wildDelt   = State.OpponentState.DeltInBattle;
            float         multiplier = GetDeltRarityCoinMultiplier(wildDelt.deltdex.rarity);
            int           coinsWon   = Mathf.Max((int)(multiplier * wildDelt.level), 1);

            BattleManager.AddToBattleQueue(GetCoinRewardFlavorText(coinsWon, GameManager.Inst.playerName, wildDelt.deltdex.nickname));

            return(coinsWon);
        }
Esempio n. 16
0
 public void StartWildBattle(DeltemonClass wildDelt)
 {
     playerMovement.StopMoving();
     StartMessage(null, fade.fadeOutToBlack());
     StartMessage(null, null, () => BattleUI.SetActiveIfChanged(true));
     StartMessage(null, null, () => BattleManager.Inst.StartWildBattle(wildDelt));
     StartMessage(null, fade.fadeInSceneChange(), null);
     currentUI = UIMode.Battle;
     inBattle  = true;
 }
Esempio n. 17
0
        // Test to see if, when Delts are given certain items, something happens
        public bool DeltItemQuests(DeltemonClass delt)
        {
            if ((delt.deltdex.deltName == "Ammas Tanveer") && (delt.item.itemName == "Peanut Butter"))
            {
                // GREAT PAUSE
                return(true);
            }

            return(false);
        }
Esempio n. 18
0
        public void UpdateHealthBarColor(bool isPlayer, DeltemonClass delt)
        {
            Image healthBarBackground = isPlayer ? PlayerDeltInfo.HealthBarImage : OpponentDeltInfo.HealthBarImage;
            Color healthBarColor      = GetHealthBarColor(delt.health / delt.GPA);

            if (healthBarBackground.color != healthBarColor)
            {
                healthBarBackground.color = healthBarColor;
            }
        }
Esempio n. 19
0
        float GetXPEarned(DeltemonClass oppDelt)
        {
            float totalXPGained = 1.5f * (1550 - State.OpponentState.DeltInBattle.deltdex.pinNumber);

            totalXPGained *= oppDelt.level;
            totalXPGained *= 0.0714f; // REFACTOR_TODO: Make magic number a const or have more reasonable logic here
            totalXPGained *= State.IsTrainer ? 1.5f : 1;

            return(totalXPGained);
        }
Esempio n. 20
0
        float GetXPFillIncrement(float totalXPGained, DeltemonClass playerDelt)
        {
            float increment      = totalXPGained * 0.02f;
            float expLeftToLevel = playerDelt.XPToLevel - playerDelt.experience;

            if (totalXPGained > expLeftToLevel)
            {
                increment = expLeftToLevel * 0.05f;
            }
            return(increment);
        }
Esempio n. 21
0
        void CheckPostMoveItemEffects(PlayerBattleState player, bool isPlayer)
        {
            DeltemonClass delt = player.DeltInBattle;

            if (delt.item != null && delt.item.statUpgrades[0] > 0)
            {
                BattleManager.AddToBattleQueue(delt.nickname + " used it's " + delt.item.itemName + "...");
                // REFACTOR_TODO: Heal function
                //BattleManager.Inst.StartCoroutine(BattleManager.Inst.AnimateHealDelt(true));
            }
        }
Esempio n. 22
0
 public void PresentNewMoveUI(DeltemonClass playerDelt)
 {
     for (int i = 0; i < 4; i++)
     {
         MoveClass tmp    = playerDelt.moveset[i];
         Transform button = NewMoveUI.transform.GetChild(i);
         button.GetComponent <Image>().color           = tmp.majorType.background;
         button.GetChild(0).GetComponent <Text>().text = (tmp.moveName + System.Environment.NewLine + "PP: " + tmp.PP);
     }
     NewMoveUI.SetActive(true);
 }
Esempio n. 23
0
        // Close deltemon UI
        public void CloseDeltemon()
        {
            // Remove move overviews if are up
            if (CloseMoveOverviews())
            {
                return;
            }

            StartCoroutine(AnimateUIClose());
            activeDelt = null;
            UIManager.Inst.ItemsUI.activeItem = null;
        }
Esempio n. 24
0
        // Load delt into one of 6 UI stat cubes on left hand side of screen
        void loadDeltIntoUI(DeltemonClass delt, Transform statCube)
        {
            if (GameManager.Inst.pork)
            {
                statCube.transform.GetChild(1).GetComponent <Text>().text    = delt.nickname + " Pork, " + delt.level;
                statCube.transform.GetChild(2).GetComponent <Image>().sprite = PorkManager.Inst.PorkSprite;
            }
            else
            {
                statCube.transform.GetChild(1).GetComponent <Text>().text    = delt.nickname + ", " + delt.level;
                statCube.transform.GetChild(2).GetComponent <Image>().sprite = delt.deltdex.frontImage;
            }
            // Add item sprite to the info box
            if (delt.item != null)
            {
                statCube.transform.GetChild(4).GetComponent <Image>().sprite = delt.item.itemImage;
            }
            else
            {
                statCube.transform.GetChild(4).GetComponent <Image>().sprite = noStatus;
            }
            // XP Bar and Health Set
            Slider XP     = statCube.GetChild(5).GetComponent <Slider>();
            Slider health = statCube.GetChild(6).GetComponent <Slider>();

            XP.maxValue     = delt.XPToLevel;
            XP.value        = delt.experience;
            health.maxValue = delt.GPA;
            health.value    = delt.health;

            if (delt.health < (delt.GPA * 0.25))
            {
                health.transform.GetChild(1).GetChild(0).GetComponent <Image>().color = BattleManager.Inst.BattleUI.quarterHealth;
            }
            else if (delt.health < (delt.GPA * 0.5))
            {
                health.transform.GetChild(1).GetChild(0).GetComponent <Image>().color = BattleManager.Inst.BattleUI.halfHealth;
            }
            else
            {
                health.transform.GetChild(1).GetChild(0).GetComponent <Image>().color = BattleManager.Inst.BattleUI.fullHealth;
            }
            // Add status sprite to the info box
            if (delt.curStatus != statusType.None)
            {
                statCube.GetChild(3).GetComponent <Image>().sprite = delt.statusImage;
            }
            else
            {
                statCube.GetChild(3).GetComponent <Image>().sprite = noStatus;
            }
            statCube.gameObject.SetActiveIfChanged(true);
        }
Esempio n. 25
0
        // Close items
        public override void Close()
        {
            activeItem = null;

            if (activeDelt != null)
            {
                activeDelt = null;
                UIManager.Inst.PosseUI.Open(false);
                UIManager.Inst.PosseUI.loadDeltIntoPlayerOverview(UIManager.Inst.PosseUI.overviewDeltIndex);
            }

            base.Close();
        }
Esempio n. 26
0
        void InitialSwitchIn(bool isPlayer)
        {
            PlayerBattleState playerState  = State.GetPlayerState(isPlayer);
            DeltemonClass     startingDelt = State.PlayerState.Delts.Find(delt => delt.curStatus != statusType.DA);

            playerState.ResetStatAdditions();
            playerState.DeltInBattle = startingDelt;
            BattleManager.Inst.BattleUI.PopulateBattlingDeltInfo(isPlayer, startingDelt);
            BattleManager.AddToBattleQueue(
                action: () => BattleManager.Inst.BattleUI.SetDeltImageActive(isPlayer),
                enumerator: BattleManager.Inst.Animator.DeltSlideIn(isPlayer)
                );
        }
Esempio n. 27
0
        public void PresentEvolveUI(DeltemonClass evolvingDelt, DeltDexClass nextEvol)
        {
            Image prevEvolImage = EvolveUI.transform.GetChild(1).GetComponent <Image>();
            Image nextEvolImage = EvolveUI.transform.GetChild(2).GetComponent <Image>();

            // Set images for evolution animation
            prevEvolImage.sprite = evolvingDelt.deltdex.frontImage;
            nextEvolImage.sprite = nextEvol.frontImage;
            EvolveUI.SetActive(true);

            // Set battle image to new image
            PlayerDeltInfo.Image.sprite = evolvingDelt.deltdex.backImage;
        }
Esempio n. 28
0
 public void TrySwitchDelt(DeltemonClass switchIn)
 {
     BattleManager.Inst.BattleUI.HideMoveOptions();
     if (switchIn.curStatus != statusType.DA)
     {
         RegisterPlayerAction(new SwitchDeltAction(State, switchIn));
     }
     else
     {
         // REFACTOR_TODO: Message that the Delt is DA'd
         BattleManager.Inst.BattleUI.PresentPlayerOptions();
     }
 }
Esempio n. 29
0
        void EvolveDelt()
        {
            DeltemonClass evolvingDelt = State.PlayerState.DeltInBattle;
            DeltDexClass  nextEvol     = evolvingDelt.GetNextEvolution();

            // Open Evolve UI
            BattleManager.AddToBattleQueue(action: () => BattleManager.Inst.BattleUI.PresentEvolveUI(evolvingDelt, nextEvol));

            // Text for before evolution animation
            if (GameManager.Inst.pork)
            {
                BattleManager.AddToBattleQueue("WHAT IS PORKKENING?!?");
                BattleManager.AddToBattleQueue("TIME TO BECOME A HONKING BOAR!");
            }
            else
            {
                // REFACTOR_TODO: Get some random text variation in here
                // REFACTOR_TODO: Make a random text generator that takes a text ID and returns a string or string[]
                BattleManager.AddToBattleQueue("Yo...");
                BattleManager.AddToBattleQueue("What's happening?");
            }

            // Start evolution animation, wait to end
            // REFACTOR_TODO: This animation had a ending trigger as well: is that needed?
            BattleManager.AddToBattleQueue(enumerator: BattleManager.Inst.Animator.DeltAnimation("Evolve", true)); // 6.5 seconds

            // Text for after evolution animation
            if (GameManager.Inst.pork)
            {
                BattleManager.AddToBattleQueue("A NEW PORKER IS BORN!");
                BattleManager.AddToBattleQueue("A gush of pink bacon-smelling amneotic fluid from the evolution stains the ground.");
                BattleManager.AddToBattleQueue("I wish this could have happened somewhere more private.");
            }
            else
            {
                BattleManager.AddToBattleQueue(evolvingDelt.nickname + " has evolved into " + nextEvol.nickname + "!");
            }

            // If Delt's name is not custom nicknamed by the player, make it the evolution's nickname
            if (evolvingDelt.nickname == evolvingDelt.deltdex.nickname)
            {
                evolvingDelt.nickname = nextEvol.nickname;
            }

            // Set the deltdex to the evolution's deltdex
            // Note: This is how the Delt stays evolved
            evolvingDelt.deltdex = nextEvol;

            // Add dex to deltDex if not there already
            GameManager.Inst.AddDeltDex(evolvingDelt.deltdex);
        }
Esempio n. 30
0
        // Check loss condition, select new Delt if still playing
        void checkLoss(bool isPlayer)
        {
            BattleManager.Inst.BattleUI.UpdateTrainerPosseBalls();

            PlayerBattleState playerState = State.GetPlayerState(isPlayer);

            if (playerState.HasLost())
            {
                // Loss condition
                if (isPlayer)
                {
                    BattleManager.Inst.PlayerWinBattle();
                }
                else
                {
                    BattleManager.Inst.PlayerLoseBattle();
                }
            }
            else if (isPlayer)
            {
                // Player must choose available Delt for switch in
                BattleManager.AddToBattleQueue(
                    State.GetPlayerName(isPlayer) + " must choose another Delt!",
                    () => UIManager.Inst.PosseUI.Open()
                    ); // REFACTOR_TODO: Should this call happen here?
            }
            else
            {
                // AI chooses switch in
                int           score    = -1000;
                DeltemonClass switchIn = ((TrainerAI)State.OpponentAI).FindSwitchIn(out score);

                if (switchIn != null)
                {
                    new SwitchDeltAction(State, switchIn).ExecuteAction();
                }
                else
                {
                    BattleManager.Inst.PlayerWinBattle();
                }
            }

            if (!isPlayer) // IE. Opponent's Delt has DA'd
            {
                AwardAVsToPlayerDelt();
                AwardXP();

                // REFACTOR_TODO: Return defeated wild delts to wild pool
                // REFACTOR_TODO: Do I need to do this once DeltemonClass is no longer a Monobehavior?
            }
        }