/** * public void GetDirectHealing(SkeletonSkill skill) **/ public int GetDirectHealing(SkeletonSkill skill) { int damageToHeal = 0; switch (skill.multiplyFactor) { case SkeletonSkill.MultiplyFactor.FACTOR_ATTACK: damageToHeal = this.attack * skill.multiplier; break; case SkeletonSkill.MultiplyFactor.FACTOR_SPECIAL_ATTACK: damageToHeal = this.specialAttack * skill.multiplier; break; case SkeletonSkill.MultiplyFactor.FACTOR_HP: damageToHeal = this.maxHp * skill.multiplier; break; case SkeletonSkill.MultiplyFactor.FACTOR_DEFENSE: damageToHeal = this.defense * skill.multiplier; break; case SkeletonSkill.MultiplyFactor.FACTOR_SPECIAL_DEFENSE: damageToHeal = this.specialDefense * skill.multiplier; break; } return(damageToHeal); }
/** * public void TakeDamage(int damage) **/ public void TakeDamageAndApplyDebuff(int damage, SkeletonSkill skill) { //100 * 100 / (100 + 400)1 int damageToDeal = 0; double physicalDmgReduceFactor = 1000 / (1100 + 3.5 * this.defense); double specialDmgReduceFactor = 1000 / (1100 + 3.5 * this.defense); switch (skill.type) { case SkeletonSkill.SkillType.TYPE_DAMAGE: damageToDeal = (int)(damage * physicalDmgReduceFactor); break; case SkeletonSkill.SkillType.TYPE_SPECIAL_DAMAGE: damageToDeal = (int)(damage * specialDmgReduceFactor); break; } int headshotCalculation = Random.Range(1, 100); if (headshotCalculation <= headshotProb) { Debug.Log("Damage is headshot !" + " Value was " + headshotCalculation + " - " + headshotProb); if (headshotResistance > 75) { headshotResistance = 75; } int headshotResistCalculation = Random.Range(1, 100); if (headshotResistCalculation <= headshotResistance) { Debug.Log("Headshot resisted ! No extra damage will be dealt" + " Value was " + headshotResistCalculation + " - " + evation); } else { Debug.Log("Couldn't resist headshot"); damageToDeal *= 2; } } if (evation > 20) { evation = 20; } int evadeCalculation = Random.Range(1, 100); if (evadeCalculation <= evation) { Debug.Log("Damage evaded !" + " Value was " + evadeCalculation + " - " + evation); //if damage is evaded do not add debuffs return; } else { Debug.Log("Damage took is : " + damageToDeal); hp -= damageToDeal; } //todo calculate debuff changes and apply int triggerChangeCalculation = Random.Range(1, 100); if (triggerChangeCalculation <= skill.triggerChance) { buffsList.RemoveAll(buff => buff.effect == skill.effect); this.buffsList.Add(new Buff(skill.effect, skill.duration)); } switch (skill.effect) { case SkeletonSkill.SkillEffect.ATTACK_DOWN: Debug.Log("Attack down for " + skill.duration); break; case SkeletonSkill.SkillEffect.DEFENSE_DOWN: Debug.Log("DEFENSE_DOWN for " + skill.duration); break; case SkeletonSkill.SkillEffect.STUN: Debug.Log("STUN for " + skill.duration); break; case SkeletonSkill.SkillEffect.SLEEP: Debug.Log("SLEEP for " + skill.duration); break; case SkeletonSkill.SkillEffect.VIRUS: Debug.Log("VIRUS for " + skill.duration); break; } }