Ejemplo n.º 1
0
        /// <summary>Calculate receiving damage from action.</summary>
        /// <param name="action">Action that hits the unit.</param>
        /// <param name="unitAttackValue">Attack value of the attacking unit (required for damage formula).</param>
        /// <returns>Does the unit survive?</returns>
        public bool ExecuteActionOnUnit(ICombatAction action, int unitAttackValue)
        {
            // Note: Put this in CUS?
            int totalValue = action.GetValue() + unitAttackValue;

            List <ICombatEffect> newEffects;

            GetNewEffects(ref action, out newEffects);

            List <ICombatCombo> applicableCombos;

            GetApplicableCombos(ref action, out applicableCombos);

            ExtrudeValueAndEffectsFromCombo(ref applicableCombos, ref totalValue, ref newEffects);
            combatStats.AddEffects(newEffects);

            combatStats.CalculateResultingValue(totalValue, action.element);
            ApplyEffectsOnHit(ref newEffects);

            CombatElement.Instance.ActiveElement = action.element;

            return(true);
        }