mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-12-25 10:27:12 +01:00
introduce changes from streamside fork
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Tibia GIMUD Server - a free and open-source MMORPG server emulator
|
||||
* Copyright (C) 2017 Alejandro Mujica <alejandrodemujica@gmail.com>
|
||||
* Copyright (C) 2019 Sabrehaven and Mark Samman <mark.samman@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -619,7 +619,8 @@ void Creature::onDeath()
|
||||
if (lastHitCreature) {
|
||||
lastHitUnjustified = lastHitCreature->onKilledCreature(this);
|
||||
lastHitCreatureMaster = lastHitCreature->getMaster();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lastHitCreatureMaster = nullptr;
|
||||
}
|
||||
|
||||
@@ -639,8 +640,9 @@ void Creature::onDeath()
|
||||
|
||||
if (attacker != this) {
|
||||
uint64_t gainExp = getGainedExperience(attacker);
|
||||
if (Player* player = attacker->getPlayer()) {
|
||||
Party* party = player->getParty();
|
||||
if (Player* attackerPlayer = attacker->getPlayer()) {
|
||||
attackerPlayer->removeAttacked(getPlayer());
|
||||
Party* party = attackerPlayer->getParty();
|
||||
if (party && party->getLeader() && party->isSharedExperienceActive() && party->isSharedExperienceEnabled()) {
|
||||
attacker = party->getLeader();
|
||||
}
|
||||
@@ -649,7 +651,8 @@ void Creature::onDeath()
|
||||
auto tmpIt = experienceMap.find(attacker);
|
||||
if (tmpIt == experienceMap.end()) {
|
||||
experienceMap[attacker] = gainExp;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
tmpIt->second += gainExp;
|
||||
}
|
||||
}
|
||||
@@ -752,15 +755,6 @@ void Creature::changeHealth(int32_t healthChange, bool sendHealthChange/* = true
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::changeMana(int32_t manaChange)
|
||||
{
|
||||
if (manaChange > 0) {
|
||||
mana += std::min<int32_t>(manaChange, getMaxMana() - mana);
|
||||
} else {
|
||||
mana = std::max<int32_t>(0, mana + manaChange);
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::gainHealth(Creature* healer, int32_t healthGain)
|
||||
{
|
||||
changeHealth(healthGain);
|
||||
@@ -778,16 +772,6 @@ void Creature::drainHealth(Creature* attacker, int32_t damage)
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::drainMana(Creature* attacker, int32_t manaLoss)
|
||||
{
|
||||
onAttacked();
|
||||
changeMana(-manaLoss);
|
||||
|
||||
if (attacker) {
|
||||
addDamagePoints(attacker, manaLoss);
|
||||
}
|
||||
}
|
||||
|
||||
BlockType_t Creature::blockHit(Creature* attacker, CombatType_t combatType, int32_t& damage,
|
||||
bool checkDefense /* = false */, bool checkArmor /* = false */, bool /* field = false */)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user