/// <summary> /// gets the success rate of attacker using Skill on defender /// </summary> /// <param name="attacker"> attacking unit </param> /// <param name="defender"> defending unit </param> /// <param name="s"> Skill in use </param> /// <returns> the success rate </returns> public static int GetSuccessRate(Unit attacker, Unit defender, Skill s) { //we gotta do some polymorphism shit on these boy-toys when we get other skills maybe SingleDamageSkill sd = s as SingleDamageSkill; int hit = sd.GetHitChance(attacker, defender); return(hit); }
/* * public static int GetSkillDamage(Unit attacker, Unit defender, Skill s) * { * //assume physical for now. Maybe weapon determines damage type? * //getDistance from each unit's position * * //check magic * SingleDamageSkill b = (SingleDamageSkill) s; * if (b.DamageType == DamageType.Physical) * { * Debug.Log("physical"); * return GetPhysicalSkillDamage(attacker, defender, b); * } * * if (b.DamageType == DamageType.Magical) * { * Debug.Log("magical"); * return GetMagicalSkillDamage(attacker, defender, b); * } * * return 0; * */ /// <summary> /// Gets the physical damage off a skill /// </summary> /// <param name="attacker"> attacking unit </param> /// <param name="defender"> defending unit </param> /// <param name="s"> the physical skill being used </param> /// <returns> the physical damange being dealt to the defender </returns> public static int GetPhysicalSkillDamage(Unit attacker, Unit defender, SingleDamageSkill s) { int damageDone = s.GetDamage(attacker, defender); if (damageDone <= 0) { return(1); } return(damageDone); }