invertika_game.Game.Being.damage C# (CSharp) Method

damage() private method

private damage ( Actor source, Damage damage ) : int
source Actor
damage Damage
return int
        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;
        }