Hyresu
Professional Dumb
damage.forcecritical = getNumber<int32_t>(L, 10, 0);Hello, as I've seen in some tfs servers, and some otx-based servers, when you have a weapon that has mixed damage between physical and another element, it will hit calculating only with the physical value
For example: a fire sword will calculate the damage as it has 24 attack, not including the 11 fire
You can check if your server has this bug using an umbral masterblade and a gnome sword and compare the damage between them
With this spells, the fórmula will hit based in a workaround of a normal combat:execute, but at least it will hit calculating the 24 physical damage and 11 fire damage from a fire sword
However, normally the function doTargetCombatHealth and doAreaCombatHealth don't include in their formula the armor of the creature
If you want to consider the armor in the spell damage you will have to edit sources, if you don't, the spells will also work, but the physical damage will not be reduced by creature armor
luascript.cpp
In the function doAreaCombatHealth, below:
add:
In the function doTargetCombatHealth, below:
add:
UPDATE 05/03/2020:
I managed to add something missing in the spells, before this fix, the crit was being calculated individually (You could hit 8 monsters and only crit 2). I also fixed the effects to avoid duplicated effects, you should be able now to crit normally with this patch [Download the files again]
luascript.cpp
In function doAreaCombatHealth, below
Add
In function doTargetCombatHealth, below
Add
enums.h
below
add
below
add
Next, update the files in this link
This will fix the area crit error in every aoe
combat.cpp
We will replace every
With
This will help us bypass the chances, as they are being calculated in the lua script
-- End of 05/03/2020 Update --
The functions will now have 2 additional parameters
Note that you have to edit sources for this spells to work, if you can't edit sources then download the old spells.
Add to your data/spells/lib/spells.lua
Replace the spells with the ones uploaded here
If you get any bug, or you have ideas of any kind or you have the answer to this "bug", feel free to reply
For example: a fire sword will calculate the damage as it has 24 attack, not including the 11 fire
You can check if your server has this bug using an umbral masterblade and a gnome sword and compare the damage between them
With this spells, the fórmula will hit based in a workaround of a normal combat:execute, but at least it will hit calculating the 24 physical damage and 11 fire damage from a fire sword
However, normally the function doTargetCombatHealth and doAreaCombatHealth don't include in their formula the armor of the creature
If you want to consider the armor in the spell damage you will have to edit sources, if you don't, the spells will also work, but the physical damage will not be reduced by creature armor
luascript.cpp
In the function doAreaCombatHealth, below:
C++:
params.impactEffect = getNumber<uint8_t>(L, 7);
C++:
params.blockedByArmor = getBoolean(L, 9, false);
In the function doTargetCombatHealth, below:
C++:
params.impactEffect = getNumber<uint8_t>(L, 6);
C++:
params.blockedByArmor = getBoolean(L, 8, false);
UPDATE 05/03/2020:
I managed to add something missing in the spells, before this fix, the crit was being calculated individually (You could hit 8 monsters and only crit 2). I also fixed the effects to avoid duplicated effects, you should be able now to crit normally with this patch [Download the files again]
luascript.cpp
In function doAreaCombatHealth, below
C++:
damage.primary.value = normal_random(getNumber<int32_t>(L, 6), getNumber<int32_t>(L, 5));
C++:
damage.forcecritical = getNumber<int32_t>(L, 10, 0);
In function doTargetCombatHealth, below
C++:
damage.primary.value = normal_random(getNumber<int32_t>(L, 4), getNumber<int32_t>(L, 5));
C++:
damage.forcecritical = getNumber<int32_t>(L, 9, 0);
enums.h
below
C++:
int affected;
C++:
int forcecritical;
C++:
affected = 1;
C++:
forcecritical = 0;
Next, update the files in this link
Fix Double Crit by hyresu · Pull Request #914 · opentibiabr/otservbr-global
The functions doCombat are calculating the probabilities of a crit (in area or target, both are doing it) But the function doCombatHealth calls CombatHealthFunc, which calculates crit chance for ea...
github.com
combat.cpp
We will replace every
C++:
if (chance != 0 && uniform_random(1, 100) <= chance) {
C++:
if ((damage.forcecritical == 2 || (chance != 0 && uniform_random(1, 100) <= chance)) && damage.forcecritical != 1) {
This will help us bypass the chances, as they are being calculated in the lua script
-- End of 05/03/2020 Update --
The functions will now have 2 additional parameters
Lua:
doAreaCombatHealth(cid, type, pos, area, min, max, effect[, origin = ORIGIN_SPELL, checkArmor = false, forcecritical = 0]]])
doTargetCombatHealth(cid, target, type, min, max, effect[, origin = ORIGIN_SPELL, checkArmor = false, forcecritical = 0]]])
Note that you have to edit sources for this spells to work, if you can't edit sources then download the old spells.
Add to your data/spells/lib/spells.lua
Lua:
weaponDistanceEffect = {
[1] = CONST_ANI_WHIRLWINDSWORD,
[2] = CONST_ANI_WHIRLWINDCLUB,
[3] = CONST_ANI_WHIRLWINDAXE,
}
function Player:getSkillFromId(item)
local weapontype = ItemType(item):getWeaponType()
local skills = {
[1] = SKILL_SWORD,
[2] = SKILL_CLUB,
[3] = SKILL_AXE,
}
return self:getEffectiveSkillLevel(skills[weapontype])
end
Replace the spells with the ones uploaded here
If you get any bug, or you have ideas of any kind or you have the answer to this "bug", feel free to reply
Attachments
-
spells with source edit.rar7 KB · Views: 44 · VirusTotal
-
spells without source edit.rar5.5 KB · Views: 27 · VirusTotal
Last edited: