• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Feature [1.5] add magicDamage in vocation.xml

Error 502

Intermediate OT User
Joined
Sep 25, 2022
Messages
242
Solutions
8
Reaction score
149
Location
Chile
[1.5] add magicDamage in vocation.xml




default------------>1688661540498.png


magicDamage="1.2"1688661569756.png



vocation.h
[1/4]

class Vocation
search
C++:
float meleeDamageMultiplier = 1.0f;

add below
C++:
float magicDamageMultiplier = 1.0f;







vocation.cpp
[2/4]
bool Vocations::loadFromXml()
search
C++:
if ((attr = childNode.attribute("distDamage"))) {
                    voc.distDamageMultiplier = pugi::cast<float>(attr.value());
                }

add below
C++:
            if ((attr = childNode.attribute("magicDamage"))) {
                    voc.magicDamageMultiplier = pugi::cast<float>(attr.value());
                }







Combat.cpp
[3/4]
CombatDamage Combat::getCombatDamage(Creature* creature, Creature* target) const

search
C++:
int32_t levelFormula = player->getLevel() * 2 + player->getMagicLevel() * 3;
replace
C++:
int32_t levelFormula = (player->getLevel() * 2 + player->getMagicLevel() * 3) * (player->getVocation()->magicDamageMultiplier);








vocations.xml
[4/4]

search
XML:
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
replace
XML:
<formula meleeDamage="1.0" magicDamage="1.2" distDamage="1.0" defense="1.0" armor="1.0" />

the default value is 1.0 , even if you don't put anything

Disclaimer

I'M NOT AN EXPERT IN C++


Another way:

The array lua was very long for me, I preferred damage in C++
 
Last edited:
Question:
Wouldn't it be easier to add a lua script with onHealthChange?
for me ,is more comfortable in xml
because in lua with
onHealthChange 👇
1688678122468.png

+3800 lines o_O

find another way
 
Last edited:
Is this magicDamage based on magic percentage increase or not?

This magicDamage is cool, different and very interesting.
 
Last edited:
Good job and nice contribution. Obviously c++ is better for this case. Also, kinda weird that at some point this disappeared, Im currently at 0.4 and magDamage is here by default in vocations, maybe that's my distro being specific. If that's not in tfs master it should definitely be brought there.
 
Back
Top