tModLoader v2024.09
A mod to make and play Terraria mods
|
Public Member Functions | |
void | DisableDust () |
Prevents dust from spawning | |
void | DisableSound () |
Prevents the hurt sound from playing | |
float | GetDamage (float baseDamage, float defense, float defenseEffectiveness) |
float | GetKnockback (float baseKnockback, bool knockbackImmune) |
delegate void | HurtInfoModifier (ref HurtInfo info) |
void | SetMaxDamage (int limit) |
Sets an inclusive upper bound on the final damage of the hit. Can be set by multiple mods, in which case the lowest limit will be used. Cannot be set to less than 1 | |
HurtInfo | ToHurtInfo (int damage, int defense, float defenseEffectiveness, float knockback, bool knockbackImmune) |
Public Attributes | |
AddableFloat | ArmorPenetration = new() |
Flat defense reduction. Applies after ScalingArmorPenetration. Consider supplying armorPenetration as an argument to Player.Hurt(PlayerDeathReason, int, int, bool, bool, int, bool, float, float, float) instead if possible. | |
StatModifier | FinalDamage = new() |
Applied to the final damage result. Used by Player.endurance to reduce overall incoming damage. Multiply to grant damage reduction buffs (eg *0.9f for -10% damage taken). Add to StatModifier.Base to deal damage which ignores armor, but still respects scaling damage reduction like endurance or paladins shield. Adding to StatModifier.Flat will ignore all reductions or increases to deal unconditional damage. Not recommended due to potential compatibility issues with accessories like paladin's shield, use StatModifier.Base instead. | |
MultipliableFloat | IncomingDamageMultiplier = new() |
Use this to reduce damage from certain sources before applying defense. Used by vanilla for coldResist and banner damage reduction. | |
StatModifier | Knockback = new() |
Modifiers to apply to the knockback. Add to StatModifier.Base to increase the knockback of the strike. Multiply to decrease or increase overall knockback susceptibility. | |
MultipliableFloat | KnockbackImmunityEffectiveness = new() |
Use this to reduce the effectiveness of Player.noKnockback (cobalt shield accessory). Eg, *0.8f to reduce knockback to 20% when cobalt shield is equipped. Defaults to 1f (knockback immunity is 100% effective by default). Used by vanilla for the ogre's launching attack. | |
AddableFloat | ScalingArmorPenetration = new() |
Used to ignore a fraction of player defense. Applies before flat ArmorPenetration. At 1f, the attack will completely ignore all defense. | |
StatModifier | SourceDamage = new() |
Use this to enhance or scale the base damage of the NPC/projectile/hit. Not used by vanilla due to lack of proper pvp support. Use cases are similar to NPC.HitModifiers.SourceDamage | |
Properties | |
int | CooldownCounter = ImmunityCooldownID.General [get] |
The ImmunityCooldownID of the strike | |
PlayerDeathReason | DamageSource = default [get] |
The source of the strike. Use PlayerDeathReason.TryGetCausingEntity to get the source of the strike (only safe to do when the target is the local player). | |
bool | Dodgeable = true [get] |
Whether or not this strike was dodgeable. | |
int | HitDirection = default [get] |
The direction to apply knockback. If 0, no knockback will be applied. Could potentially be used for directional resistances. Can be overridden by HitDirectionOverride | |
int? | HitDirectionOverride = default [set] |
Overrides the direction to apply knockback. Will not affect HitDirection, only the final HurtInfo.HitDirection If set by multiple mods, only the last override will apply. Intended for use by attacks which want to hit the player towards the source of the attack. | |
bool | PvP = default [get] |
Whether or not this strike came from another player. Note that PvP support in Terraria is rudimentary and inconsistent, so careful research and testing may be required. | |
Events | |
HurtInfoModifier | ModifyHurtInfo = null |
Use with caution and consider other alternatives first. Can be used to register a callback to freely modify the HurtInfo produced by ToHurtInfo before it is returned If multiple mods register different callbacks which modify the hurt info in different ways the results could be a mess! | |