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:
Alejandro Mujica
2019-02-05 12:42:16 -04:00
parent 2412e3a825
commit 1aaa6288a8
3 changed files with 17 additions and 15 deletions

View File

@@ -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;