/// <summary> /// Makes a basic attack and adds attack modifiers. /// The familiar follows up with an attack if possible. /// </summary> /// <param name="index"></param> /// <returns></returns> IEnumerator BasicAttack(int index) { selectCanvas.enabled = false; Debug.Log("Dealt damage to the enemy!"); int damage = statsController.damage.value; if (PlayerStatsController.PercentChanceTrigger(statsController.crit.value)) { Debug.Log("CRITICAL HIT"); damage *= 3; } int dealtDamage = enemies.TakePhysicalDamage(index, damage); if (dealtDamage > 0) { float lifestealMult = statsController.lifesteal.value / 100.0f; Debug.Log("Lifesteal multi: " + lifestealMult); int gainedHealth = (int)(lifestealMult * dealtDamage); HealDamage(gainedHealth); } int famIndex = FamiliarAttack(); if (famIndex >= 0) { yield return(new WaitForSeconds(0.5f)); enemies.TakePhysicalDamage(famIndex, familiarDamage.value); } currentBattleState.value++; nextPhaseEvent.Invoke(); currentAttackType = AttackType.NONE; yield break; }