TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ ToHurtInfo()

HurtInfo Terraria.Player.HurtModifiers.ToHurtInfo ( int damage,
int defense,
float defenseEffectiveness,
float knockback,
bool knockbackImmune )
inline

Definition at line 789 of file Player.cs.

790 {
791 HurtInfo hurtInfo2 = new HurtInfo();
792 hurtInfo2.DamageSource = DamageSource;
793 hurtInfo2.PvP = PvP;
794 hurtInfo2.CooldownCounter = CooldownCounter;
795 hurtInfo2.Dodgeable = Dodgeable;
796 hurtInfo2.HitDirection = HitDirectionOverride ?? HitDirection;
797 hurtInfo2.SourceDamage = (int)SourceDamage.ApplyTo(damage);
798 hurtInfo2.Damage = (int)GetDamage(damage, defense, defenseEffectiveness);
799 hurtInfo2.Knockback = GetKnockback(knockback, knockbackImmune);
800 hurtInfo2.DustDisabled = _dustDisabled;
801 hurtInfo2.SoundDisabled = _soundDisabled;
802 HurtInfo hurtInfo = hurtInfo2;
803 this.ModifyHurtInfo?.Invoke(ref hurtInfo);
804 this.ModifyHurtInfo = null;
805 return hurtInfo;
806 }
float ApplyTo(float baseValue)
Use this to apply the modifiers of this T:Terraria.ModLoader.StatModifier to the baseValue ....
int HitDirection
The direction to apply knockback. If 0, no knockback will be applied. Could potentially be used for...
Definition Player.cs:705
HurtInfoModifier ModifyHurtInfo
Use with caution and consider other alternatives first. Can be used to register a callback to freely...
Definition Player.cs:720
StatModifier SourceDamage
Use this to enhance or scale the base damage of the NPC/projectile/hit. Not used by vanilla due t...
Definition Player.cs:625
PlayerDeathReason DamageSource
The source of the strike. Use M:Terraria.DataStructures.PlayerDeathReason.TryGetCausingEntity(Terra...
Definition Player.cs:682
float GetDamage(float baseDamage, float defense, float defenseEffectiveness)
Definition Player.cs:769
int? HitDirectionOverride
Overrides the direction to apply knockback. Will not affect P:Terraria.Player.HurtModifiers....
Definition Player.cs:713
float GetKnockback(float baseKnockback, bool knockbackImmune)
Definition Player.cs:779
bool Dodgeable
Whether or not this strike was dodgeable.
Definition Player.cs:698
bool PvP
Whether or not this strike came from another player. Note that PvP support in Terraria is rudimenta...
Definition Player.cs:688
int CooldownCounter
The T:Terraria.ID.ImmunityCooldownID of the strike.
Definition Player.cs:693

References Terraria.Player.HurtModifiers._dustDisabled, Terraria.Player.HurtModifiers._soundDisabled, Terraria.ModLoader.StatModifier.ApplyTo(), Terraria.Player.HurtModifiers.CooldownCounter, Terraria.Player.HurtModifiers.DamageSource, Terraria.Player.HurtModifiers.Dodgeable, Terraria.Player.HurtModifiers.GetDamage(), Terraria.Player.HurtModifiers.GetKnockback(), Terraria.Player.HurtModifiers.HitDirection, Terraria.Player.HurtModifiers.HitDirectionOverride, Terraria.Player.HurtModifiers.PvP, and Terraria.Player.HurtModifiers.SourceDamage.

+ Here is the call graph for this function: