Template:AfflictionParser/doc: Difference between revisions

From Official Barotrauma Wiki
Jump to: navigation, search
mNo edit summary
No edit summary
Line 14: Line 14:
!Field!!Note!!Example!!Default
!Field!!Note!!Example!!Default
|-
|-
| afflictions<br> explosionafflictions<br> medicalafflictions<br> resistancemultipliers || Afflictions separated by <code>;</code><br>Parameters separated by <code>,</code>.
| afflictions<br> explosionafflictions<br> medicalafflictions<br> resistancemultipliers || Afflictions are separated by <code>;</code><br>Affliction Parameters are separated by <code>,</code>
*medicalafflictions allows the Fail column to apprear if any affliction has <code>fail</code> defined, or if <code>durationfail</code> is defined.
* medicalafflictions allows the Fail column to apprear if any affliction has <code>fail</code> defined, or if <code>durationfail</code> is defined.
* First parameter of an affliction must be <code>Identifier = Strength</code>.
* First parameter of an affliction must be <code>Identifier = Strength</code>.
* Optional parameters can be written in any order.
* Optional parameters can be written in any order.
Line 56: Line 56:
| colspan = 4 style="text-align:center" | <big>'''Status Effect Parameters (Affect all Afflictions. Must be defined before Afflictions)'''</big>
| colspan = 4 style="text-align:center" | <big>'''Status Effect Parameters (Affect all Afflictions. Must be defined before Afflictions)'''</big>
|-
|-
| duration, durationfail || Duration of the entire Status Effect. || duration = 10, failduration = 15
| duration = number || Duration of the entire Status Effect.|| <code>duration = 10</code>
|-
|-
| note || Note shown before afflictions
| durationfail = number || Overrides <code>duration</code> for afflictions in the fail column. || <code>failduration = 15</code>
* Text must be within quotation marks <code>"</code><code>"</code>
|| note = "Text"
|-
|-
| colspan = 4 style="text-align:center" | <big>'''Affliction Parameters'''</big>
| successnote = "text" || Note displayed above afflictions in the success column.
* Text must be within quotation marks <code>" "</code>
| <code>successnote = "text"</code>
|-
| failnote = "text" || Note displayed above afflictions in the fail column.
* Text must be within quotation marks <code>" "</code>
| <code>failsnote = "text"</code>
|-
| note = "text" || Note displayed above afflictions.
* Is displayed in both the success and fail columns.
* Is displayed only if <code>successnote</code> and <code>failnote</code> are NOT defined.
* Text must be within quotation marks <code>" "</code>
| <code>note = "text"</code>
|-
| colspan = 4 style="text-align:center" | <big>'''Affliction Parameters (Separated by <code>,</code>)'''</big>
|-
|-
| identifier = strength || Identifier of the affliction, followed by it's strength.<br>In case of resistances, Identifier of the affliction, followed by it's resistance multiplier.
| identifier = strength || Identifier of the affliction, followed by it's strength.<br>In case of resistances, Identifier of the affliction, followed by it's resistance multiplier.
* It must be the first parameter of an affliction.
* It must be the first parameter of an affliction.
* If the strength value in XML is inside a "ReduceAffliction" element, negate the value.  
* If the strength value in XML is inside a "ReduceAffliction" element, negate the value.  
* If the strength value is equal to 0, and resistancemultipliers is not defined, then the affliction is not shown. Used when there is a fail affliction but no success affliction.
* If the strength value is equal to <code>0</code>, and <code>resistancemultipliers</code> is NOT defined, then the affliction is not shown. Used when there is a fail affliction but no success affliction.
|| burn = 20
|| <code>burn = 20</code><br><br><code>burn = 0.75</code><br><br><code>burn = -30</code>
|-
| fail = number || Strength of an affliction when failed || <code>fail = 10</code>
|-
| chance = number || Probability of an affliction to occur.<br>In case of resistances, probability to completely resist an affliction. || <code>chance = 0.2</code>
|-
|-
| fail = number || Strength of an affliction when failed|| fail = 10
| duration = number || Duration of an affliction, only define if different from Status Effect duration. || <code>duration = 5</code>
|-
|-
| chance = number || Probability of an affliction to occur.<br>In case of resistances, probability to completely resist an affliction. || chance = 0.2
| delay = number || Delay before the affliction starts to have an effect. || <code>delay = 3</code>
|-
|-
| duration = number || Duration of an affliction, only define if different from Status Effect duration. || duration = 5
| instant = yes || Can be used to make an affliction ignore duration if needed. || <code>instant = yes</code>
|-
|-
| delay = number || Delay before the affliction starts to have an effect. || delay = 3
| successnote = "text" || Note displayed under the affliction stats in the success column.
* Text must be within quotation marks <code>" "</code>
* Overrides note
| <code>successnote = "text"</code>
|-
|-
| instant = yes || Can be used to make an affliction ignore duration if needed. || instant = yes
| failnote = "text" || Note displayed the affliction stats in the fail column.
* Text must be within quotation marks <code>" "</code>
* Overrides note
| <code>failnote = "text"</code>
|-
|-
| note = "text" || Note that shows under the affliction stats.
| note = "text" || Note displayed the affliction stats.
* Text must be within quotation marks <code>"</code><code>"</code>
* Text must be within quotation marks <code>" "</code>
| note = "text"
| <code>note = "text"</code>
|}
|}


Line 374: Line 396:
----
----


== Test ==
<pre style="width:fit-content>
{{AfflictionDisplayTest|medicalafflictions = duration = 1;
bleeding = -100, fail = -75;
burn = -100, fail = -75;
organdamage = 0, fail = 1.25, duration = 5;
}}
</pre>
{|
! Table Cell
|-
{{AfflictionDisplayTest|medicalafflictions = duration = 1;
bleeding = -100, fail = -75;
burn = -100, fail = -75;
organdamage = 0, fail = 1.25, duration = 5;
}}
|}


{{doc/end}}
{{doc/end}}

Revision as of 16:08, 18 April 2023

Documentation
Main article: Template:Items infobox


WORK IN PROGRESS Template that will hopefully replace the current way afflictions are inserted into the Template:Items Infobox and how they are displayed there and in all other templates that display afflictions.

Sub Templates

Template Instructions

All of these values should be taken from cargo. Writing them manually is possible but there is no reason to.

Field Note Example Default
afflictions
explosionafflictions
medicalafflictions
resistancemultipliers
Afflictions are separated by ;
Affliction Parameters are separated by ,
  • medicalafflictions allows the Fail column to apprear if any affliction has fail defined, or if durationfail is defined.
  • First parameter of an affliction must be Identifier = Strength.
  • Optional parameters can be written in any order.

afflictions =
burn = 10;
burn = 20, chance = 0.5;

medicalafflictions = duration = 10;
damage = -5, fail = -2.5;
burn = -0.1, fail = -0.05;
oxygenlow = 2, fail = 3;

resistances =
burn = 0.5, chance = 0.4;
lacerations = 0.6;
bitewounds = 0.7;

projectiles Projectiles.
  • Not displayed if not defined or equal to 1.
8 1
weapondamagemodifier Weapon Damage Modifier.
  • Not displayed if not defined or equal to 1.
1.1 1
protects Protected limbs
  • Afflictions are displayed as resistances if defined.
Head
noresistancenames Resistances are displayed without names if defined as yes. yes


Affliction Instructions

Field Note Example Default
Status Effect Parameters (Affect all Afflictions. Must be defined before Afflictions)
duration = number Duration of the entire Status Effect. duration = 10
durationfail = number Overrides duration for afflictions in the fail column. failduration = 15
successnote = "text" Note displayed above afflictions in the success column.
  • Text must be within quotation marks " "
successnote = "text"
failnote = "text" Note displayed above afflictions in the fail column.
  • Text must be within quotation marks " "
failsnote = "text"
note = "text" Note displayed above afflictions.
  • Is displayed in both the success and fail columns.
  • Is displayed only if successnote and failnote are NOT defined.
  • Text must be within quotation marks " "
note = "text"
Affliction Parameters (Separated by ,)
identifier = strength Identifier of the affliction, followed by it's strength.
In case of resistances, Identifier of the affliction, followed by it's resistance multiplier.
  • It must be the first parameter of an affliction.
  • If the strength value in XML is inside a "ReduceAffliction" element, negate the value.
  • If the strength value is equal to 0, and resistancemultipliers is NOT defined, then the affliction is not shown. Used when there is a fail affliction but no success affliction.
burn = 20

burn = 0.75

burn = -30
fail = number Strength of an affliction when failed fail = 10
chance = number Probability of an affliction to occur.
In case of resistances, probability to completely resist an affliction.
chance = 0.2
duration = number Duration of an affliction, only define if different from Status Effect duration. duration = 5
delay = number Delay before the affliction starts to have an effect. delay = 3
instant = yes Can be used to make an affliction ignore duration if needed. instant = yes
successnote = "text" Note displayed under the affliction stats in the success column.
  • Text must be within quotation marks " "
  • Overrides note
successnote = "text"
failnote = "text" Note displayed the affliction stats in the fail column.
  • Text must be within quotation marks " "
  • Overrides note
failnote = "text"
note = "text" Note displayed the affliction stats.
  • Text must be within quotation marks " "
note = "text"



Template in use

Simulations of how this would work when displayed in table cells in the infobox or table templates.

Test 1

{{AfflictionDisplayTest|afflictions = 
burn =  10; 
burn =  20, chance = 0.5; 
burn =  30; 
burn =  40, chance = 0.01;
burn =  50;
Table Cell

Template:AfflictionDisplayTest



40mm Mini Nuke

Main article: 40mm Mini Nuke


{{AfflictionDisplayTest|afflictions = 
explosiondamage = 100;
burn = 100;
bleeding = 50;
stun = 5;

explosionafflictions =
explosiondamage = 200;
burn = 200;
bleeding = 40, chance = 0.05;
stun = 10;
radiationsickness = 30;
}}
Table Cell

Template:AfflictionDisplayTest



Ethanol

Main article: Ethanol


{{AfflictionDisplayTest| medicalafflictions = duration = 10;
psychosisresistance = 600, instant = yes;
drunk = 2, delay = 10;
hallucinating = -2, delay = 10;
psychosis = -2, delay = 10;

}}
Template:AfflictionDisplayTest
Table Cell



Morphine

Main article: Morphine


{{AfflictionDisplayTest| medicalafflictions = duration = 10;
damage = -5, fail = -2.5;
burn = -0.1, fail = -0.05;
oxygenlow = 2, fail = 3;
opiateaddiction = 0.5, fail = 2.5;
opiatewithdrawal = -3, fail = -3;
opiateoverdose = 1, fail = 2;
}}
Template:AfflictionDisplayTest
Table Cell



Diving Suit

Main article: Diving Suit


{{AfflictionDisplayTest|protects = Head|resistancemultipliers =
bitewounds = 0.7;
lacerations = 0.7;
blunttrauma = 0.7;
gunshotwound = 0.7;
burn = 0.75;
bleeding = 0.7;
huskinfection = 1, chance = 0.5;
radiationsickness = 0.75;
}}
Table Cell

Template:AfflictionDisplayTest



Diving Suit no names

Main article: Diving Suit


{{AfflictionDisplayTest|protects = Head|noresistancenames = yes|resistancemultipliers =
bitewounds = 0.7;
lacerations = 0.7;
blunttrauma = 0.7;
gunshotwound = 0.7;
burn = 0.75;
bleeding = 0.7;
huskinfection = 1, chance = 0.5;
radiationsickness = 0.75; 
}}
Table Cell

Template:AfflictionDisplayTest



Raptor Bane Extract

Main article: Raptor Bane Extract


{{AfflictionDisplayTest|medicalafflictions = duration = 20, durationfail = 10;
organdamage = 10, fail = 10, note = "Only affects [[Mudraptor]]s";
nausea = 5;
Template:AfflictionDisplayTest
Table Cell



Endocrine Booster

Main article: Endocrine Booster


{{AfflictionDisplayTest|medicalafflictions = note = "Grants the user a new talent, provided there's one available to recieve."
Template:AfflictionDisplayTest
Table Cell



Test

{{AfflictionDisplayTest|medicalafflictions = note = "Status Effect Note";
burn = 10, note = "Affliction note 1";
burn = 20, note = "Affliction note 2";
poison = 30;
}}
Template:AfflictionDisplayTest
Table Cell



Test

{{AfflictionDisplayTest|medicalafflictions = successnote = "Success Status Effect Note", failnote = "Fail Status Effect Note";
burn = 40, fail = 45, successnote = "Success note 1";
burn = 50, fail = 55, failnote = "Fail note 1";
burn = 60, fail = 65, successnote = "Success note 2", failnote = "Fail note 2";
}}
Template:AfflictionDisplayTest
Table Cell




This is the documentation page, it should be transcluded into the main template page. See Template:Doc for more information.