Skip to content

Commit

Permalink
Code format - (Clang-format)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 28, 2024
1 parent 81a32a6 commit f33ef86
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 25 deletions.
86 changes: 64 additions & 22 deletions src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,13 +942,55 @@ void Combat::setupChain(const std::shared_ptr<Weapon> &weapon) {
}

static std::list<uint32_t> areaList = {
0, 0, 0, 1, 0, 0, 0,
0, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 0,
1, 1, 1, 3, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 0,
0, 0, 0, 1, 0, 0, 0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
3,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
0,
0,
0,
0,
1,
0,
0,
0,
};
auto area = std::make_unique<AreaCombat>();
area->setupArea(areaList, 7);
Expand All @@ -973,26 +1015,26 @@ void Combat::setupChain(const std::shared_ptr<Weapon> &weapon) {
setChainCallback(g_configManager().getNumber(COMBAT_CHAIN_TARGETS, __FUNCTION__), 1, true);

switch (weaponType) {
case WEAPON_SWORD:
setCommonValues(1.1, MELEE_ATK_SWORD, CONST_ME_SLASH);
break;
case WEAPON_SWORD:
setCommonValues(1.1, MELEE_ATK_SWORD, CONST_ME_SLASH);
break;

case WEAPON_CLUB:
setCommonValues(0.7, MELEE_ATK_CLUB, CONST_ME_BLACK_BLOOD);
break;
case WEAPON_CLUB:
setCommonValues(0.7, MELEE_ATK_CLUB, CONST_ME_BLACK_BLOOD);
break;

case WEAPON_AXE:
setCommonValues(0.9, MELEE_ATK_AXE, CONST_ANI_WHIRLWINDAXE);
break;
case WEAPON_AXE:
setCommonValues(0.9, MELEE_ATK_AXE, CONST_ANI_WHIRLWINDAXE);
break;
}

if (weaponType == WEAPON_WAND) {
static const std::map<CombatType_t, std::pair<MagicEffectClasses, MagicEffectClasses>> elementEffects = {
{COMBAT_DEATHDAMAGE, {CONST_ME_MORTAREA, CONST_ME_BLACK_BLOOD}},
{COMBAT_ENERGYDAMAGE, {CONST_ME_ENERGYAREA, CONST_ME_PINK_ENERGY_SPARK}},
{COMBAT_FIREDAMAGE, {CONST_ME_FIREATTACK, CONST_ME_FIREATTACK}},
{COMBAT_ICEDAMAGE, {CONST_ME_ICEATTACK, CONST_ME_ICEATTACK}},
{COMBAT_EARTHDAMAGE, {CONST_ME_STONES, CONST_ME_POISONAREA}},
{ COMBAT_DEATHDAMAGE, { CONST_ME_MORTAREA, CONST_ME_BLACK_BLOOD } },
{ COMBAT_ENERGYDAMAGE, { CONST_ME_ENERGYAREA, CONST_ME_PINK_ENERGY_SPARK } },
{ COMBAT_FIREDAMAGE, { CONST_ME_FIREATTACK, CONST_ME_FIREATTACK } },
{ COMBAT_ICEDAMAGE, { CONST_ME_ICEATTACK, CONST_ME_ICEATTACK } },
{ COMBAT_EARTHDAMAGE, { CONST_ME_STONES, CONST_ME_POISONAREA } },
};

auto it = elementEffects.find(weapon->getElementType());
Expand Down Expand Up @@ -1550,7 +1592,7 @@ void ValueCallback::getMinMaxValues(std::shared_ptr<Player> player, CombatDamage
case COMBAT_FORMULA_SKILL: {
// onGetPlayerMinMaxValues(player, attackSkill, attackValue, attackFactor)
std::shared_ptr<Item> tool = player->getWeapon();
const auto & weapon = g_weapons().getWeapon(tool);
const auto &weapon = g_weapons().getWeapon(tool);
int32_t attackSkill = 0;
float attackFactor = 0;
if (weapon) {
Expand Down
3 changes: 2 additions & 1 deletion src/creatures/combat/combat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class TargetCallback final : public CallBack {
class ChainCallback final : public CallBack {
public:
ChainCallback() = default;
ChainCallback(uint8_t &chainTargets, uint8_t &chainDistance, bool &backtracking) : m_chainDistance(chainDistance), m_chainTargets(chainTargets), m_backtracking(backtracking) { }
ChainCallback(uint8_t &chainTargets, uint8_t &chainDistance, bool &backtracking) :
m_chainDistance(chainDistance), m_chainTargets(chainTargets), m_backtracking(backtracking) { }

void getChainValues(const std::shared_ptr<Creature> &creature, uint8_t &maxTargets, uint8_t &chainDistance, bool &backtracking);
void setFromLua(bool fromLua) {
Expand Down
4 changes: 2 additions & 2 deletions src/items/weapons/weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void Weapon::decrementItemCount(std::shared_ptr<Item> item) {
}
}

bool Weapon::calculateSkillFormula(const std::shared_ptr<Player> &player, int32_t &attackSkill, int32_t &attackValue, float &attackFactor, int16_t &elementAttack, CombatDamage &damage, bool useCharges/* = false*/) const {
bool Weapon::calculateSkillFormula(const std::shared_ptr<Player> &player, int32_t &attackSkill, int32_t &attackValue, float &attackFactor, int16_t &elementAttack, CombatDamage &damage, bool useCharges /* = false*/) const {
std::shared_ptr<Item> tool = player->getWeapon();
if (!tool) {
return false;
Expand Down Expand Up @@ -883,7 +883,7 @@ void WeaponWand::configureWeapon(const ItemType &it) {
Weapon::configureWeapon(it);
}

int32_t WeaponWand::getWeaponDamage(std::shared_ptr<Player> player, std::shared_ptr<Creature>, std::shared_ptr<Item>, bool maxDamage/* = false*/) const {
int32_t WeaponWand::getWeaponDamage(std::shared_ptr<Player> player, std::shared_ptr<Creature>, std::shared_ptr<Item>, bool maxDamage /* = false*/) const {
if (!g_configManager().getBoolean(TOGGLE_CHAIN_SYSTEM, __FUNCTION__)) {
// Returns maximum damage or a random value between minChange and maxChange
return maxDamage ? -maxChange : -normal_random(minChange, maxChange);
Expand Down

0 comments on commit f33ef86

Please sign in to comment.