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

◆ DamageVar() [1/2]

static int Terraria.Main.DamageVar ( float dmg,
float luck = 0f )
inlinestatic

Multiplies the input damage by a random value between 0.85f and 1.15f.

Parameters
dmgThe damage to vary.
luckHow lucky the damager is, in the range [-1f, 1f].
If luck > 0f, there is a luck % chance that damage variation is rerolled, with the higher value being used.
If luck < 0f, there is a -luck % chance that damage variation is rerolled, with the lower value being used.
Returns
The varied damage value, rounded to the nearest integer.

Definition at line 83222 of file Main.cs.

83223 {
83225 }
static int DamageVar(float dmg, float luck=0f)
Multiplies the input damage by a random value between 0.85f and 1.15f.
Definition Main.cs:83222
static int DefaultDamageVariationPercent
Definition Main.cs:2698

References Terraria.Main.DamageVar(), and Terraria.Main.DefaultDamageVariationPercent.

Referenced by Terraria.Player.ApplyTouchDamage(), Terraria.Projectile.BombsHurtPlayers(), Terraria.Projectile.Damage(), Terraria.Main.DamageVar(), Terraria.NPC.HitModifiers.GetDamage(), Terraria.Player.GetMinecartDamage(), Terraria.Player.ItemCheck_MeleeHitPVP(), Terraria.Player.ItemCheck_UseMiningTools_ActuallyUseMiningTool(), and Terraria.Player.Update_NPCCollision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: