float ChancesToHit(UnitScript currentUnit, UnitScript target) { float EvaluationIncrease = 0f; HitChancer hc = new HitChancer(currentUnit, target, 100); float damageChance = 100 - hc.MissChance(false); // im NOT sure if line above is correct, i had to change it after changing the combat system, it might be crap. float temp = damageChance * 0.01f; EvaluationIncrease += temp; return(EvaluationIncrease); }
private void CreateAHitChancer() { if (GameStateManager.Instance.GameState == GameStates.RetaliationState) { hc = new HitChancer(CombatController.Instance.AttackTarget, CombatController.Instance.AttackingUnit, 5000); } else { hc = new HitChancer(MouseManager.Instance.SelectedUnit, MouseManager.Instance.MouseoveredUnit, 5000); } }
float ChancesToHit(UnitScript currentUnit, ShootingScript shooter, UnitScript target) { float EvaluationIncrease = 0f; HitChancer hc = new HitChancer(currentUnit, target, 100); bool badRange = ShootingScript.WouldItBePossibleToShoot(shooter, shooter.transform.position, target.transform.position).Value; // above the Value not the Key of possible to shoot at is important. It is missleading yet correct. float damageChance = 100 - hc.MissChance(badRange); // im NOT sure if line above is correct, i had to change it after changing the combat system, it might be crap. float temp = damageChance * 0.015f; EvaluationIncrease += temp; return(EvaluationIncrease); }