Skip to content

Commit

Permalink
Code Cleanup
Browse files Browse the repository at this point in the history
- Removed debug prints from augment testing.
  • Loading branch information
Codinablack committed Dec 7, 2024
1 parent 718d9d3 commit 41b1c80
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
4 changes: 0 additions & 4 deletions src/augment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ std::vector<std::shared_ptr<DamageModifier>> Augment::getAttackModifiers(uint8_t

std::vector<std::shared_ptr<DamageModifier>> Augment::getDefenseModifiers(uint8_t modType) {
std::vector<std::shared_ptr<DamageModifier>> modifiers;
std::cout << "Defense Modifier Size : " << this->getDefenseModifiers().size() << ". \n";
for (auto& mod : m_defense_modifiers) {

std::cout << "Param Type is : " << static_cast<int>(modType) << ". \n";
std::cout << "Get Type is : " << static_cast<int>(mod->getType()) << ". \n";
if (mod->getType() == modType) {
std::cout << "Found defense modifier type : " << modType << ". \n";
modifiers.emplace_back(mod);
}
}
Expand Down
17 changes: 1 addition & 16 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,6 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da

const auto& conversionTotals = casterPlayer.value()->getConvertedTotals(ATTACK_MODIFIER_CONVERSION, damage.primary.type, damage.origin, targetType, target->getRace(), target->getName()) ;
if (!conversionTotals.empty() && params.origin != ORIGIN_AUGMENT) {
std::cout << "Conversion Modifier Activated on " << damage.primary.value << " damage \n";
casterPlayer.value()->convertDamage(target->getCreature(), damage, conversionTotals);
if (damage.primary.value == 0) {
return;
Expand Down Expand Up @@ -903,20 +902,17 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da
auto damageIncrease = std::abs(damage.primary.value * percentTotal / 100);
damage.primary.value -= damageIncrease;
damage.critical = true;
std::cout << "Critical Percent Modifier Activated on " << damage.primary.value << " damage with " << damageIncrease << " as the bonus damage \n";
}

if (flatTotal) {
damage.primary.value -= flatTotal;
damage.critical = true;
std::cout << "Critical Flat Modifier Activated on " << damage.primary.value << " damage with " << flatTotal << " as the bonus damage \n";
}
}

if (targetPlayer.has_value() && (casterPlayer.value() != targetPlayer.value()) && params.origin != ORIGIN_AUGMENT) {
const auto& reformTotals = targetPlayer.value()->getConvertedTotals(DEFENSE_MODIFIER_REFORM, damage.primary.type, damage.origin, CREATURETYPE_PLAYER, caster->getRace(), caster->getName());
if (!reformTotals.empty()) {
std::cout << "Reform Modifier Activated : on " << damage.primary.value << " damage \n";
targetPlayer.value()->reformDamage(*casterPlayer.value()->getCreature(), damage, reformTotals);
if (damage.primary.value == 0) {
return;
Expand Down Expand Up @@ -947,7 +943,6 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da
const auto& defenseModData = targetPlayer.value()->getDefenseModifierTotals(damage.primary.type, damage.origin, attackerType, casterMonster.value()->getRace(), casterMonster.value()->getName());
auto reformTotals = targetPlayer.value()->getConvertedTotals(DEFENSE_MODIFIER_REFORM, damage.primary.type, damage.origin, attackerType, casterMonster.value()->getRace(), casterMonster.value()->getName());
if (!reformTotals.empty() && params.origin != ORIGIN_AUGMENT) {
std::cout << "Reform Modifier Activated on " << damage.primary.value << " damage \n";
targetPlayer.value()->reformDamage(*casterMonster.value()->getCreature(), damage, reformTotals);
if (damage.primary.value == 0) {
return;
Expand All @@ -965,7 +960,7 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da
}
}
}
} else {
} else [[unlikely]] {
std::cout << "Getting calls to doTargetCombat without a target. \n";
}

Expand Down Expand Up @@ -1047,12 +1042,10 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da
}

if (manaStealPercentTotal) {
std::cout << "Mana Leech Percent Modifier Activated : on " << damage.primary.value << " damage \n";
manaStealGain += totalDamage * manaStealPercentTotal / 100;
}

if (manaStealFlatTotal) {
std::cout << "Mana Leech Flat Modifier Activated : on " << damage.primary.value << " damage \n";
manaStealGain += manaStealFlatTotal;
}

Expand All @@ -1067,15 +1060,11 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da

/// Staminasteal
if (staminaStealPercentTotal) {
std::cout << "Stamina Steal Percent Modifier Activated : on " << damage.primary.value << " damage \n";
staminaGain += totalDamage * staminaStealPercentTotal / 100;
std::cout << "Stamina Gain total so far : " << staminaGain << " \n";
}

if (staminaStealFlatTotal) {
std::cout << "Stamina Steal Modifier Activated : on " << damage.primary.value << " damage \n";
staminaGain += staminaStealFlatTotal;
std::cout << "Stamina Gain total so far : " << staminaGain << " \n";
}

if (staminaGain) {
Expand All @@ -1099,15 +1088,11 @@ void Combat::doTargetCombat(Creature* caster, Creature* target, CombatDamage& da

// Soulsteal
if (soulStealPercentTotal) {
std::cout << "Soul Steal Percent Modifier Activated : on " << damage.primary.value << " damage \n";
soulGain += totalDamage * soulStealPercentTotal / 100 ;
std::cout << "Soul Gain total so far : " << soulGain << " \n";
}

if (soulStealFlatTotal) {
std::cout << "Soul Steal Flat Modifier Activated : on " << damage.primary.value << " damage \n";
soulGain += soulStealFlatTotal;
std::cout << "Soul Gain total so far : " << soulGain << " \n";
}

if (soulGain) {
Expand Down

0 comments on commit 41b1c80

Please sign in to comment.