//-----------------------------Skills------------------------------// private void GoToWaitState(fareaSkills skill, int turnsToWait, int waitingIndex) { chosenSkill = skill; waitQTurns = turnsToWait; waitTurnsText.gameObject.SetActive(true); waitTurnsText.text = waitQTurns.ToString(); animator.SetInteger("WaitingIndex", waitingIndex); currentState = EnemyState.waiting; audioManager.PlayThisEffect("faryaWait"); uiBTL.EndTurn(); }
//Called from the animator to check which skill to execute after waiting private void SkillEffect() { switch (chosenSkill) { case fareaSkills.wails: audioManager.PlayThisEffect("Wails"); //Choose at random whether you want to damage attack or defense chosenStat = statToDebuff[Random.Range(0, statToDebuff.Length)]; //Update the UI uiBTL.UpdateActivityText("Wails of Frailty"); //Damage all players for (int i = 0; i < battleManager.players.Length; i++) { if (!battleManager.players[i].playerReference.dead) { battleManager.players[i].playerReference.TakeDamage(eAttack, 1, chosenStat, Player.playerAilments.none, null, 0.3f, 3, true); //Summon debuff object objPooler.SpawnFromPool("WailAttack", battleManager.players[i].playerReference.transform.position, gameObject.transform.rotation); } } wailWait.gameObject.SetActive(false); break; case fareaSkills.lullabyOfDepsair: //Update the UI uiBTL.UpdateActivityText("Lullaby Of Despair"); //Choose a player at random ScareAPlayer(); //If the player has no ailments, then affect thme with fear if (attackThisPlayer.currentAilment == Player.playerAilments.none) //Make sure you target { audioManager.PlayThisEffect("Despair"); attackThisPlayer.TakeDamage(0.0f, 0, "", Player.playerAilments.fear, null, 0, 3, false); } else { //Otherwise just damage the player attackThisPlayer.TakeDamage(eAttack * 1.5f); } lullWait.gameObject.SetActive(false); break; case fareaSkills.mothersPain: audioManager.PlayThisEffect("MothersPain"); for (int i = 0; i < battleManager.players.Length; i++) { if (!battleManager.players[i].playerReference.dead) { battleManager.players[i].playerReference.TakeDamage(0.5f * totalDamageSustained); //Damage the players with half the totalDamageSustained objPooler.SpawnFromPool("MothersPain", mothersPainInitialLoc, gameObject.transform.rotation); } } totalDamageSustained = 0.0f; //Reset the variable mothersPainWait.gameObject.SetActive(false); break; case fareaSkills.youAreNotMine: if (thisPlayerIsDead.dead) { audioManager.PlayThisEffect("YouAreNotMine"); youAreNotMineObject.gameObject.SetActive(false); objPooler.SpawnFromPool("YouAreNotMine", thisPlayerIsDead.transform.position, gameObject.transform.rotation); Heal(thisPlayerIsDead.maxHP * 0.7f); youAreNotMineUsedOnceThisFight = true; //The skill check modifier will not change the next time the Farea drops below max health skillChanceModifier = 1.0f; thisPlayerIsDead = null; } else { youAreNotMineObject.gameObject.SetActive(false); thisPlayerIsDead.TakeDamage(eAttack * 1.5f); } break; } //Reset the skill and the animator chosenSkill = fareaSkills.none; animator.SetInteger("WaitingIndex", 0); uiBTL.EndTurn(); }
public override void TakeDamage(float playerAttack, int numberOfAttacks, int debuffIndex, float debuffValuePercent, int debuffTimer, string debuffSubIndex, EnemyStatusAilment ailment) { if (playerAttack > 0.0f) //Don't need to calcualte damage if the incoming attack is debuff only { //Didn't recall the original function cause the "Hit" animation ends the turn //Debug.Log("Received player attack: " + playerAttack); float damage = playerAttack - ((actualDEF / (20.0f + actualDEF)) * playerAttack); damage *= ralliedDamageModifier; //Increase damage if rallied; currentHP -= damage; damageText.gameObject.SetActive(true); damageText.text = Mathf.RoundToInt(damage).ToString(); battleManager.enemies[enemyIndexInBattleManager].currentHP = currentHP; //Update the BTL manager with the new health HP.fillAmount = currentHP / maxHP; } if (playerAttack >= 0.0f) //if incoming damage is negative, then it was a miss { switch (debuffIndex) { case 0: // Ailment switch (ailment) { case EnemyStatusAilment.chained: break; case EnemyStatusAilment.rallied: if (currentStatusAilment0 != EnemyStatusAilment.rallied && currentStatusAilment1 != EnemyStatusAilment.rallied) //Cannot rally an enemy that's already been rallied against { ralliedWaitTime = debuffTimer; ralliedDamageModifier = 2.0f; ralliedSymbol.gameObject.SetActive(true); uiBTL.EndTurn(); //Rally doesn't do any damage } break; case EnemyStatusAilment.burn: if (currentStatusAilment0 != EnemyStatusAilment.burn && currentStatusAilment1 != EnemyStatusAilment.burn) //Cannot burn an enemy that's already been burned { burnedWaitTime = debuffTimer; burnSymbol.gameObject.SetActive(true); uiBTL.EndTurn(); //Rally doesn't do any damage } break; } //Check which of the two ailments is set to none. // If both of them are filled, overwrite the 0 spot if (currentStatusAilment0 == EnemyStatusAilment.none) { currentStatusAilment0 = ailment; } else if (currentStatusAilment1 == EnemyStatusAilment.none) { currentStatusAilment1 = ailment; } else if (currentStatusAilment0 == EnemyStatusAilment.rallied) { NoLongerRallied(); currentStatusAilment0 = ailment; } break; case 1: //Debuff BuffStats(debuffSubIndex, -debuffValuePercent, debuffTimer); break; } animator.SetBool("Hit", true); if (currentHP < 1.0f) //Avoid near zero { if (bossPhase == 1) { //Reset and get ready for phase 2 animator.SetBool("Phase2", true); currentState = EnemyState.idle; waitTime = 0; waitTurnsText.text = "0"; chosenSkill = fareaSkills.none; lullWait.gameObject.SetActive(false); wailWait.gameObject.SetActive(false); } animator.SetBool("Death", true); } else { if (numberOfAttacks <= 0) { uiBTL.EndTurn(); } } } else { if (missText != null) { missText.gameObject.SetActive(true); } } }
public override void TakeDamage(float playerAttack, int numberOfAttacks) { if (playerAttack > 0.0f) { if (tieThisPlayer != null) { tieThisPlayer.TakeDamage(playerAttack); //Damage the tied player should you get damaged tiedTimer--; if (tiedTimer <= 0) { Untie(); } } float damage = playerAttack - ((eDefence / (20.0f + eDefence)) * playerAttack); currentHP -= damage; totalDamageSustained += damage; damageText.gameObject.SetActive(true); damageText.text = Mathf.RoundToInt(damage).ToString(); battleManager.enemies[enemyIndexInBattleManager].currentHP = currentHP; //Update the BTL manager with the new health HP.fillAmount = currentHP / maxHP; if (currentHP <= 1.0f) { if (bossPhase == 1) { //Reset and get ready for phase 2 animator.SetBool("Phase2", true); currentState = EnemyState.idle; waitTime = 0; waitTurnsText.text = "0"; chosenSkill = fareaSkills.none; lullWait.gameObject.SetActive(false); wailWait.gameObject.SetActive(false); } animator.SetBool("Death", true); } else { if (numberOfAttacks <= 0) { uiBTL.EndTurn(); //Only end the turn after the damage has been taken } } if (currentState != EnemyState.waiting) { animator.SetBool("Hit", true); } if (currentHP < 0.5f * maxHP) { //If the current health is less than half the max health, then make it more probable to use You Are Not Mine //If you have not used it yet if (!youAreNotMineUsedOnceThisFight) { //Debug.Log("Farea current HP: " + currentHP); //Debug.Log("Farea max HP: " + maxHP); skillChanceModifier = 2.0f; } } } else { if (missText != null) { missText.gameObject.SetActive(true); } } }