Пример #1
0
        int performAttack(Being target, Damage damage)
        {
            //// check target legality
            //if (!target
            //        || target == this
            //        || target.getAction() == DEAD
            //        || !target.canFight())
            //    return -1;

            //if (getMap().getPvP() == PVP_NONE
            //        && target.getType() == OBJECT_CHARACTER
            //        && getType() == OBJECT_CHARACTER)
            //    return -1;

            //// check if target is in range using the pythagorean theorem
            //int distx = this.getPosition().x - target.getPosition().x;
            //int disty = this.getPosition().y - target.getPosition().y;
            //int distSquare = (distx * distx + disty * disty);
            //int maxDist = damage.range + target.getSize();
            //if (maxDist * maxDist < distSquare)
            //    return -1;

            //// Note: The auto-attack system will handle the delay between two attacks.

            //return (mTarget.damage(this, damage));

            return 0; //ssk
        }
Пример #2
0
        int damage(Actor source, Damage damage)
        {
            //    if (mAction == DEAD)
            //        return 0;

            //    int HPloss = damage.base;
            //    if (damage.delta)
            //        HPloss += rand() * (damage.delta + 1) / RAND_MAX;

            //    // TODO magical attacks and associated elemental modifiers
            //    switch (damage.type)
            //    {
            //        case DAMAGE_PHYSICAL:
            //            if (!damage.trueStrike &&
            //                rand()%((int) getModifiedAttribute(ATTR_DODGE) + 1) >
            //                    rand()%(damage.cth + 1))
            //            {
            //                HPloss = 0;
            //                // TODO Process triggers for a dodged physical attack here.
            //                // If there is an attacker included, also process triggers for the attacker (failed physical strike)
            //            }
            //            else
            //            {
            //                HPloss = HPloss * (1.0 - (0.0159375f *
            //                                          getModifiedAttribute(ATTR_DEFENSE)) /
            //                                   (1.0 + 0.017 *
            //                                    getModifiedAttribute(ATTR_DEFENSE))) +
            //                         (rand()%((HPloss >> 4) + 1));
            //                // TODO Process triggers for receiving damage here.
            //                // If there is an attacker included, also process triggers for the attacker (successful physical strike)
            //            }
            //            break;
            //        case DAMAGE_MAGICAL:
            //#if 0
            //            getModifiedAttribute(BASE_ELEM_BEGIN + damage.element);
            //#else
            //            LOG_WARN("Attempt to use magical type damage! This has not been"
            //                      "implemented yet and should not be used!");
            //            HPloss = 0;
            //#endif
            //        case DAMAGE_DIRECT:
            //            break;
            //        default:
            //            LOG_WARN("Unknown damage type '" << damage.type << "'!");
            //            break;
            //    }

            //    if (HPloss > 0)
            //    {
            //        mHitsTaken.push_back(HPloss);
            //        Attribute &HP = mAttributes.at(ATTR_HP);
            //        LOG_DEBUG("Being " << getPublicID() << " suffered " << HPloss
            //                  << " damage. HP: "
            //                  << HP.getModifiedAttribute() << "/"
            //                  << mAttributes.at(ATTR_MAX_HP).getModifiedAttribute());
            //        setAttribute(ATTR_HP, HP.getBase() - HPloss);
            //        // No HP regen after being hit if this is set.
            //        setTimerSoft(T_B_HP_REGEN,
            //                     Configuration::getValue("game_hpRegenBreakAfterHit", 0));
            //    }
            //    else
            //    {
            //        HPloss = 0;
            //    }

            //    return HPloss;

            return 0;
        }