public void DoDamage() { //Iron Dagger int extraDamage = 0; if (barScript.GetIronDagger() == true) { extraDamage = (int)Mathf.Ceil(damageTaken * 0.1f); Debug.Log("Doing Extra Damage: " + extraDamage); } //Sword of hate if (barScript.GetSwordOfHate() == true) { float fireDamageChance = Random.value; if (Random.value <= .25f) { StartCoroutine(BurningEffect(5, 1)); } } //Scythe int extraDamageScythe = 0; if (barScript.GetScythe() == true) { extraDamageScythe = (int)Mathf.Ceil(damageTaken * 0.1f); Debug.Log("Doing Extra Damage: " + extraDamageScythe); } //Cursed Blade int cursedBladeDamage = 0; if (barScript.GetCursedBlade() == true) { cursedBladeDamage = (int)Mathf.Ceil(damageTaken * 0.1f); float randomChance = Random.value; if (randomChance >= 0.95f) { GameObject newCursedBladeObject = Instantiate(barScript.cursedBladeObject, this.gameObject.transform.position, Quaternion.Euler(-90, 0, 0)) as GameObject; newCursedBladeObject.transform.position = new Vector3(this.gameObject.transform.position.x + 0, 0.5f, this.gameObject.transform.position.z + 0); } Debug.Log("Doing Extra Damage: " + cursedBladeDamage); } //Sword of hate if (barScript.GetNightblade() == true) { if (Random.value <= .25f) { StartCoroutine(PoisonEffect(5, 1)); } } //Bloodthirster if (barScript.GetBloodthirster() == true) { if (Random.value <= .55f) { float lifeSteal = (damageTaken + extraDamage + extraDamageScythe + cursedBladeDamage) * 0.2f; barScript.HealthBar.value += lifeSteal; } } if (_isBoss != true) { this.gameObject.transform.Translate(Vector3.back * smooth * Time.deltaTime); } CameraShake.GetComponent <ScreenShake>().Shake(0.1f, 0.3f); health -= damageTaken + extraDamage + extraDamageScythe + cursedBladeDamage; HitBox.enabled = false; flashTime = 0.1f; audioS.PlayOneShot(soundEffects, 1.0F); audioS.PlayOneShot(deathSound, 1.0F); if (_isBoss == true) { if (BossHealthObject == null) { BossHealthObject.SetActive(true); BossText.text = bossName; BossHealthBar.maxValue = originalHealth; BossHealthBar.value = health; } else { BossHealthObject.SetActive(true); BossText.text = bossName; BossHealthBar.maxValue = originalHealth; BossHealthBar.value = health; } } else { if (BossHealthBar == null) { GameObject.Find("BossHealthObject"); if (BossHealthBar != null) { BossHealthObject.SetActive(false); } } else { BossHealthObject.SetActive(false); } } }