From ba748d0a5a73b7bc89f56f6f5627c68ec6dd7d92 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Tue, 17 Sep 2024 21:43:03 -0300 Subject: [PATCH 1/4] feat: new augments and update item description (amber items) --- data/items/items.xml | 118 ++++++++++++++++++++++++-------- src/creatures/combat/spells.cpp | 5 +- src/items/item.cpp | 9 ++- src/items/items.cpp | 7 +- src/items/items_definitions.hpp | 1 + 5 files changed, 103 insertions(+), 37 deletions(-) diff --git a/data/items/items.xml b/data/items/items.xml index 0afe5ebe858..6dfee2fe99f 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -75124,7 +75124,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75150,9 +75152,11 @@ Granted by TibiaGoals.com"/> - + + + - + @@ -75179,7 +75183,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75205,7 +75211,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75231,7 +75239,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75257,7 +75267,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75285,7 +75297,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75312,7 +75326,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75339,7 +75355,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75366,7 +75384,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75393,7 +75413,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75420,7 +75442,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75473,7 +75497,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75503,7 +75529,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75533,7 +75561,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75563,7 +75593,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75612,8 +75644,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75645,8 +75681,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75707,8 +75747,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75740,8 +75784,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75938,7 +75986,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76101,7 +76151,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76145,7 +76197,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76160,8 +76214,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + diff --git a/src/creatures/combat/spells.cpp b/src/creatures/combat/spells.cpp index 105bf734c23..ee2154d2420 100644 --- a/src/creatures/combat/spells.cpp +++ b/src/creatures/combat/spells.cpp @@ -639,7 +639,10 @@ void Spell::getCombatDataAugment(std::shared_ptr player, CombatDamage &d if (augment->value == 0) { continue; } - if (augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact) { + if ( + augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || + augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base + ) { const float augmentPercent = augment->value / 100.0; damage.primary.value += static_cast(damage.primary.value * augmentPercent); damage.secondary.value += static_cast(damage.secondary.value * augmentPercent); diff --git a/src/items/item.cpp b/src/items/item.cpp index dd2d5c965a6..b8fe4b1a566 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -2642,13 +2642,12 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: s << "Vol:" << volume; } } - if (attack != 0) { + if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { + begin = false; + s << " (Atk:" << attack << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); + } else if (attack != 0) { begin = false; s << " (Atk:" << attack; - - if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - s << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); - } } if (defense != 0 || extraDefense != 0 || it.isMissile()) { diff --git a/src/items/items.cpp b/src/items/items.cpp index 2d4020c5416..7e8c7f33c1c 100644 --- a/src/items/items.cpp +++ b/src/items/items.cpp @@ -15,6 +15,7 @@ #include "lua/creature/movement.hpp" #include "game/game.hpp" #include "utils/pugicast.hpp" +#include "creatures/combat/spells.hpp" #include @@ -94,7 +95,7 @@ std::string ItemType::parseAugmentDescription(bool inspect /*= false*/) const { } std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr &augmentInfo) const { - const std::string augmentName = Items::getAugmentNameByType(augmentInfo->type); + const auto &augmentName = Items::getAugmentNameByType(augmentInfo->type); std::string augmentSpellNameCapitalized = augmentInfo->spellName; capitalizeWordsIgnoringString(augmentSpellNameCapitalized, " of "); @@ -104,7 +105,11 @@ std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr {}", augmentSpellNameCapitalized, augmentName); } else if (augmentInfo->type == Augment_t::Cooldown) { return fmt::format("{} -> {}{}s {}", augmentSpellNameCapitalized, signal, augmentInfo->value / 1000, augmentName); + } else if (augmentInfo->type == Augment_t::Base) { + const auto &spell = g_spells().getSpellByName(augmentInfo->spellName); + return fmt::format("{} -> {:+}% {} {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName, spell->getGroup() == SPELLGROUP_HEALING ? "healing" : "damage"); } + return fmt::format("{} -> {:+}% {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName); } diff --git a/src/items/items_definitions.hpp b/src/items/items_definitions.hpp index badac532951..7632c94b484 100644 --- a/src/items/items_definitions.hpp +++ b/src/items/items_definitions.hpp @@ -272,6 +272,7 @@ enum ImbuementTypes_t : int64_t { enum class Augment_t : uint8_t { None, + Base, PowerfulImpact, StrongImpact, IncreasedDamage, From e79e5df87943028b5a7fba2329f18be0322936e0 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 18 Sep 2024 00:44:53 +0000 Subject: [PATCH 2/4] Code format - (Clang-format) --- src/creatures/combat/spells.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/creatures/combat/spells.cpp b/src/creatures/combat/spells.cpp index ee2154d2420..cd700f95ccf 100644 --- a/src/creatures/combat/spells.cpp +++ b/src/creatures/combat/spells.cpp @@ -640,9 +640,8 @@ void Spell::getCombatDataAugment(std::shared_ptr player, CombatDamage &d continue; } if ( - augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || - augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base - ) { + augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base + ) { const float augmentPercent = augment->value / 100.0; damage.primary.value += static_cast(damage.primary.value * augmentPercent); damage.secondary.value += static_cast(damage.secondary.value * augmentPercent); From 563b0f7512baf538dd79e52d80290c276afda571 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Wed, 18 Sep 2024 22:51:17 -0300 Subject: [PATCH 3/4] fix: qodana linter (#2902) --- qodana.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qodana.yml b/qodana.yml index 1621c979a9d..4857043fe5d 100644 --- a/qodana.yml +++ b/qodana.yml @@ -3,6 +3,8 @@ version: "1.0" profile: name: qodana.recommended +linter: jetbrains/qodana-clang:latest + bootstrap: | set -e sudo apt-get update && sudo apt-get -y dist-upgrade From ae3968295a5ba78fa98389e1e36f4afeb9d20288 Mon Sep 17 00:00:00 2001 From: Karin Date: Thu, 19 Sep 2024 02:01:25 -0300 Subject: [PATCH 4/4] fix: crash in use with creature (add nullptr check) (#2899) --- src/game/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/game.cpp b/src/game/game.cpp index 7b60220ecf9..5e99dda81fa 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -3909,7 +3909,7 @@ void Game::playerUseWithCreature(uint32_t playerId, const Position &fromPos, uin } const std::shared_ptr monster = creature->getMonster(); - if (monster && monster->isFamiliar() && creature->getMaster()->getPlayer() == player && (it.isRune() || it.type == ITEM_TYPE_POTION)) { + if (monster && monster->isFamiliar() && creature->getMaster() && creature->getMaster()->getPlayer() == player && (it.isRune() || it.type == ITEM_TYPE_POTION)) { player->setNextPotionAction(OTSYS_TIME() + g_configManager().getNumber(EX_ACTIONS_DELAY_INTERVAL, __FUNCTION__)); if (it.isMultiUse()) {