Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tibiadrome mechanics #3323

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
32 changes: 32 additions & 0 deletions data-otservbr-global/migrations/50.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function onUpdateDatabase()
logger.info("Updating database to version 50 (Drome Highscores and Rewards)")

db.query([[
CREATE TABLE IF NOT EXISTS drome_highscores (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
player_id INT NOT NULL,
player_name VARCHAR(255) NOT NULL,
highscore INT NOT NULL DEFAULT 0,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
UNIQUE KEY (player_id),
FOREIGN KEY (player_id) REFERENCES players (id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
]])

db.query([[
CREATE TABLE IF NOT EXISTS drome_reset (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
last_reset TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
]])

db.query([[
CREATE TABLE IF NOT EXISTS drome_offline_rewards (
player_id INT NOT NULL,
rewards TEXT NOT NULL,
PRIMARY KEY (player_id)
);
]])
end
112 changes: 112 additions & 0 deletions data-otservbr-global/monster/drome/Domestikion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
local mType = Game.createMonsterType("Domestikion")
local monster = {}

monster.description = "Domestikion"
monster.experience = 0
monster.outfit = {
lookType = 1426,
}

monster.events = {
"DromeMonsterDeath",
"ExplodingCorpses",
"TargetedExplodingCorpses",
}

monster.health = 800
monster.maxHealth = 800
monster.race = "undead"
monster.corpse = 36914
monster.speed = 180
monster.manaCost = 0

monster.changeTarget = {
interval = 4000,
chance = 10,
}

monster.strategiesTarget = {
nearest = 80,
health = 10,
damage = 10,
}

monster.flags = {
summonable = false,
attackable = true,
hostile = true,
convinceable = false,
pushable = false,
rewardBoss = false,
illusionable = false,
canPushItems = true,
canPushCreatures = true,
staticAttackChance = 90,
targetDistance = 1,
runHealth = 0,
healthHidden = false,
isBlockable = false,
canWalkOnEnergy = false,
canWalkOnFire = true,
canWalkOnPoison = true,
}

monster.light = {
level = 0,
color = 0,
}

monster.voices = {}

monster.attacks = {
{ name = "melee", interval = 2000, chance = 100, minDamage = -100, maxDamage = -100 },
{ name = "combat", interval = 1000, chance = 8, type = COMBAT_ENERGYDAMAGE, minDamage = -100, maxDamage = -100, range = 7, radius = 3, shootEffect = CONST_ANI_ENERGY, effect = CONST_ME_ENERGYHIT, target = true },
{ name = "combat", interval = 3000, chance = 13, type = COMBAT_HOLYDAMAGE, minDamage = -100, maxDamage = -100, range = 7, length = 3, effect = CONST_ME_HOLYAREA, target = true },
{ name = "combat", interval = 3000, chance = 8, type = COMBAT_ENERGYDAMAGE, minDamage = -100, maxDamage = -100, range = 7, radius = 4, effect = CONST_ME_ENERGYAREA, target = false },
}

monster.defenses = {
defense = 110,
armor = 110,
}

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 = {
{ type = "paralyze", condition = true },
{ type = "outfit", condition = false },
{ type = "invisible", condition = true },
{ type = "bleed", condition = false },
}

local function applyDamageScalingCondition(creature)
local dromeLevel = getDromeLevel(creature)
local condition = Condition(CONDITION_ATTRIBUTES)
local scaleFactor = 1 + (dromeLevel * 0.5)
local scaledBuff = math.floor(100 * scaleFactor)

condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_BUFF_DAMAGEDEALT, scaledBuff)
creature:addCondition(condition)
end

mType.onAppear = function(creature)
applyDamageScalingCondition(creature)

local creatureName = creature:getName()

local dromeLevel = getDromeLevel(creature)
end

mType:register(monster)
113 changes: 113 additions & 0 deletions data-otservbr-global/monster/drome/Hoodinion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
local mType = Game.createMonsterType("Hoodinion")
local monster = {}

monster.description = "Hoodinion"
monster.experience = 0
monster.outfit = {
lookType = 1424,
}

monster.events = {
"DromeMonsterDeath",
"ExplodingCorpses",
"TargetedExplodingCorpses",
}

monster.health = 800
monster.maxHealth = 800
monster.race = "undead"
monster.corpse = 36906
monster.speed = 180
monster.manaCost = 0

monster.changeTarget = {
interval = 4000,
chance = 10,
}

monster.strategiesTarget = {
nearest = 80,
health = 10,
damage = 10,
}

monster.flags = {
summonable = false,
attackable = true,
hostile = true,
convinceable = false,
pushable = false,
rewardBoss = false,
illusionable = false,
canPushItems = true,
canPushCreatures = true,
staticAttackChance = 90,
targetDistance = 4,
runHealth = 0,
healthHidden = false,
isBlockable = false,
canWalkOnEnergy = false,
canWalkOnFire = true,
canWalkOnPoison = true,
}

monster.light = {
level = 0,
color = 0,
}

monster.voices = {}

monster.attacks = {
{ name = "melee", interval = 2000, chance = 100, minDamage = -100, maxDamage = -100 },
{ name = "combat", interval = 1000, chance = 12, type = COMBAT_ICEDAMAGE, minDamage = -100, maxDamage = -100, range = 7, shootEffect = CONST_ANI_SMALLICE, effect = CONST_ME_ICEATTACK, target = true },
{ name = "combat", interval = 2000, chance = 12, type = COMBAT_ICEDAMAGE, minDamage = -100, maxDamage = -100, range = 7, radius = 6, shootEffect = CONST_ANI_SMALLICE, effect = CONST_ME_ICETORNADO, target = true },
{ name = "combat", interval = 3000, chance = 13, type = COMBAT_ICEDAMAGE, minDamage = -100, maxDamage = -100, range = 7, range = 7, shootEffect = CONST_ANI_SMALLICE, effect = CONST_ANI_TARSALARROW, target = true },
{ name = "combat", interval = 3000, chance = 16, type = COMBAT_HOLYDAMAGE, minDamage = -100, maxDamage = -100, range = 7, radius = 6, effect = CONST_ME_HITBYFIRE, target = false },
}

monster.defenses = {
defense = 110,
armor = 110,
}

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 = {
{ type = "paralyze", condition = true },
{ type = "outfit", condition = false },
{ type = "invisible", condition = true },
{ type = "bleed", condition = false },
}

local function applyDamageScalingCondition(creature)
local dromeLevel = getDromeLevel(creature)
local condition = Condition(CONDITION_ATTRIBUTES)
local scaleFactor = 1 + (dromeLevel * 0.5)
local scaledBuff = math.floor(100 * scaleFactor)

condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_BUFF_DAMAGEDEALT, scaledBuff)
creature:addCondition(condition)
end

mType.onAppear = function(creature)
applyDamageScalingCondition(creature)

local creatureName = creature:getName()

local dromeLevel = getDromeLevel(creature)
end

mType:register(monster)
113 changes: 113 additions & 0 deletions data-otservbr-global/monster/drome/Mearidion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
local mType = Game.createMonsterType("Mearidion")
local monster = {}

monster.description = "Mearidion"
monster.experience = 0
monster.outfit = {
lookType = 1425,
}

monster.events = {
"DromeMonsterDeath",
"ExplodingCorpses",
"TargetedExplodingCorpses",
}

monster.health = 800
monster.maxHealth = 800
monster.race = "undead"
monster.corpse = 36910
monster.speed = 180
monster.manaCost = 0

monster.changeTarget = {
interval = 4000,
chance = 10,
}

monster.strategiesTarget = {
nearest = 80,
health = 10,
damage = 10,
}

monster.flags = {
summonable = false,
attackable = true,
hostile = true,
convinceable = false,
pushable = false,
rewardBoss = false,
illusionable = false,
canPushItems = true,
canPushCreatures = true,
staticAttackChance = 90,
targetDistance = 4,
runHealth = 0,
healthHidden = false,
isBlockable = false,
canWalkOnEnergy = false,
canWalkOnFire = true,
canWalkOnPoison = true,
}

monster.light = {
level = 0,
color = 0,
}

monster.voices = {}

monster.attacks = {
{ name = "melee", interval = 2000, chance = 100, minDamage = -100, maxDamage = -100 },
{ name = "combat", interval = 1000, chance = 12, type = COMBAT_FIREDAMAGE, minDamage = -100, maxDamage = -100, range = 7, shootEffect = CONST_ANI_FIRE, effect = CONST_ME_HITBYFIRE, target = true },
{ name = "combat", interval = 2000, chance = 12, type = COMBAT_DEATHDAMAGE, minDamage = -100, maxDamage = -100, range = 7, shootEffect = CONST_ANI_BOLT, effect = CONST_ME_BLACKSMOKE, target = true },
{ name = "combat", interval = 3000, chance = 13, type = COMBAT_DEATHDAMAGE, minDamage = -100, maxDamage = -100, range = 7, radius = 7, effect = CONST_ME_BLACKSMOKE, target = false },
{ name = "combat", interval = 3000, chance = 15, type = COMBAT_HOLYDAMAGE, minDamage = -100, maxDamage = -100, range = 7, radius = 2, shootEffect = CONST_ANI_SUDDENDEATH, effect = CONST_ME_MORTAREA, target = true },
}

monster.defenses = {
defense = 110,
armor = 110,
}

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 = {
{ type = "paralyze", condition = true },
{ type = "outfit", condition = false },
{ type = "invisible", condition = true },
{ type = "bleed", condition = false },
}

local function applyDamageScalingCondition(creature)
local dromeLevel = getDromeLevel(creature)
local condition = Condition(CONDITION_ATTRIBUTES)
local scaleFactor = 1 + (dromeLevel * 0.5)
local scaledBuff = math.floor(100 * scaleFactor)

condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_BUFF_DAMAGEDEALT, scaledBuff)
creature:addCondition(condition)
end

mType.onAppear = function(creature)
applyDamageScalingCondition(creature)

local creatureName = creature:getName()

local dromeLevel = getDromeLevel(creature)
end

mType:register(monster)
Loading