mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 17:49:20 +02:00
Bug Fixes
Fixed a small issue related to monsters attacking being too low, the issue was related to TFS function normal_random, special thanks to LooSik at otland, see thread: https://otland.net/threads/nostalrius-7-7.262406/post-2552267
This commit is contained in:
parent
840723a28b
commit
a7a253f5eb
@ -9,7 +9,7 @@ function Game.removeItemsOnMap(position)
|
|||||||
local i = 0
|
local i = 0
|
||||||
while i < tileCount do
|
while i < tileCount do
|
||||||
local tileItem = tile:getThing(i)
|
local tileItem = tile:getThing(i)
|
||||||
if tileItem and tileItem:getType():isMovable() then
|
if tileItem and not tileItem:isCreature() and ItemType(tileItem:getId()):isMovable() then
|
||||||
tileItem:remove()
|
tileItem:remove()
|
||||||
else
|
else
|
||||||
i = i + 1
|
i = i + 1
|
||||||
@ -24,8 +24,10 @@ function Game.transformItemOnMap(position, itemId, toItemId, subtype)
|
|||||||
|
|
||||||
local tile = Tile(position)
|
local tile = Tile(position)
|
||||||
local item = tile:getItemById(itemId)
|
local item = tile:getItemById(itemId)
|
||||||
item:transform(toItemId, subtype)
|
if item ~= nil then
|
||||||
item:decay()
|
item:transform(toItemId, subtype)
|
||||||
|
item:decay()
|
||||||
|
end
|
||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -876,7 +876,7 @@ void Monster::doAttacking(uint32_t)
|
|||||||
|
|
||||||
for (spellBlock_t& spellBlock : mType->info.attackSpells) {
|
for (spellBlock_t& spellBlock : mType->info.attackSpells) {
|
||||||
if (spellBlock.range != 0 && std::max<uint32_t>(Position::getDistanceX(myPos, targetPos), Position::getDistanceY(myPos, targetPos)) <= spellBlock.range) {
|
if (spellBlock.range != 0 && std::max<uint32_t>(Position::getDistanceX(myPos, targetPos), Position::getDistanceY(myPos, targetPos)) <= spellBlock.range) {
|
||||||
if (normal_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || normal_random(1, 3) == 1)) {
|
if (uniform_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || uniform_random(1, 3) == 1)) {
|
||||||
updateLookDirection();
|
updateLookDirection();
|
||||||
|
|
||||||
minCombatValue = spellBlock.minCombatValue;
|
minCombatValue = spellBlock.minCombatValue;
|
||||||
@ -977,7 +977,7 @@ void Monster::onThinkTarget(uint32_t interval)
|
|||||||
void Monster::onThinkDefense(uint32_t)
|
void Monster::onThinkDefense(uint32_t)
|
||||||
{
|
{
|
||||||
for (const spellBlock_t& spellBlock : mType->info.defenseSpells) {
|
for (const spellBlock_t& spellBlock : mType->info.defenseSpells) {
|
||||||
if (normal_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || normal_random(1, 3) == 1)) {
|
if (uniform_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || uniform_random(1, 3) == 1)) {
|
||||||
minCombatValue = spellBlock.minCombatValue;
|
minCombatValue = spellBlock.minCombatValue;
|
||||||
maxCombatValue = spellBlock.maxCombatValue;
|
maxCombatValue = spellBlock.maxCombatValue;
|
||||||
spellBlock.spell->castSpell(this, this);
|
spellBlock.spell->castSpell(this, this);
|
||||||
@ -1001,7 +1001,7 @@ void Monster::onThinkDefense(uint32_t)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (normal_random(0, summonBlock.chance) == 0 && (health > mType->info.runAwayHealth || normal_random(1, 3) == 1)) {
|
if (uniform_random(0, summonBlock.chance) == 0 && (health > mType->info.runAwayHealth || uniform_random(1, 3) == 1)) {
|
||||||
Monster* summon = Monster::createMonster(summonBlock.name);
|
Monster* summon = Monster::createMonster(summonBlock.name);
|
||||||
if (summon) {
|
if (summon) {
|
||||||
const Position& summonPos = getPosition();
|
const Position& summonPos = getPosition();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user