mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-06-15 05:14:29 +02:00
Bug Fixes
Fixed an issue that caused players to increase distance fighting by wielding a distance weapon on hands and on ammunition slots. Fixed an issue with monster yelling (C code not compatible with C++ entirely, thank you IDA).
This commit is contained in:
parent
2412e3a825
commit
1aaa6288a8
@ -830,7 +830,7 @@ bool Combat::attack(Creature* attacker, Creature* target)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Combat::closeAttack(Creature* attacker, Creature* target, fightMode_t fightMode)
|
||||
bool Combat::closeAttack(Creature* attacker, Creature* target, fightMode_t fightMode, bool fist)
|
||||
{
|
||||
const Position& attackerPos = attacker->getPosition();
|
||||
const Position& targetPos = target->getPosition();
|
||||
@ -855,7 +855,7 @@ bool Combat::closeAttack(Creature* attacker, Creature* target, fightMode_t fight
|
||||
uint32_t skillValue = 0;
|
||||
uint8_t skill = SKILL_FIST;
|
||||
|
||||
Combat::getAttackValue(attacker, attackValue, skillValue, skill);
|
||||
Combat::getAttackValue(attacker, attackValue, skillValue, skill, fist);
|
||||
|
||||
int32_t defense = target->getDefense();
|
||||
|
||||
@ -958,9 +958,9 @@ bool Combat::rangeAttack(Creature* attacker, Creature* target, fightMode_t fight
|
||||
if (weapon->getWeaponType() == WEAPON_DISTANCE) {
|
||||
ammunition = player->getAmmunition();
|
||||
if (weapon->getAmmoType() != AMMO_NONE) {
|
||||
if (!ammunition || weapon->getAmmoType() != ammunition->getAmmoType()) {
|
||||
if (!ammunition || ammunition->getWeaponType() != WEAPON_AMMO || weapon->getAmmoType() != ammunition->getAmmoType()) {
|
||||
// redirect to fist fighting
|
||||
return closeAttack(attacker, target, fightMode);
|
||||
return closeAttack(attacker, target, fightMode, true);
|
||||
}
|
||||
|
||||
distanceEffect = ammunition->getMissileType();
|
||||
@ -1007,7 +1007,7 @@ bool Combat::rangeAttack(Creature* attacker, Creature* target, fightMode_t fight
|
||||
}
|
||||
}
|
||||
|
||||
if (ammunition && weapon->getAmmoType() != AMMO_NONE && weapon->getAmmoType() == ammunition->getAmmoType()) {
|
||||
if (ammunition && ammunition->getWeaponType() == WEAPON_AMMO && weapon->getAmmoType() != AMMO_NONE && weapon->getAmmoType() == ammunition->getAmmoType()) {
|
||||
hitChance = 90; // bows and crossbows
|
||||
specialEffect = ammunition->getWeaponSpecialEffect();
|
||||
attackStrength = ammunition->getAttackStrength();
|
||||
@ -1178,13 +1178,13 @@ void Combat::circleShapeSpell(Creature* attacker, const Position& toPos, int32_t
|
||||
}
|
||||
}
|
||||
|
||||
void Combat::getAttackValue(Creature* creature, uint32_t& attackValue, uint32_t& skillValue, uint8_t& skill)
|
||||
void Combat::getAttackValue(Creature* creature, uint32_t& attackValue, uint32_t& skillValue, uint8_t& skill, bool fist)
|
||||
{
|
||||
skill = SKILL_FIST;
|
||||
|
||||
if (Player* player = creature->getPlayer()) {
|
||||
Item* weapon = player->getWeapon();
|
||||
if (weapon) {
|
||||
if (weapon && !fist) {
|
||||
switch (weapon->getWeaponType()) {
|
||||
case WEAPON_AXE: {
|
||||
skill = SKILL_AXE;
|
||||
|
@ -285,12 +285,12 @@ class Combat
|
||||
static int32_t getTotalDamage(int32_t attackSkill, int32_t attackValue, fightMode_t fightMode);
|
||||
|
||||
static bool attack(Creature* attacker, Creature* target);
|
||||
static bool closeAttack(Creature* attacker, Creature* target, fightMode_t fightMode);
|
||||
static bool closeAttack(Creature* attacker, Creature* target, fightMode_t fightMode, bool fist = false);
|
||||
static bool rangeAttack(Creature* attacker, Creature* target, fightMode_t fightMode);
|
||||
|
||||
static void circleShapeSpell(Creature* attacker, const Position& toPos, int32_t range, int32_t animation, int32_t radius, DamageImpact* impact, int32_t effect);
|
||||
|
||||
static void getAttackValue(Creature* creature, uint32_t& attackValue, uint32_t& skillValue, uint8_t& skill);
|
||||
static void getAttackValue(Creature* creature, uint32_t& attackValue, uint32_t& skillValue, uint8_t& skill, bool fist = false);
|
||||
|
||||
static bool doCombatHealth(Creature* caster, Creature* target, CombatDamage& damage, const CombatParams& params);
|
||||
static void doCombatHealth(Creature* caster, const Position& position, const AreaCombat* area, CombatDamage& damage, const CombatParams& params);
|
||||
|
@ -1028,13 +1028,15 @@ void Monster::onThinkYell(uint32_t)
|
||||
|
||||
int32_t randomResult = rand();
|
||||
if (rand() == 50 * (randomResult / 50)) {
|
||||
int32_t totalVoices = mType->info.voiceVector.size();
|
||||
const voiceBlock_t& voice = mType->info.voiceVector[rand() % totalVoices + 1];
|
||||
if (!mType->info.voiceVector.empty()) {
|
||||
uint32_t index = uniform_random(0, mType->info.voiceVector.size() - 1);
|
||||
const voiceBlock_t& vb = mType->info.voiceVector[index];
|
||||
|
||||
if (voice.yellText) {
|
||||
g_game.internalCreatureSay(this, TALKTYPE_MONSTER_YELL, voice.text, false);
|
||||
} else {
|
||||
g_game.internalCreatureSay(this, TALKTYPE_MONSTER_SAY, voice.text, false);
|
||||
if (vb.yellText) {
|
||||
g_game.internalCreatureSay(this, TALKTYPE_MONSTER_YELL, vb.text, false);
|
||||
} else {
|
||||
g_game.internalCreatureSay(this, TALKTYPE_MONSTER_SAY, vb.text, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user