Table of Contents

Dread Knight Mob - Code References

Implementation Sources

This entity is defined via JSON with Lua behavior:

JSON Configuration

{
   "name"          : "DreadKnight_Name",
   "name_objective": "DreadKnight_Name_Objective",
   "description"   : "DreadKnight_Desc",
   "gender"        : "DreadKnight_Gender",
   "attackSkill"   : 17,
   "defenseSkill"  : 15,
   "dmgMin"        : 8,
   "dmgMax"        : 16,
   "dr"            : 12,
   "str"           : 17,
   "ht"            : 40,
   "exp"           : 8,
   "maxLvl"        : 15,
   "baseSpeed"     : 1,
   "attackDelay"   : 1,
   "viewDistance"  : 8,
   "walkingType"   : "NORMAL",
   "spriteDesc"    : "spritesDesc/DreadKnight.json",
   "scriptFile"    : "scripts/mobs/DreadKnight",
   "lootChance"    : 0.02,
   "loot"          : { "kind": "Gold" },
   "undead"        : true,
   "isHumanoid"    : true,
   "canBePet"      : true,
   "friendly"      : false,
   "fraction"      : "DUNGEON"
}

Lua Script

local RPD = require "scripts/lib/commonClasses"
local mob = require "scripts/lib/mob"
 
return mob.init{
    attackProc = function(self, enemy, dmg)
        -- 1/4 chance: death stroke + double damage
        if enemy ~= nil and math.random(4) == 1 then
            RPD.Sfx.DeathStroke:hit(enemy)
            return dmg * 2
        end
        -- 1/10 chance to stun
        if enemy ~= nil and math.random(10) == 1 then
            RPD.affectBuff(enemy, "Stun", RPD.CharUtils:durationFactor(enemy) * 10)
        end
        return dmg
    end
}

Mob Stats (from JSON and Lua)

Special Abilities (from JSON/Lua)

JSON Configuration

This entity has JSON configuration in these files:

Sprite Configuration (from JSON)

{
   "texture" : "mobs/dread_knight.png",
   "width" : 12,
   "height" : 16,
   "idle" : {
      "fps" : 3,
      "looped" : true,
      "frames" : [0, 0, 0, 1, 1]
   },
   "run" : {
      "fps" : 12,
      "looped" : true,
      "frames" : [2, 3, 4, 5, 6, 7]
   },
   "attack" : {
      "fps" : 10,
      "looped" : false,
      "frames" : [8, 9, 10]
   },
   "die" : {
      "fps" : 10,
      "looped" : false,
      "frames" : [11, 12, 13, 14, 15, 16, 17]
   }
}

String Resources

English strings from strings_all.xml:

<string name="DreadKnight_Name">dread knight</string>
<string name="DreadKnight_Gender">masculine</string>
<string name="DreadKnight_Name_Objective">dread knight</string>
<string name="DreadKnight_Desc">The dread knight is an ancient warrior who, in life, neither knew good or righteousness. For his sins, he is doomed to everlasting wanderings in this broken body of death. And every moment of his tormented existence is full of pain and suffering, similar to what he inflicted on his victims.</string>

Spawn Locations (from Bestiary.json)

Lua Scripts

This entity is implemented in Java, no Lua script exists