From Dark and Darker Wiki

(Added front facing function to generate list of monsters for race pages)
(fix, (Race) itself shouldn't show in tables)
 
(One intermediate revision by the same user not shown)
Line 249: Line 249:
for k,v in pairs(common.races) do
for k,v in pairs(common.races) do
if wikitext ~= "" then wikitext = wikitext.."-" end
if wikitext ~= "" then wikitext = wikitext.."-" end
wikitext = wikitext.."[["..k.."]]"
wikitext = wikitext.."[["..k.." (Race)|"..k.."]]"
end
end



Latest revision as of 23:00, 31 August 2026

Overview

Functions for making Monsters table. Data comes from Data:Monster.json.

Functions

draw_table

Create's a table of monsters

Parameters

  • 1 - list key of monsters to use
  • 2 - is the list key a race?

draw_table Examples

{{#invoke:Monster|draw_table|bosses}}
Name Health Move Speed Exp
AP
Damage Reductions Abilities' Damage(Impact Power) + Statuses Statuses' Effects Race Action Speed
4100/7100400
15/20
50
Physical: -22%
Magical: 36.8%
Lightning: 50%
Spirit: -50%
Swim L: 79.8/126.0 (6) Physical
Swim R: 79.8/126.0 (6) Physical
Short Dash: 34.2/54.0 (6) Physical
Water Arrow1: 60.8/96.0 (6) Physical
Water Arrow2: 49.4/78.0 (6) Physical
Lightning Nova: 304.0/480.0 (6) Physical
Turning Water Arrow L: 60.8/96.0 (6) Physical
Turning Water Arrow R: 60.8/96.0 (6) Physical
Lightning Bubble: Lightning Bubble DmgLightning Bubble Dmg
Pop Out: 45.6/72.0 (6) Physical
Divine Judgment: 114.0/180.0 (6) Physical
Swim L1500: 79.8/126.0 (6) Physical
Swim R1500: 79.8/126.0 (6) Physical
Dash: 22.8/36.0 (4) Physical
Dash End: 22.8/36.0 (4) Physical
Turning Water Arrow2 L: 60.8/96.0 (6) Physical
Turning Water Arrow2 R: 60.8/96.0 (6) Physical
Tail Attack Down: 76.0/120.0 (5) Physical, 76.0/120.0 (5) Physical + Tail Poison
Tail Attack Up: 72.2/114.0 (5) Physical, 72.2/114.0 (5) Physical + Tail Poison
Tail Slash Down: 68.4/108.0 (5) Physical, 68.4/108.0 (5) Physical + Tail Poison
Tail Slash High: 72.2/114.0 (5) Physical, 68.4/108.0 (5) Physical + Tail Poison
Move Spawn Location Start: 22.8/36.0 (4) Physical
Rush: 64.6/102.0 (4) Physical
Rush Lightning: 34.2/54.0 Physical
Rush Falling Rock: 24.0 Physical
Lightning Bubble Dmg: 7 Magical Damage
Tail Poison: 20 Magical Damage over 30s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Ref]Refresh: Resets on Successful Application
Beast-Aquatic-12%/0%
1600/2300250/300
15
50
Physical: [3%]0 Armor Rating and 25% Other Physical
Magical: 7.8%
Fire: 50%
Ice: 50%
Light: -100%
Spirit: -100%
Projectile: -25%
Fog Attack1: 25.2/33.6 (6) Magical
Fog Attack2: 79.2/105.6 (7) Magical
Pull: 54.0/72.0 (6) Magical
Hide Attack: 64.8/86.4 (7) Magical
Fog Rush: 57.6/76.8 (7) Magical
Scream Sentence: 10.8/14.4 (6) Magical
Bombing Spawn Fog Missile: 25.2/33.6 (6) Magical
Undead-Ghost0%
2700/3600260/280
15/20
50
Physical: -22%
Magical: 7.8%
Fire: 50%
Spirit: -20%
Projectile: 30%
Slash L: 81.9/104.0 (7) Physical
Slash R: 81.9/104.0 (7) Physical
Slash High: 88.2/112.0 (7) Physical
Slash High Short: 88.2/112.0 (7) Physical
Slash Low: 88.2/112.0 (7) Physical
Blade Down: 69.3/88.0 (2) Physical
Blade Down Short: 69.3/88.0 (2) Physical
Blade Slash: 69.3/88.0 (2) Physical
Blade Slash Short: 69.3/88.0 (2) Physical
Blade Vertical Slash: 69.3/88.0 (2) Physical
Upper Slash: 81.9/104.0 (7) Physical
Upper Slash Cannon: 81.9/104.0 (7) Physical
Thrust: 88.2/112.0 (7) Physical
Attack Overhead Slash: 63.0/80.0 (7) Physical, 44.1/56.0 (7) Physical
Rush Slash High: 88.2/112.0 (7) Physical
Rush Slash Low: 88.2/112.0 (7) Physical
Rush End: 88.2/112.0 (7) Physical
Rush Attack: 88.2/112.0 (7) Physical
Attack Down Slash: 81.9/104.0 (7) Physical
Cannon Fire: 100.8/128.0 (7) Physical
Cannon Fire Long: 100.8/128.0 (7) Physical
Attack Fire Sparks In: 100.8/128.0 (7) Physical
Attack Fire Sparks Out: 100.8/128.0 (7) Physical
Ballista Falling: 100.8/128.0 (7) Physical
Ballista Shockwave: 50.4/64.0 (7) Physical
Reflect Melee: 94.5/120.0 (7) Physical
Human-Humanoid10%/15%
2975/3965/4500250/280/300
12/15/18
50
Physical: -22%
Magical: 7.8%
Fire: 50%
Earth: -100%
Dark: -200%
Evil: 50%
Projectile: 40%
Regeneration: Regeneration
Combo Left To Right: 150.0/165.0/180.0 (7) Physical + Slow
Combo Right To Left: 110.0/121.0/132.0 (7) Physical + Slow
Combo Head Up: 180.0/198.0/216.0 (7) Physical + Slow
Attack Ground: 100.0/110.0/120.0 (7) Physical, 70.0/77.0/84.0 (7) Physical Radius + Slow
Attack Spinning High: 200.0/220.0/240.0 (7) Physical + Slow
Attack Spinning Low: 200.0/220.0/240.0 (7) Physical + Slow
Debuff Shouting: Slow
Add Impact Power:  (999)
Combo Slap: 145.0/159.5/174.0 (7) Physical, 20.0/22.0/24.0 (7) Physical Radius + Slow
Attack Punch Down: 80.0/88.0/96.0 (7) Physical, 17.0/18.7/20.4 (7) Physical Radius + Slow
Combo Punch Down: 80.0/88.0/96.0 (7) Physical, 17.0/18.7/20.4 (7) Physical Radius + Slow
Attack Ground Combo: 100.0/110.0/120.0 (7) Physical, 70.0/77.0/84.0 (7) Physical Radius + Slow
Regeneration: 2 Physical Heal per 1s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1
Slow: -35% Move Speed for 4s [Rmv]Removable
Troll-Humanoid-Beast0%
4236/6293250/280
12/15
50
Physical: -22%
Magical: 7.8%
Fire: 50%
Light: -200%
Dark: -25%
Evil: 50%
Projectile: 30%
Combo1: 96.8/116.6 (7) Physical
Combo2: 140.8/169.6 (7) Physical
Combo3: 132.0/159.0 (7) Physical + Blinker
Run And Swing: 88.0/106.0 (7) Physical
Riot: 158.4/190.8 (7) Physical
Spawn Falling Rock: 17.6/21.2 (4) Physical
Stomp: 193.6/233.2 (7) Physical + Slow
Sprinkle Soil: 149.6/180.2 (7) Physical + Blinker
Petrification: Petrification
Blinker: Blinded by dirt for 10s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Slow: -50% Move Speed for 8s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Petrification: Unable to Move, Unable to Attack for 6s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Humanoid-Cyclops-Beast-20%
5000/6600300/320
15/20
50
Physical: -22%
Magical: 7.8%
Fire: 70%
Ice: -35%
Light: -50%
Dark: 50%
Divine: -100%
Projectile: 30%
Melee Horizontal Slash: 93.0/99.0 (7) Physical
Melee Reverse Slash: 93.0/99.0 (7) Physical
Melee Overhead Slam: 111.6/118.8 (7) Physical
Melee Wing Dive Slash: 105.4/112.2 (7) Physical
Melee Wing Dive Slash Long: 105.4/112.2 (7) Physical
Melee Wing Dive Sweep: 105.4/112.2 (7) Physical + Fire Burn Dmg
Melee Wing Dive Sweep Long: 105.4/112.2 (7) Physical + Fire Burn Dmg
Melee Quick Stab: 86.8/92.4 (7) Physical
Melee Flame Slam: 80.6/85.8 (7) Physical + Fire Burn DmgSlow
Melee Flame Breath: 40 (7) Magical + Fire Burn Dmg
Action Flame Push: 93.0/99.0 (7) Physical + Fire Burn Dmg
Action Wing Flap Turn: 74.4/79.2 (7) Physical
Melee Double Overhead: 124.0/132.0 (7) Physical
Melee Low Sweep: 99.2/105.6 (7) Physical
Action Flame Explosion: 99.2/105.6 (7) Physical + Fire Burn Dmg
Base Spawn Flame Wave: Flame Wave Dmg
Range Flame Toss: 80.6/85.8 (7) Physical + Fire Burn Dmg
Fire Burn Dmg: 15 Magical Damage over 5s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Slow: -20% Move Speed for 2s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Flame Wave Dmg: 13 Magical Damage [0.3s]Tick interval: 0.3s[AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1
Demon-Human-Humanoid0%/10%
5590/7840230/240
15/20
50
Physical: -22%
Magical: 7.8%
Fire: 90%
Ice: -70%
Lightning: 20%
Spirit: -20%
Projectile: 30%
Melee Face Down Slam Front: 110.5/119.0 (7) Physical, 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Face Down Slam Back: 110.5/119.0 (7) Physical, 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Face Down Slam Left: 110.5/119.0 (7) Physical, 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Face Down Slam Right: 110.5/119.0 (7) Physical, 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Right Hand Forward Swing: 84.5/91.0 (7) Physical
Melee Right Hand Forward Swing Phase2: 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Right Hand Cross Swing: 104.0/112.0 (7) Physical
Melee Right Hand Cross Swing Phase2: 104.0/112.0 (7) Physical + Lava Burn Dmg
Melee Looking Right Swing60: 84.5/91.0 (7) Physical
Melee Looking Right Swing60 Phase2: 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Looking Right Swing120: 84.5/91.0 (7) Physical
Melee Looking Right Swing120 Phase2: 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Looking Right Swing180: 84.5/91.0 (7) Physical
Melee Looking Right Swing180 Phase2: 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Looking Left Swing60: 84.5/91.0 (7) Physical
Melee Looking Left Swing60 Phase2: 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Looking Left Swing120: 84.5/91.0 (7) Physical
Melee Looking Left Swing120 Phase2: 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Looking Left Swing180: 84.5/91.0 (7) Physical
Melee Looking Left Swing180 Phase2: 84.5/91.0 (7) Physical + Lava Burn Dmg
Melee Right Foot Stomping: 162.5/175.0 (7) Physical, 110.5/119.0 (7) Physical + Lava Burn Dmg
Melee Two Hands Ground Strike: 130.0/140.0 (7) Physical, 117.0/126.0 (7) Physical + Lava Burn Dmg
Action Lava Eruption: 39.0/42.0 (7) Physical + Lava Burn Dmg
Base Ground Explosion: 65.0/70.0 (7) Physical + Lava Burn Dmg
Action Seismic Wave: 52.0/56.0 (7) Physical
Action Fury Of Magma: 26.0/28.0 (7) Physical + Lava Burn Dmg
Lava Explosion: 39.0/42.0 (7) Physical + Lava Burn Dmg
Lava Burn Dmg: 25 Magical Damage over 5s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]RemovableGolem-Elemental-Construct-Spirit0%/10%
3600/7100500
20/25
125
Physical: -22%
Magical: 36.8%
Fire: -25%
Ice: 50%
Dark: -25%
Air: -200%
Projectile: 50%
Combo Tail Attack1: 57.0/90.0 (6) Physical + Melee Attack Slow
Combo Tail Attack2: 68.4/108.0 (7) Physical + Melee Attack Slow
Combo Forward Attack L: 60.8/96.0 (7) Physical + Melee Attack Slow
Combo Forward Attack R: 60.8/96.0 (7) Physical + Melee Attack Slow
Combo Two Hand Attack: 76.0/120.0 (7) Physical + Melee Attack Slow
Combo Breath Ground: 60.8/96.0 (7) Physical, 45.6/72.0 (6) Physical Radius
Combo Breath Air: 60.8/96.0 (7) Physical, 45.6/72.0 (6) Physical Radius
Combo Leap Attack1: 53.2/84.0 (7) Physical + Melee Attack Slow
Combo Leap Attack2: 60.8/96.0 (7) Physical, 45.6/72.0 (6) Physical Radius
Combo Leap Attack3: 83.6/132.0 (7) Physical + Melee Attack Slow
Special Breath Air To Side: 60.8/96.0 (7) Physical, 45.6/72.0 (6) Physical Radius
Special Leap Attack1 To Center: 53.2/84.0 (7) Physical
Special Leap Attack3 To Center: 83.6/132.0 (7) Physical + Melee Attack Slow
Special Summon Elemental: Frost Shield To Elemental
Special Pushing:  (999)
Special Breath Ground: Extreme Cold DmgExtreme Cold SlowFrost Shield To Breath
Special Breath Air: Extreme Cold DmgExtreme Cold Slow
Buff Movespeed: 1000 Move Speed
Buff Movespeed Special: 2500 Move Speed
Melee Attack Slow: -15% Action Speed for 11s [AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes Duration
Frost Shield To Elemental: Immune to Damage
Extreme Cold Dmg: 50 Physical Damage, 50 Magical Damage over 2s/100 Physical Damage, 100 Magical Damage over 2s [0.2s]Tick interval: 0.2s[AgT]Stacking Type: Aggregates by Target[Rmv]Removable[1x]Maximum Stacks: 1
Extreme Cold Slow: -20% Move Speed, -20% Action Speed for 8s [AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes Duration
Frost Shield To Breath: Immune to Damage
Dragon-Wyvern-Beast0%
2641/3631200/270
15/20
100
Physical: -22%
Magical: 36.8%
Divine: -100%
Evil: 50%
Projectile: 25%
Curse Of Chilling: Curse Of Chilling
Normal Attack: 30 (7) Magical + Curse Of Chilling
Normal Attack Return: Curse Of Chilling
Eating Apply And Remove Shield: Eating Shield
Eating Snare: Eating
Teleport: 20 (5) Magical + Curse Of Chilling
Scream: -45% (4) True Max Health + Curse Of Chilling
Earth Quake: 120.0/60.0 (6) Physical/Magical + Curse Of Chilling
Curse Of Chilling: -1.6% Move Speed for 8s [AgT]Stacking Type: Aggregates by Target[30x]Maximum Stacks: 30[Rmv]Removable
Eating Shield: 1000 Shield [AgT]Stacking Type: Aggregates by Target
Eating: -95% Max Health, Unable to Move over 15s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Ref]Refresh: Resets on Successful Application
Undead-Ghost0%
2100/3000200/250
15/20
100
Physical: -22%
Magical: 36.8%
Divine: -25%
Evil: 50%
Projectile: 25%
Close Attack: 70 (5) Magical
Normal Attack: 100 (5) Magical
Strong Attack: 200 (7) Magical
Curse Of Gathering Mark: -50% (4) True Max Health-15% (4) True Max Health-95% (4) True Max Health-5% (4) True Max Health-2% (4) True Max Health + CoG Heal1CoG Heal2CoG Heal3CoG Heal4CoG Heal5
Curse Of Isolation Mark: -70% (4) True Max Health-90% (4) True Max Health-50% (4) True Max Health-150% (4) True Max Health-250% (4) True Max Health + CoI Heal1CoI Heal2CoI Heal3CoI Heal4CoI Heal5
Getting Soul: Soul Shield
Frenzy: Death SwarmFrenzy
CoG Heal1: 65% Max Health over 20s [Rmv]Removable
CoG Heal2: 35% Max Health over 20s [Rmv]Removable
CoG Heal3: 10% Max Health over 20s [Rmv]Removable
CoG Heal4: 4% Max Health over 20s [Rmv]Removable
CoG Heal5: 2% Max Health over 20s [Rmv]Removable
CoI Heal1: 35% Max Health over 20s [Rmv]Removable
CoI Heal2: 50% Max Health over 20s [Rmv]Removable
CoI Heal3: 60% Max Health over 20s [Rmv]Removable
CoI Heal4: 100% Max Health over 20s [Rmv]Removable
CoI Heal5: 170% Max Health over 20s [Rmv]Removable
Soul Shield: 250 Shield [AgT]Stacking Type: Aggregates by Target[Rmv]Removable
Death Swarm: 4 True Magical Damage [AgT]Stacking Type: Aggregates by Target[5x]Maximum Stacks: 5[Ref]Refresh: Resets on Successful Application
Frenzy: 25 Move Speed, 50% Action Speed [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1
Undead-Lich0%
6220/7858400
15/20
50
Physical: -22%
Magical: 7.8%
Fire: 80%
Ice: -60%
Earth: 30%
Air: 20%
Projectile: 30%
Action Dodge Left: 49.2/58.8 (7) Physical + Fire Burn Dmg
Action Dodge Right: 49.2/58.8 (7) Physical + Fire Burn Dmg
Melee Tail Swipe Left: 123.0/147.0 (7) Physical
Melee Tail Swipe Right: 123.0/147.0 (7) Physical
Melee Wing Bash Left: 139.4/166.6 (7) Physical, 90.2/107.8 (7) Physical
Melee Wing Bash Right: 139.4/166.6 (7) Physical, 90.2/107.8 (7) Physical
Melee Bite Snap Forward: 164.0/196.0 (7) Physical
Melee Bite Snap Left: 164.0/196.0 (7) Physical
Melee Bite Snap Right: 164.0/196.0 (7) Physical
Melee Charge Rush: 98.4/117.6 (7) Physical
Action Fire Breath: 39.4/47.0 (7) Physical + Fire Burn Dmg
Action Sweeping Breath: 72.2/86.2 (7) Physical + Fire Burn Dmg
Action Turn Breath Right90: 59.0/70.6 (7) Physical + Fire Burn Dmg
Action Turn Breath Right180: 59.0/70.6 (7) Physical + Fire Burn Dmg
Action Turn Breath Left90: 59.0/70.6 (7) Physical + Fire Burn Dmg
Action Turn Breath Left180: 59.0/70.6 (7) Physical + Fire Burn Dmg
Action Fire Bomb Spread: 139.4/166.6 (7) Physical, 49.2/58.8 (7) Physical, 9.8/11.8 (7) Physical + Fire Burn Dmg
Action Leap Slam: 155.8/186.2 (7) Physical, 90.2/107.8 (7) Physical + Fire Burn Dmg
Action Flame Stomp Left: 114.8/137.2 (7) Physical
Action Flame Stomp Right: 114.8/137.2 (7) Physical
Action Fly Breath90: 118.1/141.1 (7) Physical + Fire Burn Dmg
Action Fly Breath180: 118.1/141.1 (7) Physical + Fire Burn Dmg
Action Fly Breath270: 118.1/141.1 (7) Physical + Fire Burn Dmg
Action Inferno Roar: 131.2/156.8 (7) Physical + Fire Burn Dmg
Action Hover Breath Left: 39.4/47.0 (7) Physical + Fire Burn Dmg
Action Hover Breath Right: 39.4/47.0 (7) Physical + Fire Burn Dmg
Action Leap Breath Left: 39.4/47.0 (7) Physical + Fire Burn Dmg
Action Leap Breath Right: 39.4/47.0 (7) Physical + Fire Burn Dmg
Fire Burn Dmg: 40 Magical Damage over 6s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]RemovableDragon-Wyvern-Beast10%/20%
218180
0
1
Physical: -22%
Magical: -17.2%
Fire: -250%
Earth: -300%
Divine: -200%
Evil: 25%
Projectile: 15%
Attack: 43.2 (3) Physical
Back Step: 67.5 (4) Physical
Bombing: 108.0 (5) Physical
Soul Pass: Skeleton Warlord Speed Up
Throwing Knife: 43.2 (3) Physical
Skeleton Warlord Speed Up: 4% Move Speed, 1% Action Speed, 2% Physical Resistance, 1% Magical Resistance [AgT]Stacking Type: Aggregates by Target[25x]Maximum Stacks: 25Undead-Skeleton0%
?100
0
0
Physical: -22%
Magical: 7.8%
Projectile: 15%
Beam Attack: 6.0 (7) Magical0%
2944/4344250/280
15/20
100
Physical: -22%
Magical: 36.8%
Earth: -100%
Evil: 50%
Projectile: 25%
Combo1: 48.0/72.0 (7) Magical
Combo2: 57.6/86.4 (7) Magical
Combo3: 70.4/105.6 (7) Magical
Combo4: 60.8/91.2 (7) Magical
Combo5: 60.8/91.2 (7) Magical
Throwing Knives: 60.8/91.2 (7) Magical + Paralyze
Throwing Knives2: 25.6/38.4 (3) Magical + Paralyze
Shield: Shield
Explosion: 384.0 Magical
Attack Block Explosion Dmg: 48.0 Magical
Paralyze: -15% Move Speed for 15s [AgT]Stacking Type: Aggregates by Target[5x]Maximum Stacks: 5[Rmv]Removable
Shield: Immune to Damage [Inf]Duration: Infinite
Undead-Skeleton0%
2500/3300320/360
12/15
50
Physical: -22%
Magical: 7.8%
Dark: -100%
Spirit: -100%
Projectile: 30%
Attack Slash11: 75.6/96.0 (6) Physical
Attack Slash12: 75.6/96.0 (6) Physical
Attack Shoulder Charge: 44.1/56.0 (6) Physical
Attack Front Slash: 94.5/120.0 (7) Physical
Attack Front Thrust: 81.9/104.0 (6) Physical
Attack Rush Thrust: 107.1/136.0 (7) Physical
Attack Rush Thrust For Soul Slash: 107.1/136.0 (7) Physical
Attack Long Range Transverse: 100.8/128.0 (7) Physical
Attack Long Range Vertically: 100.8/128.0 (7) Physical
Attack Soul Shockwave: 138.6/176.0 (7) Physical + Dead Rift DmgDead Rift Move Slow
Attack Soul Slash Up: 201.6/256.0 (7) Physical
Attack Soul Slash Down: 201.6/256.0 (7) Physical
Debuff Move Speed: -70 Move Speed
Dead Rift Dmg: 5 Magical Damage [0.3s]Tick interval: 0.3s[AgT]Stacking Type: Aggregates by Target[Rmv]Removable[1x]Maximum Stacks: 1
Dead Rift Move Slow: -30% Move Speed [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Undead-Ghost0%/10%



{{#invoke:Monster|draw_table|Demon|true}}
Name Health Move Speed Exp
AP
Damage Reductions Abilities' Damage(Impact Power) + Statuses Statuses' Effects Race Action Speed
750/950/1150200/220/250
8/9/10
50
Physical: -22%
Magical: 36.8%
Fire: 25%
Ice: -300%
Light: -200%
Dark: 50%
Divine: -200%
Evil: 50%
Projectile: 20%
Attack1 Heavy Swing Up: 45.0/49.5/54.0 (6) Physical
Attack2 Heavy Swing Down: 45.0/49.5/54.0 (6) Physical
Attack3 Greedy Rush: 60.0/66.0/72.0 (6) Physical
Attack4 Blood Vomiting: 12.0/13.2/14.4 (3) Physical, 6.0/6.6/7.2 (3) Physical Radius + Vomiting Blinker
Attack5 Destruction: 48.0/52.8/57.6 (6) Physical
Vomiting Blinker: Blinded by dirt for 7s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]RemovableAberration-Demon0%/10%/20%
700/850/1050200/225/250
8/9/10
50
Physical: -22%
Magical: 36.8%
Fire: 25%
Ice: -300%
Light: -200%
Dark: 50%
Divine: -200%
Evil: 50%
Projectile: 20%
Bite R: 50.4/55.8/63.0 (6) Physical
Bite L: 50.4/55.8/63.0 (6) Physical
Hit Down: 70.0/77.5/87.5 (6) Physical
Rush R: 67.2/74.4/84.0 (6) Physical
Rush L: 67.2/74.4/84.0 (6) Physical
Demon-Beast-Mammal0%/10%/20%
170/220/280250/290/340
4/5/6
2/3/4
Physical: -22%
Magical: -17.2%
Ice: -300%
Light: -300%
Divine: -200%
Evil: 25%
Air: -400%
Projectile: -25%
Attack: 27.0/36.0/54.0 (4) Physical + SlowSlow: -40% Move Speed for 4s [Rmv]RemovableDemon-Beast-Mammal0%/10%/40%
700/850/1050200/260/320
8/9/10
50
Physical: -22%
Magical: 7.8%
Fire: 25%
Ice: -300%
Light: -200%
Dark: 50%
Divine: -200%
Evil: 50%
Projectile: 15%
Attack1: 36.8/48.0/59.2 (6) Physical
Attack2: 36.8/48.0/59.2 (6) Physical
Demon-10%
700/900/1100200/230/260
8/9/10
50
Physical: -22%
Magical: 36.8%
Fire: 25%
Ice: -300%
Light: -200%
Dark: 50%
Divine: -200%
Evil: 50%
Projectile: 20%
Attack1: 42.0/52.5/63.0 (6) Physical
Attack2: 50.4/63.0/75.6 (6) Physical
Sprint Phase: 150 Move Speed
Sprint Attack: 61.6/77.0/92.4 (7) Physical
Sprint Attack Pierce: 44.8/56.0/67.2 (6) Physical
Attack Low Sweep: 50.4/63.0/75.6 (6) Physical
Demon-Beast-Mammal0%/10%/15%
160/210/265350
4/5/6
2/3/4
Physical: -22%
Magical: -17.2%
Ice: -300%
Light: -300%
Divine: -200%
Evil: 25%
Projectile: 15%
Attack: 24.0/33.0/42.0 (4) Physical
Dash Attack: 35.2/48.4/61.6 (5) Physical
Return Dmg: 20 True Physical
Demon-Beast-Mammal0%/10%/20%
700/900/1100100/125/150
8/9/10
25
Physical: -22%
Magical: -17.2%
Fire: 50%
Ice: -300%
Lightning: -200%
Projectile: -25%
Melee Attack01: 42.0/51.0/57.0 (7) Physical
Melee Attack02: 42.0/51.0/57.0 (7) Physical
Melee Attack01 Combo: 42.0/51.0/57.0 (7) Physical
Melee Attack02 Combo: 42.0/51.0/57.0 (7) Physical
Melee Attack02 Combo02: 47.6/57.8/64.6 (7) Physical
Rush Attack: 47.6/57.8/64.6 (7) Physical
Melee Attack02 High Homing: 42.0/51.0/57.0 (7) Physical
Demon0%/0%/5%
140/190/24070/90/110
3/4/5
1/2/3
Physical: -22%
Magical: -17.2%
Ice: -300%
Light: -300%
Divine: -200%
Evil: 25%
Projectile: 15%
Casting Heal: HealHeal: 5% Max Health/5% Max Health/10% Max Health Demon0%/5%/10%
5000/6600300/320
15/20
50
Physical: -22%
Magical: 7.8%
Fire: 70%
Ice: -35%
Light: -50%
Dark: 50%
Divine: -100%
Projectile: 30%
Melee Horizontal Slash: 93.0/99.0 (7) Physical
Melee Reverse Slash: 93.0/99.0 (7) Physical
Melee Overhead Slam: 111.6/118.8 (7) Physical
Melee Wing Dive Slash: 105.4/112.2 (7) Physical
Melee Wing Dive Slash Long: 105.4/112.2 (7) Physical
Melee Wing Dive Sweep: 105.4/112.2 (7) Physical + Fire Burn Dmg
Melee Wing Dive Sweep Long: 105.4/112.2 (7) Physical + Fire Burn Dmg
Melee Quick Stab: 86.8/92.4 (7) Physical
Melee Flame Slam: 80.6/85.8 (7) Physical + Fire Burn DmgSlow
Melee Flame Breath: 40 (7) Magical + Fire Burn Dmg
Action Flame Push: 93.0/99.0 (7) Physical + Fire Burn Dmg
Action Wing Flap Turn: 74.4/79.2 (7) Physical
Melee Double Overhead: 124.0/132.0 (7) Physical
Melee Low Sweep: 99.2/105.6 (7) Physical
Action Flame Explosion: 99.2/105.6 (7) Physical + Fire Burn Dmg
Base Spawn Flame Wave: Flame Wave Dmg
Range Flame Toss: 80.6/85.8 (7) Physical + Fire Burn Dmg
Fire Burn Dmg: 15 Magical Damage over 5s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Slow: -20% Move Speed for 2s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Flame Wave Dmg: 13 Magical Damage [0.3s]Tick interval: 0.3s[AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1
Demon-Human-Humanoid0%/10%
50/80/110200
3/4/5
1/2/3
Physical: -22%
Magical: -17.2%
Fire: 25%
Ice: 25%
Lightning: 25%
Dark: 25%
Arcane: -300%
Spirit: -400%
Projectile: 15%
Attack: 21.0/25.2/33.6 (4) Physical
Attack Combo: 24.0/28.8/38.4 (4) Physical
Demon0%/5%/10%
120/150/220100/125/150
3/4/5
1/2/3
Physical: -22%
Magical: -17.2%
Fire: 50%
Ice: -200%
Lightning: -200%
Light: -200%
Arcane: -200%
Divine: -150%
Air: -400%
Projectile: -25%
Demon Fly Self Destruction: 25.5/30.0/34.5 Physical + Demon Fly Poison SlowDemon Fly Poison Dmg
Demon Fly Self Destruction2: 25.5/30.0/34.5 Physical + Demon Fly Poison SlowDemon Fly Poison Dmg
Demon Fly Run State: 200 Move Speed
Demon Fly Poison Powder: Demon Fly Poison Powder Dmg
Demon Fly Poison Slow: -30% Move Speed for 5s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Demon Fly Poison Dmg: 30 Physical Damage over 5s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable[Ref]Refresh: Resets on Successful Application
Demon Fly Poison Powder Dmg: 6 Physical Damage [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[0.5s]Tick interval: 0.5s[Ref]Refresh: Resets on Successful Application[Rmv]Removable
Demon-Beast-Insectoid0%/5%/10%
130/190/250160/180/200
3/4/5
1/2/3
Physical: -22%
Magical: -17.2%
Fire: 25%
Ice: 25%
Lightning: 25%
Dark: 25%
Arcane: -300%
Spirit: -400%
Projectile: 15%
Melee Attack01: 32.4/41.4/50.4 (4) Physical
Melee Attack02: 36.0/46.0/56.0 (4) Physical
Fiendling-Demon0%/5%/10%
130/190/250160/180/200
3/4/5
1/2/3
Physical: -22%
Magical: -17.2%
Fire: 25%
Ice: 25%
Lightning: 25%
Dark: 25%
Arcane: -300%
Spirit: -400%
Projectile: 15%
Melee Attack01: 34.2/43.7/53.2 (4) Physical
Melee Attack02: 34.2/43.7/53.2 (4) Physical
Melee Attack03: 30.6/39.1/47.6 (4) Physical
Fiendling-Demon0%/5%/10%
130/190/250160/180/200
3/4/5
1/2/3
Physical: -22%
Magical: -17.2%
Fire: 25%
Ice: 25%
Lightning: 25%
Dark: 25%
Arcane: -300%
Spirit: -400%
Projectile: 15%
Melee Attack01: 32.4/41.4/50.4 (4) Physical
Melee Attack02: 32.4/41.4/50.4 (4) Physical
Melee Attack03: 30.6/39.1/47.6 (4) Physical
Fiendling-Demon0%/5%/10%
650/750/95075/120/150
6/7/8
50
Physical: -22%
Magical: 36.8%
Fire: -200%
Ice: 50%
Light: -200%
Divine: -200%
Evil: 25%
Projectile: 20%
Attack01: 34.5/40.5/49.5 (3) Magical + Frostbite
Blizzard Fire Spell: 20.7/24.3/29.7 (3) Magical + Frostbite
Self Heal: Self Heal
Run State: 100 Move Speed
Frostbite: -1% Move Speed, -3% Action Speed for 6s [AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes Duration
Self Heal: 10% Max Health
Demon0%/0%/20%
200/250/300100/150/200
3/3/5
2/3/4
Physical: -22%
Magical: -17.2%
Fire: -300%
Ice: 50%
Divine: -200%
Projectile: 15%
Attack: 31.5/39.0/52.5 (3) Physical + FrostbiteFreezing
Frost Wave: 35.0 Physical + Frostbite
Run State: 150 Move Speed
Frostbite: -1% Move Speed, -3% Action Speed for 6s [AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes Duration
Freezing: Unable to Move, Unable to Attack for 1s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Demon0%
400100
7
15
Physical: -22%
Magical: -17.2%
Fire: -300%
Ice: 50%
Divine: -200%
Projectile: 15%
Frost Imp Attack: 31.5 (3) Physical + Frostbite, Frost Imp Freezing
Frost Imp Run State: 150 Move Speed
Frostbite: -1% Move Speed, -3% Action Speed for 6s [AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes Duration
Frost Imp Freezing: Unable to Move, Unable to Attack for 1s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable
Demon0%
700/900/1100100/125/150
8/9/10
25
Physical: -22%
Magical: -17.2%
Fire: 50%
Ice: -300%
Lightning: -200%
Projectile: -25%
Attack1: 30.8/37.4/41.8 (7) Physical
Attack1 Combo: 36.4/44.2/49.4 (7) Physical
Attack2: 33.6/40.8/45.6 (7) Physical
Attack2 Combo: 28.0/34.0/38.0 (7) Physical + Paralysis
Attack3 Start: 60.8 Physical
Attack3 End: 60.8 Physical
Attack4: 28.0/34.0/38.0 (7) Physical + Paralysis
Paralysis: -20% Move Speed for 4s [AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Ref]Refresh: NeverResetDemon0%/0%/5%
110/130/16070
1/2/3
1/2/3
Physical: -22%
Magical: -17.2%
Fire: 50%
Ice: -200%
Lightning: -200%
Light: -200%
Arcane: -200%
Divine: -150%
Air: -400%
Projectile: -25%
Attack: 10.0/12.0/14.0 Physical + BleedingBleeding: 4 Physical Damage over 5s [AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes Duration/[AgT]Stacking Type: Aggregates by Target[1x]Maximum Stacks: 1[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes Duration/[AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes DurationWorm-Insectoid-Beast-Demon0%
240/320/320100/150/200
3/4/5
2/3/4
Physical: -22%
Magical: -17.2%
Fire: -200%
Ice: 50%
Projectile: 15%
Attack01: 35.2/43.2/56.0 (3) Physical + Frostbite
Attack01 Combo: 33.0/40.5/52.5 (3) Physical + Frostbite
Attack02: 28.6/35.1/45.5 (3) Physical + Frostbite
Attack03: 52.5 Physical
Frostbite: -1% Move Speed, -3% Action Speed for 6s [AgT]Stacking Type: Aggregates by Target[3x]Maximum Stacks: 3[Rmv]Removable[Exp]Expiration: Removes Single Stack and Refreshes DurationDemon-Beast-Mammal0%/0%/20%

Code


local p = {}
local MD = mw.loadJsonData("Data:Monster.json")
local insert = table.insert
local concat = table.concat
local suppressed_color = "#1A91C4"
local neutral_color = "#EEE8"

---Check existence and equality of common and elite and nightmare variants
---@param common any
---@param elite any
---@param nightmare any
---@return boolean
local function is_suppressed(common, elite, nightmare)
	if common and common == elite then
		if nightmare then
			if elite == nightmare then
				return true
			end
		else
			return true
		end
	end
	return false
end


---Create css/html wikitext for iconbox
---@param name string
---@return string
local function iconbox(name)
	return "<div class='iconbox'><div class='rarity-1 rounded relative'>[[File:"..name..".png|x80px|link="..name.."]]</div><br>[["..name.."|<b class=rarity-1>"..name.."</b>]]</div>"
end


---Create color coded string for common/elite/nightmare variants, if they exist.
---- If more than one variant exists, and they are all the same, color code as suppressed.
---- If only one variant exists, just return that variant with appopriate rarity color coding.
---@param common any
---@param elite any
---@param nightmare any
---@param unit any
---@return string
local function variant_coloring(common, elite, nightmare, unit)
	unit = unit or ""

	if is_suppressed(common, elite, nightmare) then
		return "<span style='color:"..suppressed_color.."'>"..tostring(common)..unit.."</span>"
	end

	local wikitext = ""
	if common then
		wikitext = tostring(common)..unit
	end
	if elite then
		if wikitext ~= "" then wikitext = wikitext.."/" end
		wikitext = wikitext.."<span class='colorrarityElite'>"..tostring(elite)..unit.."</span>"
	end
	if nightmare then
		if wikitext ~= "" then wikitext = wikitext.."/" end
		wikitext = wikitext.."<span class='colorrarityNightmare'>"..tostring(nightmare)..unit.."</span>"
	end
	return wikitext
end


---Create tooltip wikitext
---@param color string
---@param display_text string
---@param tooltip_text string
---@return string
local function tooltip(color, display_text, tooltip_text)
	if color == "" or color == nil then color = " style='color:"..color.."'" end
	return "<span class='tooltip'"..color.."><u>["..tostring(display_text).."]</u><span class='tooltiptext-right'>"..tooltip_text.."</span></span>"
end


---Create color coded string of damage reductions
---- Assumes policy text is invariant
---@param common table
---@param elite table
---@param nightmare table
--- @return string
local function damage_reductions(common, elite, nightmare)
	local wikitext = ""
	for i, key in ipairs(common.damageReductions.order) do
		if wikitext ~= "" then wikitext = wikitext.."<br>" end

		-- color the key and strip suffixes for brevity
		wikitext = wikitext.."<span style='color:"..neutral_color.."'>"..key..": </span>"

		-- Asterisk indicates presence of policy text, which needs a tooltip.
		local v = common.damageReductions and common.damageReductions[key]
		if tostring(v):find("*") then
			local color = ""
			if is_suppressed(v, elite.damageReductions and elite.damageReductions[key], nightmare.damageReductions and nightmare.damageReductions[key]) then
				color = " style='color:"..suppressed_color.."'"
			end
			wikitext = wikitext
				..tooltip(
					color,
					variant_coloring(
						tostring(v):match("^(.*)%*"),
						tostring(elite.damageReductions and elite.damageReductions[key]):match("^(.*)%*"),
						tostring(nightmare.damageReductions and nightmare.damageReductions[key]):match("^(.*)%*"),"%"
					),
					tostring(v):match("%*(.*)$")
				)
		else
			wikitext = wikitext
				..variant_coloring(
					v,
					elite.damageReductions and elite.damageReductions[key],
					nightmare.damageReductions and nightmare.damageReductions[key],"%"
				)
		end
	end
	return wikitext
end


---Convert a string of policy keys into tooltipped wikitext
---@param policies table
---@return string
local function policy_tooltips(policies)
	if policies == "" or policies == nil then return "" end

	local wikitext = ""
	for _,policy in pairs(policies) do
		wikitext = wikitext
			..tooltip(
				"",
				MD.policies[policy],
				policy
			)
	end
	return wikitext
end


local function statuses(common, elite, nightmare, highest_variant)
	local wikitext = ""
	for i,status in ipairs(highest_variant.statuses) do
		if wikitext ~= "" then wikitext = wikitext.."<br>" end
		wikitext = wikitext.."<span style='color:"..neutral_color.."'>"..status.name..":&nbsp;</span>"
			..variant_coloring(
				common.statuses and common.statuses[i] and common.statuses[i].text,
				elite.statuses and elite.statuses[i] and elite.statuses[i].text,
				nightmare.statuses and nightmare.statuses[i] and nightmare.statuses[i].text
			).." "
			..variant_coloring(
				common.statuses and common.statuses[i] and policy_tooltips(common.statuses[i].policies),
				elite.statuses and elite.statuses[i] and policy_tooltips(elite.statuses[i].policies),
				nightmare.statuses and nightmare.statuses[i] and policy_tooltips(nightmare.statuses[i].policies)
			)
	end
	return wikitext
end


---Check for consistency across variants and format string of an ability's effects
---@param common table
---@param elite table
---@param nightmare table
---@return string
local function process_effect(common, elite, nightmare)
	-- check for consistency across variants
	if next(elite) and (common.impact ~= elite.impact) or (next(nightmare) and (common.impact ~= nightmare.impact)) then
		return "<span color='red'>Error: Impact power differs across variants.</span>"
	end

	local impact_string = ""
	if is_suppressed(common.impact, elite.impact, nightmare.impact) then
		impact_string = "<span style='color:"..suppressed_color.."'>("..tostring(common.impact)..") </span> "
	elseif common.impact then
		impact_string =  "("..tostring(common.impact)..") "
	end

	-- get values for each variant
	return variant_coloring(common.value, elite.value, nightmare.value)
		.." "..impact_string
		..variant_coloring(common.text, elite.text, nightmare.text)
end


--- Assumptions
---- If the variants exists, lower variants have a subset of higher variant ability set.
---- An ability, if present, has identical names across variants. Strings associated with an Ability can vary. Order of abilities matters.
---- Important ability values that vary by variant type are followed by the "#" token.
---- Statuses applied by an ability are preceded by the "$" token.
---- Impact Power of an ability is invariant.
--- @param name string
--- @param common table
--- @param elite table
--- @param nightmare table
--- @param highest_variant table
--- @return string
local function process_ability(name, common, elite, nightmare, highest_variant)
	local wikitext = ""

	if highest_variant.abilities[name].effects then
		for k,_ in pairs(highest_variant.abilities[name].effects) do
			if wikitext ~= "" then wikitext = wikitext..",&nbsp;" end
			wikitext = wikitext..process_effect(
				common.abilities and common.abilities[name] and common.abilities[name].effects and common.abilities[name].effects[k] or {},
				elite.abilities and elite.abilities[name] and elite.abilities[name].effects and elite.abilities[name].effects[k] or {},
				nightmare.abilities and nightmare.abilities[name] and nightmare.abilities[name].effects and nightmare.abilities[name].effects[k] or {})
		end
	end

	if not highest_variant.abilities[name].status_effects then
		return wikitext
	end

	if wikitext ~= "" then wikitext = wikitext.."&nbsp;+&nbsp;" end
	for k,_ in ipairs(highest_variant.abilities[name].status_effects) do
		if wikitext ~= "" and k ~= 1 then wikitext = wikitext..",&nbsp;" end
		wikitext = wikitext..variant_coloring(
			common.abilities and common.abilities[name] and common.abilities[name].status_effects and common.abilities[name].status_effects[k],
			elite.abilities and elite.abilities[name] and elite.abilities[name].status_effects and elite.abilities[name].status_effects[k],
			nightmare.abilities and nightmare.abilities[name] and nightmare.abilities[name].status_effects and nightmare.abilities[name].status_effects[k])
	end

	return wikitext
end

---Create color coded string of abilities
---@param common table
---@param elite table
---@param nightmare table
---@param highest_variant table
--- @return string
local function abilities(common, elite, nightmare, highest_variant)
	local wikitext = ""
	for i, key in ipairs(highest_variant.abilities.order) do
		if i~=1 then wikitext = wikitext.."<br>" end
		wikitext = wikitext.."<b style='color:"..neutral_color.."'>"..key..":&nbsp;</b>"
		wikitext = wikitext..process_ability(key, common, elite, nightmare, highest_variant)
	end

	return wikitext
end


---Hyphen seperated list of hyperlinked races.  Assumes all variants same races.
---@param common table
---@return string
local function races(common)
	local wikitext = ""
	for k,v in pairs(common.races) do
		if wikitext ~= "" then wikitext = wikitext.."-" end
		wikitext = wikitext.."[["..k.." (Race)|"..k.."]]"
	end

	return wikitext
end


---@return table elite
---@return table nightmare
---@return table highest_variant
local function get_monster_variants(common)
	local highest_variant = MD.monster.id[common.name]
	local elite = MD.monster.localized_name[common.name].Elite
	local nightmare = MD.monster.localized_name[common.name].Nightmare
	if MD.monster.localized_name[common.name].Nightmare then
		highest_variant = MD.monster.id[nightmare]
	elseif MD.monster.localized_name[common.name].Elite then
		highest_variant = MD.monster.id[elite]
	end
	return MD.monster.id[elite] or {}, MD.monster.id[nightmare] or {}, highest_variant
end


---Create a table row for a monster and its variants
---@param common table
---@return string
local function row(common)
	local elite, nightmare, highest_variant = get_monster_variants(common)
	return "<tr><td>"..iconbox(common.name)
		.."</td><td>"..variant_coloring(common.hp, elite.hp, nightmare.hp)
		.."</td><td>"..variant_coloring(common.move, elite.move, nightmare.move)
		--TODO the div automargin doesn't work as intended. Need to center vertically while splitting the cell in half.
		.."</td><td><div style='margin:auto; height:50%;'>"..variant_coloring(common.xp, elite.xp, nightmare.xp)
		.."</div><div style='margin:auto; height:50%;'>"..variant_coloring(common.ap, elite.ap, nightmare.ap)
		.."</td><td>"..damage_reductions(common, elite, nightmare)
		.."</td><td>"..abilities(common, elite, nightmare, highest_variant)
		.."</td><td>"..statuses(common, elite, nightmare, highest_variant)
		.."</td><td>"..races(common)
		.."</td><td>"..variant_coloring(common.actionspeed, elite.actionspeed, nightmare.actionspeed,"%").."</td></tr>"
end


--- @param frame table: frame args
---- frame.args[1] string: {"bosses", "minibosses", "mimics", "normal"} or a race list like {"Demon", "Undead", ...
---- frame.args[2] bool or string: determines if the first key is a race list
--- @return table: ordered list of monster ids
local function get_monster_list(frame)
	if frame.args.monster ~= nil then
		return {frame.args.monster}
	end
	local key = frame.args[1] ~= nil and frame.args[1] or "all"
	local is_race_list = frame.args[2] ~= nil and frame.args[2]

	if is_race_list then
		return MD.races[key]
	else
		return MD[key]
	end
end


---Create monster table wikitext
---- Test on wiki with: mw.log(p.draw_table({args={"bosses"}})) or mw.log(p.draw_table({args={"Demon","true"}}))
---@param frame table
--- @return string
function p.draw_table(frame)
	if not MD then return "<span style='color:red;'>Error: Could not load Monster data in [[Module:Monster Table]]</span>" end

	local wikitext = {}
	insert(wikitext,[=[<table cellspacing="0" class="wikitable sortable jquery-tablesorter" style="width:100%;color:#eee; background:transparent; text-align:center; vertical-align:middle;"><tr>
<th style="width:3%">Name</th>
<th style="width:3%">Health</th>
<th style="width:3%">Move Speed</th>
<th style="width:3%">Exp<br>AP</th>
<th style="width:3%">Damage Reductions</th>
<th style="width:17%">Abilities' Damage([[Impact Power]]) + Statuses</th>
<th style="width:22%">[[Statuses]]' Effects</th>
<th style="width:3%">Race</th>	
<th style="width:3%">Action&nbsp;Speed</th></tr>]=])

	local monster_list = get_monster_list(frame)
	for _, monster_key in ipairs(monster_list) do
		insert(wikitext,row(MD.monster.id[monster_key]))
	end
	insert(wikitext,"</table>")

	return concat(wikitext)
end

-- Create race page wikitext
-- Test: =p.generate_race_list{args={"Beast"}}
--- @param frame table
--- @return string
function p.generate_race_list(frame)
    if not MD then return "<span style='color:red;'>Error: Could not load Monster data in [[Module:Monster Races]]</span>" end

    -- p.draw_table needs the bool parameter as the second arg so it can draw tables based on races, but we don't need that passed in here
    -- as this call is only for showing the race list in a simple way unlike the table. We do need to set it here though since we want to call
    -- get_monster_list and get it to give us the race list
    frame.args[2] = true

    local wikitext, bosses, minibosses, monsters = {}, {}, {}, {}
    local monster_list = get_monster_list(frame)

	for _, monster_key in ipairs(monster_list) do
        local boss = MD.monster.id[monster_key].boss
        local miniboss = MD.monster.id[monster_key].miniboss

        if boss ~= nil and boss == true then
            insert(bosses, "<li>[["..monster_key.."]]</li>")
        elseif miniboss ~= nil and miniboss == true then
            insert(minibosses, "<li>[["..monster_key.."]]</li>")
        else
            insert(monsters, "<li>[["..monster_key.."]]</li>")
        end
	end

    if #bosses > 0 then
        insert(wikitext,"<h2>Bosses</h2><ul>")
        insert(wikitext, concat(bosses).."</ul>")
    end
    if #minibosses > 0 then
        insert(wikitext,"<h2>Mini Bosses</h2><ul>")
        insert(wikitext, concat(minibosses).."</ul>")
    end
    if #monsters > 0 then
        insert(wikitext,"<h2>Monsters</h2><ul>")
        insert(wikitext, concat(monsters).."</ul>")
    end
    
    return concat(wikitext)
end

return p