Skip to content

Commit

Permalink
feat: augments (#2602)
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE committed May 13, 2024
1 parent bf5f8e9 commit e0e7ab0
Show file tree
Hide file tree
Showing 20 changed files with 417 additions and 4 deletions.
14 changes: 13 additions & 1 deletion config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ cleanProtectionZones = false
-- Connection Config
-- NOTE: allowOldProtocol can allow login on 10x protocol. (11.00)
-- NOTE: maxPlayers set to 0 means no limit
-- NOTE: MaxPacketsPerSeconds if you change you will be subject to bugs by WPE, keep the default value of 25
-- NOTE: MaxPacketsPerSeconds if you change you will be subject to bugs by WPE, keep the default value of 25,
-- It's recommended to use a range like min 50 in this function, otherwise you will be disconnected after equipping two-handed distance weapons.
ip = "127.0.0.1"
allowOldProtocol = false
bindOnlyGlobalAddress = false
Expand Down Expand Up @@ -80,6 +81,17 @@ freeDepotLimit = 2000
premiumDepotLimit = 10000
depotBoxes = 20

-- Augments System (Get more info in: https://github.com/opentibiabr/canary/pull/2602)
-- NOTE: the following values are for all weapons and equipments that have type of "increase damage", "powerful impact" and "strong impact".
-- To customize the percentage of a particular item with these augment types, please add to the item "augments" section on items.xml as the example above.
-- NOTE: The values represent percentage.
-- NOTE: augmentIncreasedDamagePercent = value between 1 and 100 (damage percent to increase. ex: 5 = 5%, 50 = 50%)
-- NOTE: augmentPowerfulImpactPercent = value between 1 and 100 (damage percent to increase. ex: 10 = 10%, 100 = 100%)
-- NOTE: augmentStrongImpactPercent = value between 1 and 100 (damage percent to increase. ex: 7 = 7%, 70 = 70%)
augmentIncreasedDamagePercent = 5
augmentPowerfulImpactPercent = 7
augmentStrongImpactPercent = 10

-- Prey system
-- NOTE: preyRerollPricePerLevel: Price multiplier in gold coin for rerolling prey list.
-- NOTE: preySelectListPrice: Price to manually select creature on list and to lock prey slot.
Expand Down
105 changes: 105 additions & 0 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75009,6 +75009,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75032,6 +75035,12 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
<attribute key="intense wound cleansing" value="cooldown">
<attribute key="value" value="120000" />
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75055,6 +75064,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75078,6 +75090,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75101,6 +75116,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75124,6 +75142,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75149,6 +75170,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75173,6 +75197,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75197,6 +75224,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75221,6 +75251,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75245,6 +75278,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75269,6 +75305,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75285,6 +75324,14 @@ Granted by TibiaGoals.com"/>
<attribute key="skillsword" value="4"/>
<attribute key="armor" value="12"/>
<attribute key="weight" value="3800"/>
<attribute key="augments" value="1">
<attribute key="avatar of steel" value="cooldown">
<attribute key="value" value="900000" />
</attribute>
<attribute key="fierce beserk" value="critical extra damage">
<attribute key="value" value="8" />
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="500"/>
<attribute key="slot" value="legs"/>
Expand All @@ -75311,6 +75358,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand Down Expand Up @@ -75338,6 +75388,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand Down Expand Up @@ -75365,6 +75418,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand Down Expand Up @@ -75392,6 +75448,9 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="unproperly" value="true"/>
Expand All @@ -75407,6 +75466,14 @@ Granted by TibiaGoals.com"/>
<attribute key="holymagiclevelpoints" value="1"/>
<attribute key="armor" value="11"/>
<attribute key="weight" value="3200"/>
<attribute key="augments" value="1">
<attribute key="avatar of light" value="cooldown">
<attribute key="value" value="900000" />
</attribute>
<attribute key="divine caldera" value="critical extra damage">
<attribute key="value" value="8" />
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="500"/>
<attribute key="slot" value="legs"/>
Expand All @@ -75430,6 +75497,10 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="hell's core" value="strong impact" />
<attribute key="energy wave" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="mana" value="21"/>
Expand Down Expand Up @@ -75459,6 +75530,10 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="hell's core" value="powerful impact" />
<attribute key="energy wave" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="mana" value="21"/>
Expand All @@ -75483,6 +75558,17 @@ Granted by TibiaGoals.com"/>
<attribute key="imbuementslot" value="1">
<attribute key="increase speed" value="10"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="avatar of storm" value="cooldown">
<attribute key="value" value="900000" />
</attribute>
<attribute key="hell's core" value="critical extra damage">
<attribute key="value" value="8" />
</attribute>
<attribute key="energy wave" value="critical extra damage">
<attribute key="value" value="8" />
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="500"/>
<attribute key="slot" value="feet"/>
Expand All @@ -75506,6 +75592,10 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="eternal winter" value="strong impact" />
<attribute key="terra wave" value="strong impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="mana" value="20"/>
Expand Down Expand Up @@ -75535,6 +75625,10 @@ Granted by TibiaGoals.com"/>
<attribute key="critical hit" value="3"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="eternal winter" value="powerful impact" />
<attribute key="terra wave" value="powerful impact" />
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
<attribute key="mana" value="20"/>
Expand All @@ -75559,6 +75653,17 @@ Granted by TibiaGoals.com"/>
<attribute key="imbuementslot" value="1">
<attribute key="increase speed" value="10"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="avatar of nature" value="cooldown">
<attribute key="value" value="900000" />
</attribute>
<attribute key="eternal winter" value="critical extra damage">
<attribute key="value" value="8" />
</attribute>
<attribute key="terra wave" value="critical extra damage">
<attribute key="value" value="8" />
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="500"/>
<attribute key="slot" value="feet"/>
Expand Down
5 changes: 4 additions & 1 deletion src/config/config_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ enum ConfigKey_t : uint16_t {
ALLOW_BLOCK_SPAWN,
ALLOW_CHANGEOUTFIT,
ALLOW_RELOAD,
AUGMENT_INCREASED_DAMAGE_PERCENT,
AUGMENT_POWERFUL_IMPACT_PERCENT,
AUGMENT_STRONG_IMPACT_PERCENT,
AUTH_TYPE,
AUTOBANK,
AUTOLOOT,
Expand Down Expand Up @@ -324,5 +327,5 @@ enum ConfigKey_t : uint16_t {
WHEEL_POINTS_PER_LEVEL,
WHITE_SKULL_TIME,
WORLD_TYPE,
XP_DISPLAY_MODE,
XP_DISPLAY_MODE
};
3 changes: 3 additions & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ bool ConfigManager::load() {
loadIntConfig(L, WHEEL_ATELIER_ROTATE_REGULAR_COST, "wheelAtelierRotateRegularCost", 250000);
loadIntConfig(L, WHEEL_POINTS_PER_LEVEL, "wheelPointsPerLevel", 1);
loadIntConfig(L, WHITE_SKULL_TIME, "whiteSkullTime", 15 * 60 * 1000);
loadIntConfig(L, AUGMENT_INCREASED_DAMAGE_PERCENT, "augmentIncreasedDamagePercent", 5);
loadIntConfig(L, AUGMENT_POWERFUL_IMPACT_PERCENT, "augmentPowerfulImpactPercent", 10);
loadIntConfig(L, AUGMENT_STRONG_IMPACT_PERCENT, "augmentStrongImpactPercent", 7);

loadStringConfig(L, CORE_DIRECTORY, "coreDirectory", "data");
loadStringConfig(L, DATA_DIRECTORY, "dataPackDirectory", "data-otservbr-global");
Expand Down
4 changes: 4 additions & 0 deletions src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ CombatDamage Combat::getCombatDamage(std::shared_ptr<Creature> creature, std::sh
}
}
}
if (attackerPlayer && wheelSpell && wheelSpell->isInstant()) {
wheelSpell->getCombatDataAugment(attackerPlayer, damage);
}
}

return damage;
}

Expand Down
41 changes: 40 additions & 1 deletion src/creatures/combat/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,43 @@ void Spell::setWheelOfDestinyBoost(WheelSpellBoost_t boost, WheelSpellGrade_t gr
}
}

void Spell::getCombatDataAugment(std::shared_ptr<Player> player, CombatDamage &damage) {
if (!(damage.instantSpellName).empty()) {
const auto equippedAugmentItems = player->getEquippedAugmentItems();
for (const auto &item : equippedAugmentItems) {
const auto augments = item->getAugmentsBySpellName(damage.instantSpellName);
for (auto &augment : augments) {
if (augment->value == 0) {
continue;
}
if (augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact) {
const float augmentPercent = augment->value / 100.0;
damage.primary.value += static_cast<int32_t>(damage.primary.value * augmentPercent);
damage.secondary.value += static_cast<int32_t>(damage.secondary.value * augmentPercent);
} else if (augment->type != Augment_t::Cooldown) {
const int32_t augmentValue = augment->value * 100;
damage.lifeLeech += augment->type == Augment_t::LifeLeech ? augmentValue : 0;
damage.manaLeech += augment->type == Augment_t::ManaLeech ? augmentValue : 0;
damage.criticalDamage += augment->type == Augment_t::CriticalExtraDamage ? augmentValue : 0;
}
}
}
}
};

int32_t Spell::calculateAugmentSpellCooldownReduction(std::shared_ptr<Player> player) const {
int32_t spellCooldown = 0;
const auto equippedAugmentItems = player->getEquippedAugmentItemsByType(Augment_t::Cooldown);
for (const auto &item : equippedAugmentItems) {
const auto augments = item->getAugmentsBySpellNameAndType(getName(), Augment_t::Cooldown);
for (auto &augment : augments) {
spellCooldown += augment->value;
}
}

return spellCooldown;
}

void Spell::applyCooldownConditions(std::shared_ptr<Player> player) const {
WheelSpellGrade_t spellGrade = player->wheel()->getSpellUpgrade(getName());
bool isUpgraded = getWheelOfDestinyUpgraded() && static_cast<uint8_t>(spellGrade) > 0;
Expand All @@ -644,8 +681,10 @@ void Spell::applyCooldownConditions(std::shared_ptr<Player> player) const {
if (isUpgraded) {
spellCooldown -= getWheelOfDestinyBoost(WheelSpellBoost_t::COOLDOWN, spellGrade);
}
g_logger().debug("[{}] spell name: {}, spellCooldown: {}, bonus: {}", __FUNCTION__, name, spellCooldown, player->wheel()->getSpellBonus(name, WheelSpellBoost_t::COOLDOWN));
int32_t augmentCooldownReduction = calculateAugmentSpellCooldownReduction(player);
g_logger().debug("[{}] spell name: {}, spellCooldown: {}, bonus: {}, augment {}", __FUNCTION__, name, spellCooldown, player->wheel()->getSpellBonus(name, WheelSpellBoost_t::COOLDOWN), augmentCooldownReduction);
spellCooldown -= player->wheel()->getSpellBonus(name, WheelSpellBoost_t::COOLDOWN);
spellCooldown -= augmentCooldownReduction;
if (spellCooldown > 0) {
std::shared_ptr<Condition> condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_SPELLCOOLDOWN, spellCooldown / rateCooldown, 0, false, m_spellId);
player->addCondition(condition);
Expand Down

0 comments on commit e0e7ab0

Please sign in to comment.