void ProcessBuffsAndDebuffs() { //Debug.Log("ProcessBuffsAndDebuffs"); //// Wait while all previously triggered actions are complete //while (queueIsActive) //{ // Debug.Log("Queue is active"); // yield return new WaitForSeconds(1f); //} // Set Queue is active flag //queueIsActive = true; // Next actions are applicably only to active or escaping unit if ((ActiveUnitUI.LPartyUnit.UnitStatus == UnitStatus.Active) || (ActiveUnitUI.LPartyUnit.UnitStatus == UnitStatus.Escaping)) { ActiveUnitUI.HighlightActiveUnitInBattle(true); // Trigger buffs and debuffs before applying highlights // Verify if unit has buffs which should be removed, example: defense // ActiveUnitUI.DeactivateExpiredBuffs(); // Verify if unit has debuffs which should be applied, example: poison // Deactivate debuffs which has expired, example: poison duration may last 2 turns // This is checked and done after debuff trigger ActiveUnitUI.TriggerAppliedUniquePowerModifiers(); } //yield return null; }
IEnumerator EndBattle() { Debug.Log("EndBattle"); // set battle has ended BattleHasEnded = true; battleHasEnded.Raise(); // Remove highlight from active unit ActiveUnitUI.HighlightActiveUnitInBattle(false); //// Set exit button variable //BattleExit exitButton = GetBattleExitButton(); //// Activate exit battle button; //exitButton.gameObject.SetActive(true); // Deactivate all other battle buttons; // SetBattleControlsActive(false); // Check who win battle if (!playerPartyPanel.CanFight()) { Debug.Log("Player cannot fight anymore"); // player cannot fight anymore // verify if player has flee from battle if (playerPartyPanel.HasEscapedBattle()) { Debug.Log("Player has escaped battle"); // On exit: move it 2 tiles away from other party exitOption = ExitOption.FleePlayer; } else { Debug.Log("Player lost battle and was destroyed"); // verify if battle was with city Garnizon: // .. this is not needed here because city garnizon cannot initiate fight // On exit: destroy player party exitOption = ExitOption.DestroyPlayer; } // Show how much experience was earned by enemy party enemyPartyPanel.GrantAndShowExperienceGained(playerPartyPanel); } else { Debug.Log("Enemy cannot fight anymore"); // verify if enemy has flee from battle if (enemyPartyPanel.HasEscapedBattle()) { Debug.Log("Enemy has escaped battle"); // On exit: move it 2 tiles away from other party exitOption = ExitOption.FleeEnemy; } else { Debug.Log("Enemy lost battle and was destroyed"); // verify if battle was with city Garnizon: if (enemyPartyPanel.GetHeroParty().PartyMode == PartyMode.Garnizon) { // On exit: enter city Debug.Log("Enter city on exit"); exitOption = ExitOption.EnterCity; } else if (enemyPartyPanel.GetHeroParty().PartyMode == PartyMode.Party) { // On exit: destroy enemy party exitOption = ExitOption.DestroyEnemy; } else { Debug.LogError("Unknown party mode " + enemyPartyPanel.GetHeroParty().PartyMode.ToString()); } } // Show how much experience was earned by player party playerPartyPanel.GrantAndShowExperienceGained(enemyPartyPanel); } // Remove all buffs and debuffs enemyPartyPanel.RemoveAllBuffsAndDebuffs(); playerPartyPanel.RemoveAllBuffsAndDebuffs(); // unblock input InputBlocker.SetActive(false); yield return(null); }