ApplyDamageFactors

From ZDoom Wiki
Jump to navigation Jump to search

static int ApplyDamageFactors (class<Inventory> itemcls, Name damagetype, int damage, int defdamage)

Usage

Returns the value passed to damage after adjustment, which is done by multiplying it with the chosen damage factor from the specified item class. If the chosen damage factor does not exist among the item's damage factors, damage is returned as is. If the item does not define any damage factors, the function returns the value passed to defdamage without any adjustments.

This function is generally used as part of set ups to adjust the damage an actor receives or inflicts.

Parameters

  • itemcls: the item class from which to get the damage factors.
  • damagetype: the desired damage factor, referenced by its damage type.
  • damage: the value to multiply the damage factor with.
  • defdamage: the fall-back value to return if the item does not define any damage factors.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.