/// <summary> /// Deals damage to a monster. /// If the monster were to die, see if combat is finished, otherwise reset most of the UI /// to as if it were the start of the player's turn, and then determine the next turn. /// </summary> /// <param name="a"> Attack to be executed </param> /// <param name="m"> Monster to be attacked </param> /// <returns> /// Yields to allow animations to play out when a monster is being attacked or taking damage /// Need to split this up into a cleanup phase function /// </returns> public IEnumerator ExecutePMAttack(Attack a, Monster m) { eventDescription.SetText(a.nameKey); actionsPanel.SetAllActionsUninteractable(); partyPanel.DisableButtons(); DisableAllMonsterSelection(); DeselectMonsters(); yield return(new WaitForSeconds(0.25f)); yield return(StartCoroutine(activePartyMember.PayAttackCost(a.costType, a.cost))); yield return(StartCoroutine(m.LoseHP(a.damage, a.animationClipName))); if (m.CheckDeath()) // need to clean this up { cq.RemoveCharacter(m.ID); monsters.Remove(m); DeselectMonsters(); yield return(StartCoroutine(m.Die())); } eventDescription.ClearText(); EndPMTurn(); }