Ejemplo n.º 1
0
    public bool OnHit(CharacterStateControl attacker, CharacterStateControl target)
    {
        if (SkillStatus.onHitRate100Percent)
        {
            return(true);
        }
        float num = this.hitRate;

        if (Tolerance.OnInfluenceToleranceAffectEffect(this.type))
        {
            Tolerance tolerance            = target.tolerance;
            Strength  affectEffectStrength = tolerance.GetAffectEffectStrength(this.type);
            if (affectEffectStrength == Strength.Strong)
            {
                num *= 0.5f;
            }
            else if (affectEffectStrength == Strength.Weak)
            {
                num *= 1.5f;
            }
            else if (affectEffectStrength == Strength.Invalid)
            {
                num *= 0f;
            }
        }
        else if (attacker != null)
        {
            num += this.GetSkillHitRateCorrectionValue(attacker);
        }
        return(RandomExtension.Switch(Mathf.Clamp01(num)));
    }
Ejemplo n.º 2
0
    public Strength GetSkillStrength(Tolerance tolerance)
    {
        int num = 0;

        foreach (AffectEffectProperty affectEffectProperty in this.affectEffect)
        {
            if (affectEffectProperty != null)
            {
                Strength strength = Strength.None;
                if (affectEffectProperty.ThisSkillIsAttack && affectEffectProperty.powerType == PowerType.Percentage)
                {
                    strength = tolerance.GetAttributeStrength(affectEffectProperty.attribute);
                }
                else if (Tolerance.OnInfluenceToleranceAffectEffect(affectEffectProperty.type))
                {
                    strength = tolerance.GetAffectEffectStrength(affectEffectProperty.type);
                }
                switch (strength)
                {
                case Strength.Strong:
                    num--;
                    break;

                case Strength.Weak:
                    num++;
                    break;

                case Strength.Drain:
                    return(Strength.Drain);

                case Strength.Invalid:
                    return(Strength.Weak);
                }
            }
        }
        if (num < 0)
        {
            return(Strength.Weak);
        }
        if (num > 0)
        {
            return(Strength.Strong);
        }
        return(Strength.None);
    }