private void skillLifeDrainInvoked() { float preCooldown; if (isNearPlayer) { preCooldown = 0; } else { preCooldown = skillTeleport.GetAnim("Departure (L)").GetDuration() + skillTeleport.GetAnim("Arrival (L)").GetDuration(); } float conjurationTime1 = sprites.GetAnim("Casting 1 (L)").GetDuration(); float conjurationTime2 = 1; if (Time.time - lastCastTime < preCooldown + conjurationTime1) { doAnimToDirection("Casting 1"); } else if (Time.time - lastCastTime < preCooldown + conjurationTime1 + conjurationTime2 * 1 && !magicInterrupted) { doAnimToDirection("Casting 2"); skillLifeDrainPlayer.GetComponent <LifeDrainPlayer>().activate(); skillLifeDrain.DoAnim("Effect"); float stolenHP; if (controlLifeDrain == 0) { audio.PlayOneShot(sound_drain); float stealDamage = 10; stolenHP = player.GetComponent <PlayerAttributes>().maxHP *stealDamage / 100; player.GetComponent <Controls>().gotDamaged(stolenHP, Controls.Enemy.BossLifeDrain); curHP += stolenHP * 1.5f; if (curHP > maxHP) { curHP = maxHP; } controlLifeDrain = 1; moreSkillsSprite.DoAnim("LifeDrain"); } } else if (Time.time - lastCastTime < preCooldown + conjurationTime1 + conjurationTime2 * 2 && !magicInterrupted) { doAnimToDirection("Casting 2"); skillLifeDrain.DoAnim("Effect"); float stolenHP; if (controlLifeDrain == 1) { float stealDamage = 10; stolenHP = player.GetComponent <PlayerAttributes>().maxHP *stealDamage / 100; player.GetComponent <Controls>().gotDamaged(stolenHP, Controls.Enemy.BossLifeDrain); curHP += stolenHP * 1.5f; if (curHP > maxHP) { curHP = maxHP; } controlLifeDrain = 2; moreSkillsSprite.DoAnim("LifeDrain"); } } else if (Time.time - lastCastTime < preCooldown + conjurationTime1 + conjurationTime2 * 3 && !magicInterrupted) { doAnimToDirection("Casting 2"); skillLifeDrain.DoAnim("Effect"); float stolenHP; if (controlLifeDrain == 2) { float stealDamage = 10; stolenHP = player.GetComponent <PlayerAttributes>().maxHP *stealDamage / 100; player.GetComponent <Controls>().gotDamaged(stolenHP, Controls.Enemy.BossLifeDrain); curHP += stolenHP * 1.5f; if (curHP > maxHP) { curHP = maxHP; } controlLifeDrain = 3; moreSkillsSprite.DoAnim("LifeDrain"); } } else { skillLifeDrain.StopAnim(); lastCastTime = -1; wasCasting = false; wasCastingLifeDrain = false; skillLifeDrainPlayer.GetComponent <LifeDrainPlayer>().desactivate(); controlLifeDrain = 0; doAnimToDirection("Standing"); curLifeDrainCooldown = lifeDrainCooldown; curGlobalCooldown = globalCooldown; } }