hallux
New Member
hey, i hope this is right section!! i am currently trying to make my spells relying on this "case" in combat.cpp a bit more accurate! ill show you my attempt then i will explain what i really want!
old code:
my attempt:
this as you can see makes the min and max be able to be configured. However the problem is when you use "weapon->getWeaponDamage" you get the final damage so your damage is made random and can often hit 0 (a miss).
what i would like to do is perhaps get the pre-existing maxweapondamage from weapons.cpp and use that value to then be multiplied by mina or maxa..
i have a little experiance with c++ but go easy on me please
thanks!!
im using tfs 3.4pl2
old code:
Code:
case FORMULA_SKILL:
{
min = (int32_t)minb;
Item* tool = player->getWeapon();
if(const Weapon* weapon = g_weapons->getWeapon(tool))
{
max = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb);
if(params.useCharges && tool->hasCharges() && g_config.getBool(ConfigManager::REMOVE_WEAPON_CHARGES))
g_game.transformItem(tool, tool->getID(), std::max((int32_t)0, ((int32_t)tool->getCharges()) - 1));
}
else
max = (int32_t)maxb;
my attempt:
Code:
case FORMULA_SKILL:
{
Item* tool = player->getWeapon();
if(const Weapon* weapon = g_weapons->getWeapon(tool))
{
min = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * mina + minb);
max = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb);
if(params.useCharges && tool->hasCharges() && g_config.getBool(ConfigManager::REMOVE_WEAPON_CHARGES))
g_game.transformItem(tool, tool->getID(), std::max((int32_t)0, ((int32_t)tool->getCharges()) - 1));
}
else
max = (int32_t)maxb;
this as you can see makes the min and max be able to be configured. However the problem is when you use "weapon->getWeaponDamage" you get the final damage so your damage is made random and can often hit 0 (a miss).
what i would like to do is perhaps get the pre-existing maxweapondamage from weapons.cpp and use that value to then be multiplied by mina or maxa..
i have a little experiance with c++ but go easy on me please
thanks!!
im using tfs 3.4pl2