Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
9 years ago
Diff never expires
Clear
Export
Share
Explain
0 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
52 lines
Copy
10 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
62 lines
Copy
CombatDamage Combat::getCombatDamage(Creature* creature, Creature* target) const
CombatDamage Combat::getCombatDamage(Creature* creature, Creature* target) const
{
{
CombatDamage damage;
CombatDamage damage;
damage.origin = params.origin;
damage.origin = params.origin;
damage.primary.type = params.combatType;
damage.primary.type = params.combatType;
if (formulaType == COMBAT_FORMULA_DAMAGE) {
if (formulaType == COMBAT_FORMULA_DAMAGE) {
damage.primary.value = normal_random(
damage.primary.value = normal_random(
static_cast<int32_t>(mina),
static_cast<int32_t>(mina),
static_cast<int32_t>(maxa)
static_cast<int32_t>(maxa)
);
);
} else if (creature) {
} else if (creature) {
int32_t min, max;
int32_t min, max;
if (creature->getCombatValues(min, max)) {
if (creature->getCombatValues(min, max)) {
damage.primary.value = normal_random(min, max);
damage.primary.value = normal_random(min, max);
} else if (Player* player = creature->getPlayer()) {
} else if (Player* player = creature->getPlayer()) {
if (params.valueCallback) {
if (params.valueCallback) {
params.valueCallback->getMinMaxValues(player, damage, params.useCharges);
params.valueCallback->getMinMaxValues(player, damage, params.useCharges);
} else if (formulaType == COMBAT_FORMULA_LEVELMAGIC) {
} else if (formulaType == COMBAT_FORMULA_LEVELMAGIC) {
int32_t levelFormula = player->getLevel() * 2 + player->getMagicLevel() * 3;
int32_t levelFormula = player->getLevel() * 2 + player->getMagicLevel() * 3;
damage.primary.value = normal_random(
damage.primary.value = normal_random(
static_cast<int32_t>(levelFormula * mina + minb),
static_cast<int32_t>(levelFormula * mina + minb),
static_cast<int32_t>(levelFormula * maxa + maxb)
static_cast<int32_t>(levelFormula * maxa + maxb)
);
);
} else if (formulaType == COMBAT_FORMULA_SKILL) {
} else if (formulaType == COMBAT_FORMULA_SKILL) {
Item* tool = player->getWeapon();
Item* tool = player->getWeapon();
const Weapon* weapon = g_weapons->getWeapon(tool);
const Weapon* weapon = g_weapons->getWeapon(tool);
if (weapon) {
if (weapon) {
damage.primary.value = normal_random(
damage.primary.value = normal_random(
static_cast<int32_t>(minb),
static_cast<int32_t>(minb),
static_cast<int32_t>(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb)
static_cast<int32_t>(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb)
);
);
damage.secondary.type = weapon->getElementType();
damage.secondary.type = weapon->getElementType();
damage.secondary.value = weapon->getElementDamage(player, target, tool);
damage.secondary.value = weapon->getElementDamage(player, target, tool);
if (params.useCharges) {
if (params.useCharges) {
uint16_t charges = tool->getCharges();
uint16_t charges = tool->getCharges();
if (charges != 0) {
if (charges != 0) {
g_game.transformItem(tool, tool->getID(), charges - 1);
g_game.transformItem(tool, tool->getID(), charges - 1);
}
}
}
}
} else {
} else {
damage.primary.value = normal_random(
damage.primary.value = normal_random(
static_cast<int32_t>(minb),
static_cast<int32_t>(minb),
static_cast<int32_t>(maxb)
static_cast<int32_t>(maxb)
);
);
}
}
}
}
}
}
}
}
Copy
Copied
Copy
Copied
//custom edit: passive damage bonus // ONLY DAMAGE, NOT INCREASE HEALING
if (creature->getPlayer()) // caster is player
{
if (params.combatType != COMBAT_HEALING)
{
damage.primary.value += ((damage.primary.value / 100)*creature->getPlayer()->getPassiveDamageBonus());
damage.secondary.value += ((damage.secondary.value / 100)*creature->getPlayer()->getPassiveDamageBonus());
}
}
return damage;
return damage;
}
}
Saved diffs
Original text
Open file
CombatDamage Combat::getCombatDamage(Creature* creature, Creature* target) const { CombatDamage damage; damage.origin = params.origin; damage.primary.type = params.combatType; if (formulaType == COMBAT_FORMULA_DAMAGE) { damage.primary.value = normal_random( static_cast<int32_t>(mina), static_cast<int32_t>(maxa) ); } else if (creature) { int32_t min, max; if (creature->getCombatValues(min, max)) { damage.primary.value = normal_random(min, max); } else if (Player* player = creature->getPlayer()) { if (params.valueCallback) { params.valueCallback->getMinMaxValues(player, damage, params.useCharges); } else if (formulaType == COMBAT_FORMULA_LEVELMAGIC) { int32_t levelFormula = player->getLevel() * 2 + player->getMagicLevel() * 3; damage.primary.value = normal_random( static_cast<int32_t>(levelFormula * mina + minb), static_cast<int32_t>(levelFormula * maxa + maxb) ); } else if (formulaType == COMBAT_FORMULA_SKILL) { Item* tool = player->getWeapon(); const Weapon* weapon = g_weapons->getWeapon(tool); if (weapon) { damage.primary.value = normal_random( static_cast<int32_t>(minb), static_cast<int32_t>(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb) ); damage.secondary.type = weapon->getElementType(); damage.secondary.value = weapon->getElementDamage(player, target, tool); if (params.useCharges) { uint16_t charges = tool->getCharges(); if (charges != 0) { g_game.transformItem(tool, tool->getID(), charges - 1); } } } else { damage.primary.value = normal_random( static_cast<int32_t>(minb), static_cast<int32_t>(maxb) ); } } } } return damage; }
Changed text
Open file
CombatDamage Combat::getCombatDamage(Creature* creature, Creature* target) const { CombatDamage damage; damage.origin = params.origin; damage.primary.type = params.combatType; if (formulaType == COMBAT_FORMULA_DAMAGE) { damage.primary.value = normal_random( static_cast<int32_t>(mina), static_cast<int32_t>(maxa) ); } else if (creature) { int32_t min, max; if (creature->getCombatValues(min, max)) { damage.primary.value = normal_random(min, max); } else if (Player* player = creature->getPlayer()) { if (params.valueCallback) { params.valueCallback->getMinMaxValues(player, damage, params.useCharges); } else if (formulaType == COMBAT_FORMULA_LEVELMAGIC) { int32_t levelFormula = player->getLevel() * 2 + player->getMagicLevel() * 3; damage.primary.value = normal_random( static_cast<int32_t>(levelFormula * mina + minb), static_cast<int32_t>(levelFormula * maxa + maxb) ); } else if (formulaType == COMBAT_FORMULA_SKILL) { Item* tool = player->getWeapon(); const Weapon* weapon = g_weapons->getWeapon(tool); if (weapon) { damage.primary.value = normal_random( static_cast<int32_t>(minb), static_cast<int32_t>(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb) ); damage.secondary.type = weapon->getElementType(); damage.secondary.value = weapon->getElementDamage(player, target, tool); if (params.useCharges) { uint16_t charges = tool->getCharges(); if (charges != 0) { g_game.transformItem(tool, tool->getID(), charges - 1); } } } else { damage.primary.value = normal_random( static_cast<int32_t>(minb), static_cast<int32_t>(maxb) ); } } } } //custom edit: passive damage bonus // ONLY DAMAGE, NOT INCREASE HEALING if (creature->getPlayer()) // caster is player { if (params.combatType != COMBAT_HEALING) { damage.primary.value += ((damage.primary.value / 100)*creature->getPlayer()->getPassiveDamageBonus()); damage.secondary.value += ((damage.secondary.value / 100)*creature->getPlayer()->getPassiveDamageBonus()); } } return damage; }
Find difference