Exemplo n.º 1
0
    public void ShowNewInformation()
    {
        bool badRange;

        if (GameStateManager.Instance.GameState == GameStates.ShootingState)
        {
            badRange = (MouseManager.Instance.SelectedUnit.GetComponent <ShootingScript>() != null && MouseManager.Instance.SelectedUnit.GetComponent <ShootingScript>().CheckBadRange(MouseManager.Instance.MouseoveredUnit.gameObject));
        }
        else
        {
            badRange = false;
        }
        SetUnitStats();
        float missChance = hc.MissChance(badRange);
        float hitChance  = hc.HitNoDamageChance(badRange);

        //float avgDmg = hc.AverageDamage(badRange);
        theText.text  = "Chances for:";
        theText.text += "\n" + "Miss (reducing Defence): " + (missChance + hitChance).ToString() + "%";
        //theText.text += "\n" + "Hit (no Damage): " + hitChance.ToString() + "%";
        theText.text += "\n" + "Hit (dealing Damage): " + (100 - missChance - hitChance).ToString() + "%";
        int[] MinMax = hc.GetMinMaxDmg();
        theText.text += "\n" + "\n" + "Damage if hit: " + (MinMax[0]).ToString() + " - " + (MinMax[1]).ToString();
        UndoUnitStats();
        if (TurnManager.Instance.CurrentPhase == TurnPhases.Shooting)
        {
            int shelter = MouseManager.Instance.MouseoveredUnit.HowMuchShelteredFrom(MouseManager.Instance.SelectedUnit.transform.position);
            if (shelter > 0)
            {
                theText.text += "\n" + "Target's shelter increases his defence by: " + shelter.ToString();
            }
        }
        currentTarget = neededTarget;
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
    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);
    }