Skip to content

Commit

Permalink
feat: add rate player attack
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires committed Dec 5, 2024
1 parent 42bd15b commit d52ffa6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ rateKillingInTheNameOfPoints = 1

-- Today regeneration condition over an loop every 1 second,
-- So values which should regenerated less then 1 second or won't will work
-- ratePlayerAttack: multiplies the player's base damage
rateHealthRegen = 1.0
rateHealthRegenSpeed = 1.0
rateManaRegen = 1.0
Expand All @@ -505,6 +506,7 @@ rateSpellCooldown = 1.0
rateAttackSpeed = 1.0
rateOfflineTrainingSpeed = rateAttackSpeed
rateExerciseTrainingSpeed = rateAttackSpeed
ratePlayerAttack = 1

-- Monster rates
rateMonsterHealth = 1.0
Expand Down
1 change: 1 addition & 0 deletions src/config/config_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ enum ConfigKey_t : uint16_t {
RATE_MONSTER_HEALTH,
RATE_NPC_HEALTH,
RATE_OFFLINE_TRAINING_SPEED,
RATE_PLAYER_ATTACK,
RATE_SKILL,
RATE_SOUL_REGEN_SPEED,
RATE_SOUL_REGEN,
Expand Down
1 change: 1 addition & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ bool ConfigManager::load() {
loadFloatConfig(L, RATE_MONSTER_HEALTH, "rateMonsterHealth", 1.0);
loadFloatConfig(L, RATE_NPC_HEALTH, "rateNpcHealth", 1.0);
loadFloatConfig(L, RATE_OFFLINE_TRAINING_SPEED, "rateOfflineTrainingSpeed", 1.0);
loadFloatConfig(L, RATE_PLAYER_ATTACK, "ratePlayerAttack", 1.0);
loadFloatConfig(L, RATE_SOUL_REGEN_SPEED, "rateSoulRegenSpeed", 1.0);
loadFloatConfig(L, RATE_SOUL_REGEN, "rateSoulRegen", 1.0);
loadFloatConfig(L, RATE_SPELL_COOLDOWN, "rateSpellCooldown", 1.0);
Expand Down
5 changes: 5 additions & 0 deletions src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,11 @@ void Combat::applyExtensions(const std::shared_ptr<Creature> &caster, const std:
damage.primary.value *= monster->getAttackMultiplier();
damage.secondary.value *= monster->getAttackMultiplier();
}

const double globalMultiplier = g_configManager().getFloat(RATE_PLAYER_ATTACK);

damage.primary.value = static_cast<int32_t>(damage.primary.value * globalMultiplier);
damage.secondary.value = static_cast<int32_t>(damage.secondary.value * globalMultiplier);
}

MagicField::MagicField(uint16_t type) :
Expand Down

0 comments on commit d52ffa6

Please sign in to comment.