Mob configuration in mobsDesc/Zombie.json:
{
"name" : "Zombie_Name",
"name_objective": "Zombie_Name_Objective",
"description" : "Zombie_Desc",
"gender" : "Zombie_Gender",
"attackSkill" : 10,
"defenseSkill" : 10,
"dmgMin" : 3,
"dmgMax" : 10,
"dr" : 10,
"str" : 13,
"ht" : 33,
"exp" : 6,
"maxLvl" : 15,
"baseSpeed" : 1,
"attackDelay" : 1,
"viewDistance" : 8,
"walkingType" : "NORMAL",
"spriteDesc" : "spritesDesc/Zombie.json",
"scriptFile" : "scripts/mobs/Zombie",
"lootChance" : 0.02,
"loot" : { "kind": "Gold" },
"undead" : true,
"isHumanoid" : true,
"canBePet" : true,
"friendly" : false,
"fraction" : "DUNGEON"
}
English string resources:
<string name="Zombie_Name">zombie</string> <string name="Zombie_Name_Objective">zombie</string> <string name="Zombie_Desc">An animated corpse from the necropolis. It has quite a bit of health, and has a chance to poison the hero on hit. Like all undead creatures, it has immunity to many effects.</string> <string name="Zombie_Gender">masculine</string>
String resources available in multiple languages:
JSON Configuration (mobsDesc/Zombie.json):
{
"name" : "Zombie_Name",
"name_objective": "Zombie_Name_Objective",
"description" : "Zombie_Desc",
"gender" : "Zombie_Gender",
"attackSkill" : 10,
"defenseSkill" : 10,
"dmgMin" : 3,
"dmgMax" : 10,
"dr" : 10,
"str" : 13,
"ht" : 33,
"exp" : 6,
"maxLvl" : 15,
"baseSpeed" : 1,
"attackDelay" : 1,
"viewDistance" : 8,
"walkingType" : "NORMAL",
"spriteDesc" : "spritesDesc/Zombie.json",
"scriptFile" : "scripts/mobs/Zombie",
"lootChance" : 0.02,
"loot" : { "kind": "Gold" },
"undead" : true,
"isHumanoid" : true,
"canBePet" : true,
"friendly" : false,
"fraction" : "DUNGEON"
}
Lua Script (scripts/mobs/Zombie.lua):
local RPD = require "scripts/lib/commonClasses" local mob = require "scripts/lib/mob" return mob.init{ attackProc = function(self, enemy, dmg) -- 1/3 chance to poison; java rolled Random.Int(2,3) which is [2,3) -- i.e. always 2 turns if enemy ~= nil and math.random(3) == 1 then local factor = RPD.CharUtils:durationFactor(enemy) RPD.Buffs.Buff:affect(enemy, "Poison", 2 * factor) end return dmg end }