Skip to content

Commit

Permalink
Augments (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codinablack committed Oct 7, 2024
1 parent 98df4da commit 5cd47fd
Show file tree
Hide file tree
Showing 32 changed files with 2,872 additions and 1,111 deletions.
11 changes: 11 additions & 0 deletions data/augments/druid.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[DruidicBlessing]
name = "Druidic Blessing"
description = "a vital blessing from the Great Meridan to only those worthy of such favor"
modifiers = [
# Manasteal with poison spells
{ stance = "attack", type = "manasteal", value = 20, damageType = "earth", originType = "spell" },
# Staminasteal
{ stance = "attack", type = "staminasteal", value = 1, chance = 5, flatRate = true, damageType = "earth", originType = "condition" },
# Soulsteal
{ stance = "attack", type = "soulsteal", chance = 10, damageType = "ice", originType = "spell" },
]
21 changes: 21 additions & 0 deletions data/augments/knight.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[LancelotsLance]
name = "Lancelot's Lance"
description = "a powerful ability whose origins trace back to the White Knight Lancelot"
modifiers = [
# Lifesteal
{ stance = "attack", type = "lifesteal", value = 35, chance = 85, damageType = "physical", originType = "melee"},
# Melee Crits
{ stance = "attack", type = "critical", value = 35, chance = 98, damageType = "physical", originType = "melee", monster = "Rat"},
]

[GuardiansShield]
name = "Guardian's Shield"
description = "This enhancement comes from years of skilled craftsmanship, and just a touch of magic"
modifiers = [
# Condition Resistance
{ stance = "defense", type = "resist", value = 20, originType = "condition" },
# Spell Deflection
{ stance = "defense", type = "deflect", value = 100, chance = 100, damageType = "physical" },
# Physical Absorb
{ stance = "defense", type = "absorb", value = 45, chance = 80, damageType = "physical"},
]
11 changes: 11 additions & 0 deletions data/augments/paladin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[RangersResolve]
name = "Ranger's Resolve"
description = "An ancient shamanic blessing, endowing archers with the light needed to defeat the darkness"
modifiers = [
# Piercing Shot
{ stance = "attack", type = "piercing", value = 20, flatRate = true, originType = "ranged"},
# Death Resistance
{ stance = "defense", type = "resist", value = 30, damageType = "death"},
# Soul Restoration
{ stance = "attack", type = "soulsteal", value = 1, chance = 60, flatRate = true, originType = "ranged" },
]
11 changes: 11 additions & 0 deletions data/augments/sorceror.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[MerlinsRage]
name = "Merlins Rage"
description = "A portion of The Great Mage Merlin's power! It takes great power just to wield this power!"
modifiers = [
# Piercing curse damage
{ stance = "attack", type = "piercing", value = 20, damageType = "death", originType="condition"},
# Spell Crits
{ stance = "attack", type = "critical", value = 30, chance = 25, originType = "spell"},
# Spell Death Conversion
{ stance = "attack", type = "conversion", value = 10, toDamageType = "death", originType = "spell" },
]
19 changes: 0 additions & 19 deletions data/scripts/#discord.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
local LoginEvent = CreatureEvent("DiscordHook")

--Discord webhook enums
--MESSAGE_NORMAL
--MESSAGE_ERROR;
--MESSAGE_LOG;
--MESSAGE_INFO;

local webhookLink = "TOKEN HERE"

function LoginEvent.onLogin(player)
Game.sendDiscordMessage(webhookLink, MESSAGE_INFO, "Player: " .. player:getName() .. " has logged in")
Game.sendDiscordMessage(webhookLink, MESSAGE_ERROR, "Player: " .. player:getName() .. " has logged in")
Game.sendDiscordMessage(webhookLink, MESSAGE_NORMAL, "Player: " .. player:getName() .. " has logged in")
Game.sendDiscordMessage(webhookLink, MESSAGE_LOG, "Player: " .. player:getName() .. " has logged in")
return true
end

LoginEvent:type("login")
LoginEvent:register()
19 changes: 13 additions & 6 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,34 @@ workspace "Black-Tek-Server"
objdir "build/%{cfg.buildcfg}/obj"
location ""
files { "src/**.cpp", "src/**.h" }
flags {"LinkTimeOptimization", "MultiProcessorCompile"}
flags {"MultiProcessorCompile"}
enableunitybuild "On"
intrinsics "On"

filter "configurations:Debug"
defines { "DEBUG" }
runtime "Debug"
symbols "On"
optimize "Debug"
flags {"NoIncrementalLink"}
filter {}

filter "configurations:Release"
defines { "NDEBUG" }
symbols "On"
optimize "Speed"
runtime "Release"
symbols "Off"
editandcontinue "Off"
optimize "Full"
flags {"LinkTimeOptimization"}
filter {}

filter "platforms:64"
architecture "x86_64"
filter {}

filter "platforms:ARM64"
architecture "ARM64"
filter {}

filter "system:not windows"
buildoptions { "-Wall", "-Wextra", "-pedantic", "-pipe", "-fvisibility=hidden", "-Wno-unused-local-typedefs" }
Expand All @@ -42,9 +49,9 @@ workspace "Black-Tek-Server"
filter "system:windows"
openmp "On"
characterset "MBCS"
debugformat "c7"
linkoptions {"/IGNORE:4099"}
vsprops { VcpkgEnableManifest = "true" }
symbolspath '$(OutDir)$(TargetName).pdb'
filter {}

filter "architecture:amd64"
Expand All @@ -55,14 +62,14 @@ workspace "Black-Tek-Server"
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/arm64-linux/lib" }
includedirs { "vcpkg_installed/arm64-linux/include" }
links { "pugixml", "lua", "fmt", "ssl", "mariadb", "cryptopp", "crypto", "boost_iostreams", "zstd", "z", "curl" }
links { "pugixml", "lua", "fmt", "ssl", "mariadb", "cryptopp", "crypto", "boost_iostreams", "zstd", "z", "curl", "tomlplusplus" }
filter{}

filter { "system:linux", "architecture:amd64" }
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/x64-linux/lib" }
includedirs { "vcpkg_installed/x64-linux/include" }
links { "pugixml", "lua", "fmt", "ssl", "mariadb", "cryptopp", "crypto", "boost_iostreams", "zstd", "z", "curl" }
links { "pugixml", "lua", "fmt", "ssl", "mariadb", "cryptopp", "crypto", "boost_iostreams", "zstd", "z", "curl", "tomlplusplus" }
filter{}

filter "toolset:gcc"
Expand Down
37 changes: 37 additions & 0 deletions src/augment.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Credits: BlackTek Server Creator [email protected].
// This project is based of otland's The Forgottenserver.
// Any and all code taken from otland's The Forgottenserver is licensed under GPL 2.0
// Any code Authored by: Codinablack or BlackTek contributers, that is not already licensed, is hereby licesned MIT.
// The GPL 2.0 License that can be found in the LICENSE file.
// All code found in this file is licensed under MIT and can be found in the LICENSE file.


#include "augment.h"

Augment::Augment(std::string_view name, std::string_view description) : m_name(name), m_description(description), m_mod_list(std::make_shared<ModifierList>()) {
m_mod_list->initializeSharedPointer();
}

Augment::Augment(std::shared_ptr<Augment>& original) : m_name(original->m_name), m_mod_list(original->m_mod_list) {
m_mod_list->initializeSharedPointer();
}

std::vector<std::shared_ptr<DamageModifier>>& Augment::getAttackModifiers()
{
return m_mod_list->getAttackModifiers();
}

std::vector<std::shared_ptr<DamageModifier>>& Augment::getDefenseModifiers()
{
return m_mod_list->getDefenseModifiers();
}

std::vector<std::shared_ptr<DamageModifier>>& Augment::getAttackModifiers(uint8_t modType)
{
return m_mod_list->getAttackModifiers(modType);
}

std::vector<std::shared_ptr<DamageModifier>>& Augment::getDefenseModifiers(uint8_t modType)
{
return m_mod_list->getDefenseModifiers(modType);
}
92 changes: 92 additions & 0 deletions src/augment.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Credits: BlackTek Server Creator [email protected].
// This project is based of otland's The Forgottenserver.
// Any and all code taken from otland's The Forgottenserver is licensed under GPL 2.0
// Any code Authored by: Codinablack or BlackTek contributers, that is not already licensed, is hereby licesned MIT.
// The GPL 2.0 License that can be found in the LICENSE file.
// All code found in this file is licensed under MIT and can be found in the LICENSE file.


#ifndef FS_AUGMENT_H
#define FS_AUGMENT_H

#include "damagemodifier.h"

class Augment : public std::enable_shared_from_this<Augment> {

public:
Augment() = default;
Augment(std::string_view name, std::string_view description = "");
Augment(std::shared_ptr<Augment>& original);

~Augment() = default;

// allow copying
explicit Augment(const Augment&) = default;
Augment& operator=(const Augment&) = default;

// comparison operator
std::strong_ordering operator<=>(const Augment& other) const = default;

const std::string_view getName() const;
const std::string_view getDescription() const;

void setName(std::string_view name);
void setDescription(std::string_view description);

static std::shared_ptr<Augment> MakeAugment(std::string_view augmentName, std::string_view description = "");
static std::shared_ptr<Augment> MakeAugment(std::shared_ptr<Augment>& originalPointer);

void addModifier(std::shared_ptr<DamageModifier> modifier);
void removeModifier(std::shared_ptr<DamageModifier>& modifier);

std::vector<std::shared_ptr<DamageModifier>>& getAttackModifiers();
std::vector<std::shared_ptr<DamageModifier>>& getDefenseModifiers();

std::vector<std::shared_ptr<DamageModifier>>& getAttackModifiers(uint8_t modType);
std::vector<std::shared_ptr<DamageModifier>>& getDefenseModifiers(uint8_t modType);

private:

std::shared_ptr<ModifierList> m_mod_list;
std::string_view m_name;
std::string_view m_description;
};


inline std::shared_ptr<Augment> Augment::MakeAugment(std::string_view augmentName, std::string_view description) {
auto augment = std::make_shared<Augment>(augmentName);
return augment;
}

inline std::shared_ptr<Augment> Augment::MakeAugment(std::shared_ptr<Augment>& originalRef)
{
auto augmentClone = std::make_shared<Augment>(originalRef);
return augmentClone;
}

inline const std::string_view Augment::getName() const {
return m_name;
}

inline const std::string_view Augment::getDescription() const
{
return m_description;
}

inline void Augment::setName(std::string_view name) {
m_name = name;
}

inline void Augment::setDescription(std::string_view description) {
m_description = description;
}

inline void Augment::addModifier(std::shared_ptr<DamageModifier> modifier) {
m_mod_list->addModifier(modifier);
}

inline void Augment::removeModifier(std::shared_ptr<DamageModifier>& modifier) {
m_mod_list->removeModifier(modifier);
}

#endif
Loading

0 comments on commit 5cd47fd

Please sign in to comment.