• 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!

C++ LEVELMAGIC Formula in combat.cpp (TFS 0.4)

reisbro

Member
Joined
May 15, 2017
Messages
94
Solutions
1
Reaction score
7
Before I move on to the main question which is described in the title, I also have another question that is a little complicated to understand, so stay with me lol

1) The formula for LEVELMAGIC in the 0.4tfs is as follows:
C++:
min = (int32_t)((player->getLevel() / minl + player->getMagicLevel() * minm) * 1. * mina + minb);
max = (int32_t)((player->getLevel() / maxl + player->getMagicLevel() * maxm) * 1. * maxa + maxb);

2) After searching a little in the source files I discovered the function that "takes" as arguments the random numbers in the individual spells .lua files, which is:
C++:
void Combat::setPlayerCombatValues(formulaType_t _type, double _mina, double _minb, double _maxa, double _maxb, double _minl, double _maxl, double _minm, double _maxm, int32_t _minc, int32_t _maxc)

3) So that means that the spells should show 10 numbers in the .lua file, but some spells only show 8, and some even less than that. How am I supposed to know what number will serve as the argument for each variable in the LEVELMAGIC formula?
Take as an example the 'energy strike' spell:
Lua:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

I hope I have made myself clear haha. If I could understand those numbers and variables I would probably leave the formulas unchanged, but let's say I wan't to change them - Would I have to change anything else in different .cpp or .h files? Or everything related to combat damage is inside the combat.cpp file?

Thanks a lot!

Bonus question lol:
The int32_t in the formula is not actually a variable right? It is declaring the min and max variables as int32_t type to hold bigger numbers than an int variable?

And the damage is automatically rounded if the result of the min/max values is decimal right?
 

Similar threads

Back
Top