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

Solved poison field bugged

johnsamir

Advanced OT User
Joined
Oct 13, 2009
Messages
994
Solutions
6
Reaction score
168
Location
Nowhere
Hi

I USE TFS 1.4 protocol 8.6
here the poison field is bugged it only takes the first step after that, when you walk on fields nothings happens

Lua:
<item id="1490" article="a" name="poison field">
        <attribute key="type" value="magicfield" />
        <attribute key="decayTo" value="0" />
        <attribute key="duration" value="120" />
        <attribute key="field" value="poison">
            <attribute key="ticks" value="5000" />
            <attribute key="start" value="5" />
            <attribute key="damage" value="100" />
        </attribute>
    </item>

this is c++
Code:
bool ConditionDamage::startCondition(Creature* creature)
{
    if (!Condition::startCondition(creature)) {
        return false;
    }

    if (!delayed) {
        // delayed condition does no initial damage
        if (!doDamage(creature, initDamage)) {
            return false;
        }
    }

    if (!init()) {
        return false;
    }
    return true;
}

Code:
bool ConditionDamage::doDamage(Creature* creature, int32_t healthChange)
{
    if (creature->isSuppress(getType()) || creature->isImmune(getType())) {
        return false;
    }

    CombatDamage damage;
    damage.origin = ORIGIN_CONDITION;
    damage.primary.value = healthChange;
    damage.primary.type = Combat::ConditionToDamageType(conditionType);

    Creature* attacker = g_game.getCreatureByID(owner);
    if (field && creature->getPlayer() && attacker && attacker->getPlayer()) {
        damage.primary.value = static_cast<int32_t>(std::round(damage.primary.value / 2.));
    }

    if (!creature->isAttackable() || Combat::canDoCombat(attacker, creature) != RETURNVALUE_NOERROR) {
        if (!creature->isInGhostMode()) {
            g_game.addMagicEffect(creature->getPosition(), CONST_ME_POFF);
        }
        return false;
    }

    if (g_game.combatBlockHit(damage, attacker, creature, false, false, field)) {
        return false;
    }

    return g_game.combatChangeHealth(attacker, creature, damage);
}
any ideas how to fix this?
 
already have that commit :/
would like to review these
you probably missed something with initdamage in this commit
https://github.com/Zbizu/forgottenserver/commit/f183fb73dcbcbda64b16151f5e08247e5ae604ba

btw
duration accuracy update (+ energy field actually hits once, mb)
https://github.com/Zbizu/forgottenserver/commit/3cae1a43e6cc16f461974b14061fb7ef39c309ea
but not available anymore
Post automatically merged:

self explainatory video
Post automatically merged:

solved had to revert a commit
 
Last edited:
Back
Top