Hello everyone.
I have implemented the core pseudocode damage calculation (found in doc99), and the basedamage supplied by the core, doesn't match the damage produced by the custom function (its like 25% lower). I didn't do the attack hook, I just wanted to produce my own damage calculation for the core combat.
Does anyone know why it could be?
The combat pseudo-code isn't? [resolved]
Moderator: POL Developer
The combat pseudo-code isn't? [resolved]
Last edited by andenixa on Wed Feb 16, 2011 1:44 am, edited 1 time in total.
Re: The combat pseudo-code isn't?
Are you sure you calculated it correctly? I just went through the POL source code and compared it to the pseudo code and they match up exactly.
Re: The combat pseudo-code isn't?
I practically implemented it line by line. I would be much obliged if you could post the actual pol source snippet there. Perhaps then I could just translate it directly to eScript.
Re: The combat pseudo-code isn't?
http://docs.polserver.com/doxygen/docs/index.html
start with Character::attack()
start with Character::attack()
Re: The combat pseudo-code isn't?
Thanks a lot,
It does look like a pseudo-code you provided, though I didn't dig deep enough.
maybe the weapon damage formula is different.
What I did was:
But thats an improvisation, perhaps I am wrong.
It does look like a pseudo-code you provided, though I didn't dig deep enough.
maybe the weapon damage formula is different.
What I did was:
Code: Select all
var weapon_damage := (RandomDiceRoll( weapon_cfg_elem[weapon.objtype].Damage ) + weapon.dmg_mod) * weapon.quality;
// and then the rest of the damage_multiplier routine applies
Re: The combat pseudo-code isn't?
jep thats the problem
UWeapon::get_random_damage()
int dmg = int(tmpl->get_random_damage()) * hp_ / maxhp();
dmg += dmg_mod_;
or in escript:
var descriptor := GetItemDescriptor(weapon.objtype);
var dmg:=CInt(RandomDiceRoll( descriptor.Damage )*(weapon.hp/(descriptor.maxhp+weapon.maxhp_mod))+weapon.dmg_mod)
UWeapon::get_random_damage()
int dmg = int(tmpl->get_random_damage()) * hp_ / maxhp();
dmg += dmg_mod_;
or in escript:
var descriptor := GetItemDescriptor(weapon.objtype);
var dmg:=CInt(RandomDiceRoll( descriptor.Damage )*(weapon.hp/(descriptor.maxhp+weapon.maxhp_mod))+weapon.dmg_mod)
Re: The combat pseudo-code isn't?
Thanks a lot Turley,
This code gives values identical to the core:
PS: GetItemDescriptor() is roughly ~25x times slower than accessing :*:itemdesc
This code gives values identical to the core:
Code: Select all
function CalcBaseDamage( who )
var weapon := who.weapon;
// just in case
if( not weapon )
return 1;
endif
//or in escript:
var descriptor := GetItemDescriptor(weapon.objtype);
var random_weapon_die_damage :=
CInt(RandomDiceRoll( descriptor.Damage ) * (CDbl(weapon.hp)/(descriptor.maxhp+weapon.maxhp_mod))+weapon.dmg_mod);
var base_damage := random_weapon_die_damage;
var damage_multiplier := GetAttribute( who, "tactics" ) + 50;
damage_multiplier += GetAttribute( who, "strength" ) * 0.2;
damage_multiplier *= 0.01;
base_damage *= damage_multiplier;
return CInt(base_damage);
endfunction
Re: The combat pseudo-code isn't?
mmmh could be never did performance checks. But the function can easily be converted to use itemdesc instead of descriptor.andenixa wrote:PS: GetItemDescriptor() is roughly ~25x times slower than accessing :*:itemdesc