• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

TFS 1.X+ Weapon and Defense system

CastorFlynn

Member
Joined
Aug 29, 2021
Messages
71
Reaction score
8
I noticed that using a one handed weapon + shield it ignores the weapon's defense, is this normal? If weapon have extradef this count, but normal def not.
 

Glaszcz Koldre

Active Member
Joined
Mar 16, 2016
Messages
52
Reaction score
38
weapon + shield = only shield deff counts and shielding skill
Only weapon either 1 or 2 handed = weapon deff counts and melee skill.

For example 30 deff shield and 100 shielding is the same as 30 deff from weapon and 100 melee skill.
 

chucky91

Well-Known Member
Joined
Apr 8, 2010
Messages
204
Solutions
9
Reaction score
96
I verified that if you use a two-handed weapon with defense, like enchanted staff that has 45 defense, don't defend anything.
Because I've been watching some tibia videos old time, and that a player could defend the attack even with low weapon defense, and it wasn't block armor. so i made some changes in player.cpp
And now work weapon+shield or only weapon or shield.
C++:
if (weapon) {
        totalDefense = weapon->getDefense() + 1;

        switch (weapon->getWeaponType()) {
            case WEAPON_AXE:
                defenseSkill = getSkillLevel(SKILL_SHIELD);
                break;
            case WEAPON_SWORD:
                defenseSkill = getSkillLevel(SKILL_SHIELD);
                break;
            case WEAPON_CLUB:
                defenseSkill = getSkillLevel(SKILL_SHIELD);
                break;
            case WEAPON_DISTANCE:
            case WEAPON_AMMO:
                defenseSkill = getSkillLevel(SKILL_SHIELD);
                break;
            default:
                break;
        }
    }
 

chucky91

Well-Known Member
Joined
Apr 8, 2010
Messages
204
Solutions
9
Reaction score
96
The previous behavior was supposed to be with getSkillLevel()
C++:
if (weapon) {
        totalDefense = weapon->getDefense() + 1;

        switch (weapon->getWeaponType()) {
            case WEAPON_AXE:
                defenseSkill = getSkillLevel(SKILL_AXE);
                break;
            case WEAPON_SWORD:
                defenseSkill = getSkillLevel(SKILL_SWORD);
                break;
            case WEAPON_CLUB:
                defenseSkill = getSkillLevel(SKILL_CLUB);
                break;
            case WEAPON_DISTANCE:
            case WEAPON_AMMO:
                defenseSkill = getSkillLevel(SKILL_SHIELD);
                break;
            default:
                break;
        }
    }
 

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,991
Solutions
9
Reaction score
322
Location
Chile
The previous behavior was supposed to be with getSkillLevel()
C++:
if (weapon) {
        totalDefense = weapon->getDefense() + 1;

        switch (weapon->getWeaponType()) {
            case WEAPON_AXE:
                defenseSkill = getSkillLevel(SKILL_AXE);
                break;
            case WEAPON_SWORD:
                defenseSkill = getSkillLevel(SKILL_SWORD);
                break;
            case WEAPON_CLUB:
                defenseSkill = getSkillLevel(SKILL_CLUB);
                break;
            case WEAPON_DISTANCE:
            case WEAPON_AMMO:
                defenseSkill = getSkillLevel(SKILL_SHIELD);
                break;
            default:
                break;
        }
    }
Where should the code be placed?
 
Top