Difference between revisions of "Template:AttackSpell"

From CrawlWiki
Jump to: navigation, search
(Comment out parts of the example no longer required. The reasons for these changes are that this information is totally superfluous, removing it has no adverse effects, and not including it caused yellow warning triangles to appear.)
m (try to noinclude more stuff)
 
(17 intermediate revisions by 2 users not shown)
Line 17: Line 17:
 
! align="left" | Targeting
 
! align="left" | Targeting
 
|{{{target|}}}
 
|{{{target|}}}
 +
|-
 +
! align="left" | To-hit
 +
|{{{tohit|}}}
 
|-
 
|-
 
! align="left" | Special
 
! align="left" | Special
 
| {{{special|}}}
 
| {{{special|}}}
|}</div><!--{{#set:power cap={{{power_cap|{{{maxsp}}} }}} }}{{#set:hit type={{{hit_type}}}}}{{#set:hit adder={{{hit_adder}}}}}{{#set:hit num={{{hit_num}}}}}{{#set:hit denom={{{hit_denom}}}}}{{#set:damage calculator={{{dam_calculator}}}}}{{#set:damage numdice={{{dam_numdice}}}}}{{#set:damage adder={{{dam_adder}}}}}{{#set:damage num={{{dam_num}}}}}{{#set:damage denom={{{dam_denom}}}}}[[Category:Attack spells]]-->
+
|}</div><noinclude>
 
+
<!--{{#set:power cap={{{power_cap|{{{maxsp}}} }}} }}{{#set:hit type={{{hit_type}}}}}{{#set:hit adder={{{hit_adder}}}}}{{#set:hit num={{{hit_num}}}}}{{#set:hit denom={{{hit_denom}}}}}{{#set:damage calculator={{{dam_calculator}}}}}{{#set:damage numdice={{{dam_numdice}}}}}{{#set:damage adder={{{dam_adder}}}}}{{#set:damage num={{{dam_num}}}}}{{#set:damage denom={{{dam_denom}}}}}[[Category:Attack spells]]-->
<noinclude>
 
  
 
Use this template for pages about specific attack [[spell]]s; put it at the top of every such page.  Example usage:
 
Use this template for pages about specific attack [[spell]]s; put it at the top of every such page.  Example usage:
Line 32: Line 34:
 
  |range = 7
 
  |range = 7
 
  |target = Bolt
 
  |target = Bolt
 +
|tohit = 10+Power/25
 
  |special = N/A
 
  |special = N/A
 
<!-- |hit_type = normal
 
<!-- |hit_type = normal
Line 52: Line 55:
 
|range = 7
 
|range = 7
 
|target = Bolt
 
|target = Bolt
 +
|tohit = 10+Power/25
 
|special = N/A
 
|special = N/A
 
<!--|hit_type = normal
 
<!--|hit_type = normal

Latest revision as of 09:58, 23 July 2023

Spell Details
Damage Formula
Max Damage
Max Power
Range
Targeting
To-hit
Special

Use this template for pages about specific attack spells; put it at the top of every such page. Example usage:

{{AttackSpell
|name=Bolt of Fire
|formula = 6d(3+Power/9) fire
|maxdmg = 6d(25)
|maxsp = 200
|range = 7
|target = Bolt
|tohit = 10+Power/25
|special = N/A
}}

The above example produces:

Spell Details
Damage Formula 6d(3+Power/9) fire
Max Damage 6d(25)
Max Power 200
Range 7
Targeting Bolt
To-hit 10+Power/25
Special N/A

How to Help

  • You can help by inserting this template into attack spell pages. Many of these pages already have the needed info. However if not, you can source dive for missing spell information. The spell damage info should be listed here, and the spell range info is listed here.

Damage Formula and Max Power

Each spell is listed [ here] in a structure with the following properties:

369 struct zap_info
370 {
371     zap_type ztype;
372     const char* name;           // Name of spell
373     int power_cap;              // Max spell power
374     dam_deducer* damage;        // Damage formula
375     tohit_deducer* tohit;       
376     int colour;
377     bool is_enchantment;
378     beam_type flavour;
379     dungeon_char_type glyph;
380     bool always_obvious;
381     bool can_beam;
382     bool is_explosion;
383     int hit_loudness;
384 };

For example, bolt of fire is listed as,

121 {
122     ZAP_FIRE,
123     "bolt of fire",
124     200,                                    // Max Power = 200
125     new calcdice_calculator<6, 18, 2, 3>,   // Damage formula = see below
126     new tohit_calculator<10, 1, 25>,
127     RED,
128     false,
129     BEAM_FIRE,
130     DCHAR_FIRED_ZAP,
131     true,
132     true,
133     false,
134     6
135 },
  • The damage formula is as follows:
 362 template<int numdice, int adder, int mult_num, int mult_denom>
 368 return calc_dice(numdice, adder + (pow * mult_num) / mult_denom);
  • So bolt of fire will have a damage formula using 6 dice to roll damage between 1 and (18+(power * 2)/3)/6
  • At 200 spell power, the max damage is equal to
   18+(200*2/3) = 151
  • This damage will be calculated with 6 dice. So the dice calculation ends up actually being:
   6d(151/6) = 6d(25)

In general the field zap_info->damage can be defined using two different functions:

  • calcdice_calculator(numdice, adder, mult_num, mult_denom). In this case the game uses numdice dice and each die has (adder + (pow * mult_num) / mult_denom) / numdice sides. The dam_type of the AttackSpell template should be set to "calcdice", and these coefficients should be assigned to the dam_xxx parameters.
  • dicedef_calculator(numdice, adder, mult_num, mult_denom). In this case the game uses numdice dice and each die has adder + (pow * mult_num) / mult_denom sides. These values should be passed as the dam_xxx parameters of the AttackSpell template. The dam_type of the AttackSpell template should be set to "dicedef", and these coefficients should be assigned to the dam_xxx parameters (important: dam_adder=adder*numdice and dam_num=mult_num*numdice).


Spell Range

  • Data on spell range is listed here. Max range is listed in the 5th field of the struct.
  • For example, Fireball has a range of 6, while Magic Dart has the range of your LOS.

Relevant Spell Pages

Target

The Target field should use one of the following entries:

  • Beam - Fires a projectile at the targeted tile which affects the first monster it strikes
  • Bolt - Fires a projectile at the targeted tile which affects all monsters it strikes until it runs out of range
  • Homing - Fires a projectile at the targeted monster which moves each turn toward its destination
  • Smite - Affects the targeted tile with perfect accuracy
  • Touch - Affects an adjacent tile with perfect accuracy
  • Self - Affects all monsters with a set radius of the caster
  • LOS - Affects all monsters you can currently see - (Move this to effect?)

Special

The Special field describes any special effects of the attack spell:

  • Cloud/AOE
  • Accuracy specifics
  • Additional status effects (confusion, poison, etc.)
  • Anything else that sets this spell apart!