Damage type: Difference between revisions

m →Technical information: this should go here. bit field is more a accurate term for this than bit string (since it's a C# enum that uses [FlagsAttribute])
Line 275: Line 275:


====Technical information====
====Technical information====
Internally, damage and Bloons in ''BTD6'' use [[wp:Bit field|bit fields]] to represent immunities. Damage uses a variable named <code>immuneBloonProperties</code> that lists the Bloon properties that are immune to it, while Bloons use a variable named <code>bloonProperties</code> that lists which properties it has the immunities of. Every damage type maps to a specific set of bits in <code>immuneBloonProperties</code>. The game files serialize these bit fields as 32-bit integers.
Internally, damage and Bloons in ''BTD6'' use [[wp:Bit field|bit fields]] to represent immunities. Damage uses a variable named <code>immuneBloonProperties</code> that lists the Bloon properties that are immune to it, while Bloons use a variable named <code>bloonProperties</code> that lists which properties it has the immunities of. Every damage type maps to a specific set of bits in <code>immuneBloonProperties</code>; the vanilla game never uses combinations of <code>immuneBloonProperties</code> that do not have a corresponding damage type. The game files serialize these bit fields as 32-bit integers.


Prior to version 52.0, Plasma and Energy were equivalent to integer values of 8 and 9, making the former functionally identical to the current Fire type.
Plasma and Energy were equivalent to {{hover|8|0b00001000}} and {{hover|9|0b00001001}} prior to version 52.0, which made the former functionally identical to the Fire type. Acid was equivalent to {{hover|0|0b00000000}} prior to version 53.0, which made it functionally identical to the Normal type.
{|class="wikitable inline"
{|class="wikitable inline"
|+Bloon properties
|+Bloon properties
Line 317: Line 317:
|}
|}
{|class="wikitable inline"
{|class="wikitable inline"
|+Damage type values
|+Damage types
!Type
!Type
!Integer value
!Value
|-
|-
|Normal
|Normal
|0
|{{hover|0|0b00000000}}
|-
|-
|Shatter
|Shatter
|1
|{{hover|1|0b00000001}}
|-
|-
|Explosion
|Explosion
|2
|{{hover|2|0b00000010}}
|-
|-
|Glacier
|Glacier
|4
|{{hover|4|0b00000100}}
|-
|-
|Cold
|Cold
|5
|{{hover|5|0b00000101}}
|-
|-
|Fire
|Fire
|8
|{{hover|8|0b00001000}}
|-
|-
|Frigid
|Frigid
|12
|{{hover|12|0b00001100}}
|-
|-
|Sharp
|Sharp
|17
|{{hover|17|0b00100001}}
|-
|-
|Acid
|Acid
|64
|{{hover|64|0b10000000}}
|-
|-
|Plasma
|Plasma
|72
|{{hover|72|0b10001000}}
|-
|-
|Energy
|Energy
|73
|{{hover|73|0b10001001}}
|}
|}