Example #1
0
        public bool BlastSuccess(FightDataFormat attacker, FightDataFormat defender)
        {
            this.IsBlast = null;

            SkillDataManager.Instance.ActiveSkill(TURN_STATES.JUDGE_BLAST, attacker, defender);

            if (this.IsBlast != null)
            {
                return(this.IsBlast.Value);
            }

            var _defenderAC = defender.FinalAttributesCache.AC;

            this.IgnoreDefenderAttributeList.ForEach(type => {
                if (type == ATTRIBUTE_TYPE.AC)
                {
                    _defenderAC = 0.0F;
                }
            });

            float _t = Mathf.Clamp(_defenderAC - attacker.FinalAttributesCache.PEN, FIGHT.BLAST_SUCCESS_AC_MINUS_PEN_MIN, FIGHT.BLAST_SUCCESS_AC_MINUS_PEN_MAX);

            var _resultValue = attacker.FinalAttributesCache.CRI * FIGHT.BLAST_SUCCESS_CRI_CP_0 * Mathf.FloorToInt(FIGHT.BLAST_SUCCESS_CP_0 - _t);

            this.IsBlast = ProbabilityHelper.TrySuccess(Mathf.FloorToInt(_resultValue));

            return(this.IsBlast.Value);
        }
Example #2
0
        public bool HitSuccess(FightDataFormat attacker, FightDataFormat defender)
        {
            this.IsHitSuccess = null;

            SkillDataManager.Instance.ActiveSkill(TURN_STATES.JUDGE_HIT, attacker, defender);

            if (this.IsHitSuccess != null)
            {
                return(this.IsHitSuccess.Value);
            }

            float _t = Mathf.Clamp(defender.FinalAttributesCache.AVD - attacker.FinalAttributesCache.HIT, FIGHT.HIT_SUCCESS_PROBABILITY_MIN, FIGHT.HIT_SUCCESS_PROBABILITY_MAX);

            int _resultValue = FIGHT.HIT_SUCCESS_CP_0 - Mathf.FloorToInt(_t);

            this.IsHitSuccess = ProbabilityHelper.TrySuccess(_resultValue);

            return(this.IsHitSuccess.Value);
        }