|
TModLoader v1.4.4.9
TModLoader source code documentation
|
Collaboration diagram for Terraria.Player.HurtModifiers:Public Member Functions | |
| 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. | |
| void | DisableDust () |
| Prevents dust from spawning. | |
| void | DisableSound () |
| Prevents the hurt sound from playing. | |
| HurtModifiers () | |
| float | GetDamage (float baseDamage, float defense, float defenseEffectiveness) |
| float | GetKnockback (float baseKnockback, bool knockbackImmune) |
| HurtInfo | ToHurtInfo (int damage, int defense, float defenseEffectiveness, float knockback, bool knockbackImmune) |
Public Attributes | |
| StatModifier | SourceDamage |
| 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 F:Terraria.NPC.HitModifiers.SourceDamage | |
| MultipliableFloat | IncomingDamageMultiplier |
| Use this to reduce damage from certain sources before applying defense. Used by vanilla for coldResist and banner damage reduction. | |
| StatModifier | FinalDamage |
| Applied to the final damage result. Used by F:Terraria.Player.endurance to reduce overall incoming damage. Multiply to grant damage reduction buffs (eg *0.9f for -10% damage taken). Add to F:Terraria.ModLoader.StatModifier.Base to deal damage which ignores armor, but still respects scaling damage reduction like endurance or paladins shield. Adding to F:Terraria.ModLoader.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 F:Terraria.ModLoader.StatModifier.Base instead. | |
| AddableFloat | ArmorPenetration |
| Flat defense reduction. Applies after F:Terraria.Player.HurtModifiers.ScalingArmorPenetration. Consider supplying armorPenetration as an argument to M:Terraria.Player.Hurt(Terraria.DataStructures.PlayerDeathReason,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Int32,System.Boolean,System.Single,System.Single,System.Single) instead if possible. | |
| AddableFloat | ScalingArmorPenetration |
| Used to ignore a fraction of player defense. Applies before flat F:Terraria.Player.HurtModifiers.ArmorPenetration. At 1f, the attack will completely ignore all defense. | |
| StatModifier | Knockback |
| Modifiers to apply to the knockback. Add to F:Terraria.ModLoader.StatModifier.Base to increase the knockback of the strike. Multiply to decrease or increase overall knockback susceptibility. | |
| MultipliableFloat | KnockbackImmunityEffectiveness |
| Use this to reduce the effectiveness of F:Terraria.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. | |
Properties | |
| PlayerDeathReason | DamageSource [get] |
| The source of the strike. Use M:Terraria.DataStructures.PlayerDeathReason.TryGetCausingEntity(Terraria.Entity@) to get the source of the strike (only safe to do when the target is the local player). | |
| bool | PvP [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. | |
| int | CooldownCounter [get] |
| The T:Terraria.ID.ImmunityCooldownID of the strike. | |
| bool | Dodgeable [get] |
| Whether or not this strike was dodgeable. | |
| int | HitDirection [get] |
| The direction to apply knockback. If 0, no knockback will be applied. Could potentially be used for directional resistances. Can be overridden by P:Terraria.Player.HurtModifiers.HitDirectionOverride | |
| int? | HitDirectionOverride [set, private get] |
| Overrides the direction to apply knockback. Will not affect P:Terraria.Player.HurtModifiers.HitDirection, only the final F:Terraria.Player.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. | |
Events | |
| HurtInfoModifier | ModifyHurtInfo |
| Use with caution and consider other alternatives first. Can be used to register a callback to freely modify the T:Terraria.Player.HurtInfo produced by M:Terraria.Player.HurtModifiers.ToHurtInfo(System.Int32,System.Int32,System.Single,System.Single,System.Boolean) before it is returned If multiple mods register different callbacks which modify the hurt info in different ways the results could be a mess! | |
Private Attributes | |
| int | _damageLimit |
| bool | _dustDisabled |
| bool | _soundDisabled |