Skip to content
76 changes: 76 additions & 0 deletions data-canary/monster/trainer/training_machine.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
local mType = Game.createMonsterType("Training Machine")
local monster = {}

monster.description = "a training machine"
monster.experience = 0
monster.outfit = {
lookType = 1142,
}

monster.health = 1000000
monster.maxHealth = monster.health
monster.race = "venom"
monster.corpse = 0
monster.speed = 0

monster.changeTarget = {
interval = 1000,
chance = 0,
}

monster.flags = {
summonable = false,
attackable = true,
hostile = true,
convinceable = false,
illusionable = false,
canPushItems = true,
canPushCreatures = true,
targetDistance = 1,
staticAttackChance = 100,
}

monster.summons = {}

monster.voices = {
interval = 5000,
chance = 10,
{ text = "I hope you are enjoying your sparring Sir or Ma'am!", yell = false },
{ text = "Threat level rising!", yell = false },
{ text = "Engaging in hostile interaction!", yell = false },
{ text = "Rrrtttarrrttarrrtta", yell = false },
{ text = "Please feel free to hit me Sir or Ma'am!", yell = false },
{ text = "klonk klonk klonk", yell = false },
{ text = "Self-diagnosis running.", yell = false },
{ text = "Battle simulation proceeding.", yell = false },
{ text = "Repairs initiated!", yell = false },
}

monster.loot = {}

monster.attacks = {
{ name = "melee", interval = 2000, chance = 100, minDamage = -2, maxDamage = -7, attack = 130 },
}

monster.defenses = {
defense = 10,
armor = 7,
{ name = "combat", type = COMBAT_HEALING, chance = 15, interval = 2000, minDamage = 10000, maxDamage = 50000, effect = CONST_ME_MAGIC_BLUE },
}

monster.elements = {
{ type = COMBAT_PHYSICALDAMAGE, percent = 0 },
{ type = COMBAT_ENERGYDAMAGE, percent = 0 },
{ type = COMBAT_EARTHDAMAGE, percent = 0 },
{ type = COMBAT_FIREDAMAGE, percent = 0 },
{ type = COMBAT_LIFEDRAIN, percent = 0 },
{ type = COMBAT_MANADRAIN, percent = 0 },
{ type = COMBAT_DROWNDAMAGE, percent = 0 },
{ type = COMBAT_ICEDAMAGE, percent = 0 },
{ type = COMBAT_HOLYDAMAGE, percent = 0 },
{ type = COMBAT_DEATHDAMAGE, percent = 0 },
}

monster.immunities = {}

mType:register(monster)
37 changes: 26 additions & 11 deletions data/scripts/talkactions/god/charms.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function setBestiary.onSay(player, words, param)
-- create log
logCommand(player, words, param)

local usage = "/setbestiary PLAYER NAME,MONSTER NAME,AMOUNT"
local usage = "/setbestiary PLAYER NAME,MONSTER NAME/ALL,AMOUNT"
if param == "" then
player:sendCancelMessage("Command param required. Usage: " .. usage)
return true
Expand All @@ -136,21 +136,36 @@ function setBestiary.onSay(player, words, param)
split[2] = split[2]:trimSpace()
split[3] = split[3]:trimSpace()

local monsterName = split[2]
local mType = MonsterType(monsterName)
if not mType or (mType and mType:raceId() == 0) then
player:sendCancelMessage("This monster has no bestiary. Type the name exactly as in game.")
return true
end
local amount = tonumber(split[3])
if not amount then
player:sendCancelMessage("Wrong kill amount")
player:sendCancelMessage("Wrong kill amount.")
return true
end

player:sendCancelMessage("Set bestiary kill of monster '" .. monsterName .. "' from player '" .. target:getName() .. "' to '" .. amount .. "'.")
target:sendCancelMessage("Updated kills of monster '" .. monsterName .. "'!")
target:addBestiaryKill(monsterName, amount)
local monsterName = split[2]

-- If "all" is specified, iterate through all monsters
if monsterName:lower() == "all" then
local monsterList = Game.getMonsterTypes() -- Retrieves all available monsters
for _, mType in pairs(monsterList) do
if mType:raceId() > 0 then -- Ensure the monster has a bestiary entry
target:addBestiaryKill(mType:name(), amount)
end
end
player:sendCancelMessage("Set bestiary kill count to '" .. amount .. "' for all monsters for player '" .. target:getName() .. "'.")
target:sendCancelMessage("Updated kills for all monsters in the bestiary!")
else
local mType = MonsterType(monsterName)
if not mType or (mType and mType:raceId() == 0) then
player:sendCancelMessage("This monster has no bestiary. Type the name exactly as in the game.")
return true
end

target:addBestiaryKill(monsterName, amount)
player:sendCancelMessage("Set bestiary kill of monster '" .. monsterName .. "' for player '" .. target:getName() .. "' to '" .. amount .. "'.")
target:sendCancelMessage("Updated kills of monster '" .. monsterName .. "'!")
end

target:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
end

Expand Down
Loading
Loading