public InputDamage(NebulaObject source, WeaponDamage damage, DamageParams damageParams = null) { m_Damager = source; m_Damage = damage; if (m_Damager) { var sourceCharacter = source.Character(); if (sourceCharacter) { m_Workshop = (Workshop)sourceCharacter.workshop; m_Level = sourceCharacter.level; } else { m_Workshop = Workshop.Arlen; m_Level = 1; } var sourceRaceable = source.Raceable(); if (sourceRaceable) { m_Race = (Race)sourceRaceable.race; } else { m_Race = Race.None; } } else { m_Workshop = Workshop.Arlen; m_Level = 1; m_Race = Race.None; } m_DamageParams = damageParams; }
private bool ReflectDamage(DamagableObject targetDamagable, ref WeaponHitInfo hit, InputDamage inputDamage) { bool reflected = targetDamagable.TryReflectDamage(); if (reflected) { if (hit.normal) { DamageParams damageParams = new DamageParams(); damageParams.SetReflrected(true); InputDamage inpDamage = new InputDamage(targetDamagable.nebulaObject, inputDamage.CreateCopy(), damageParams); cachedDamagable.ReceiveDamage(inpDamage); } } return(reflected); }
private void ApplyReflection(InputDamage inputDamage) { if ((false == inputDamage.reflected) && inputDamage.hasDamager) { var reflectValue = mBonuses.reflectionPc; if (false == Mathf.Approximately(reflectValue, 0f)) { float reflectedDamageVal = inputDamage.totalDamage * reflectValue; var attackerDamagable = inputDamage.source.Damagable(); WeaponDamage reflectedDamage = new WeaponDamage(inputDamage.weaponBaseType); reflectedDamage.SetBaseTypeDamage(reflectedDamageVal); if (attackerDamagable) { DamageParams damageParams = new DamageParams(); damageParams.SetReflrected(true); attackerDamagable.ReceiveDamage(new InputDamage(nebulaObject, reflectedDamage, damageParams)); } } } }