예제 #1
0
    // 造成伤害
    public static void ApplyDamage(BattleUnit caster, BattleUnit victim, AbilityDamageType damageType,
                                   AbilityDamageFlag damageFlag, AbilityValueSource damageValueSource, string configName)
    {
        int            casterLevel    = caster.GetLevel();
        BattleProperty casterProperty = caster.GetProperty();
        BattleProperty victimProperty = victim.GetProperty();
        float          abilityValue   = damageValueSource.GetAbilityValue(casterLevel, casterProperty, victimProperty);
        float          finalDamage    = CalcDamageByDamageType(abilityValue, damageType, casterProperty, victimProperty);

        // 护盾
        // 吸血

        victim.UpdateHP(-finalDamage);
        BattleLog.LogRpgBattleAttacker(BattleLogic.instance.logicFrame, caster, victim, configName, finalDamage);
    }