Beispiel #1
0
        // defenderStats can be used if we give armor to actors
        // not implemented now, just for the demonstration of extensibility
        public Attack CreateAttack(ActorStats attackerStats, ActorStats defenderStats = null)
        {
            float damage = attackerStats.GetDamage();

            damage += baseDamage;

            bool isCritical = Random.value < criticalChance;

            if (isCritical)
            {
                damage *= criticalHitBuff;
            }

            return(new Attack((int)damage, isCritical));
        }