• 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!

TFS 1.X+ Why in getDefence() we getting fist skill as a defenceSkill

BulawOw

Soul of Shinobi
Joined
Sep 15, 2014
Messages
204
Solutions
8
Reaction score
62
C++:
int32_t Player::getDefense() const
{
    int32_t defenseSkill = getSkillLevel(SKILL_FIST); << -- here can somebody explain cause i dont see a clear reason why fist skill is considered as a defence
    int32_t defenseValue = 7;
    const Item* weapon;
    const Item* shield;
    getShieldAndWeapon(shield, weapon);

    if (weapon) {
        defenseValue = weapon->getDefense() + weapon->getExtraDefense();
        defenseSkill = getWeaponSkill(weapon);
    }

    if (shield) {
        defenseValue = weapon != nullptr ? shield->getDefense() + weapon->getExtraDefense() : shield->getDefense();
        defenseSkill = getSkillLevel(SKILL_SHIELD);
    }

    if (defenseSkill == 0) {
        switch (fightMode) {
            case FIGHTMODE_ATTACK:
            case FIGHTMODE_BALANCED:
                return 1;

            case FIGHTMODE_DEFENSE:
                return 2;
        }
    }

    return (defenseSkill / 4. + 2.23) * defenseValue * 0.15 * getDefenseFactor() * vocation->defenseMultiplier;
}

so im taking my time and learning while checking out sources and after noticing this i just dont get why
 
Solution
Using your fists is the equivalent of using a weapon with Atk:6, Def:5.
(The actual Def value of fist may be wrong.)
So basically fist is considered a weapon too and like in the weapons case when skill of weapon is used (in case of no shield) the fist fighting skill is used when no weapon and shield.
Using your fists is the equivalent of using a weapon with Atk:6, Def:5.
(The actual Def value of fist may be wrong.)
So basically fist is considered a weapon too and like in the weapons case when skill of weapon is used (in case of no shield) the fist fighting skill is used when no weapon and shield.
 
Solution
Back
Top