Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-16-2003, 01:54 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Heres the code for it...

// This is a Ranged Weapon Attack / Bow
const Item_Struct* Rangeweapon = 0;
const Item_Struct* Ammo = 0;
Rangeweapon = database.GetItem(pp.inventory[11]);
Ammo = database.GetItem(pp.inventory[21]);

if (!Rangeweapon) {
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", pp.inventory[11]);
break;
}

if (!Ammo) {
Message(0, "Error: Ammo: GetItem(%i)==0, you have nothing to throw!", pp.inventory[11]);
break;
}

uint8 WDmg = Rangeweapon->common.damage;
uint8 ADmg = Ammo->common.damage;

// These dmg formulae were taken from all over the net.
//No-one knows but Verant. This should be fairly close -BoB
// ** ToDO: take into account trueshot disc (x2.0) and
// Archery Mastery AA when they are available.
// I am still looking for 'double' information too.
// Note: Rangers have a chance of crit dmg with a bow (affected by Dex)

uint8 levelBonus = (pp.STR+pp.level+GetSkill(ARCHERY)) / 100;
uint8 MaxDmg = (WDmg+ADmg)*levelBonus;

sint32 TotalDmg = 0;
sint32 critDmg = 0;

if(GetClass()==RANGER)
{
critDmg = (sint32)(MaxDmg * 1.72);
}

if (MaxDmg == 0)
MaxDmg = 1;

TotalDmg = 1 + rand()%MaxDmg;

// TODO: post 50 dmg bonus
// TODO: Tone down the PvP dmg
// borrowed this from attack.cpp
// chance to hit

float chancetohit = GetSkill(ARCHERY) / 3.75;
if (pp.level-target->GetLevel() < 0) {
chancetohit -= (float)((target->GetLevel()-pp.level)*(target->GetLevel()-pp.level))/4;
}

int16 targetagi = target->GetAGI();
int16 playerDex = (int16)(this->itembonuses->DEX + this->spellbonuses->DEX)/2;

targetagi = (targetagi <= 200) ? targetagi:targetagi + ((targetagi-200)/5);

chancetohit -= (float)targetagi*0.05;

chancetohit += playerDex;
chancetohit = (chancetohit > 0) ? chancetohit+30:30;
chancetohit = chancetohit > 95 ? 95 : chancetohit; /* cap to 95% */

// Hit?
if (((float)rand()/RAND_MAX)*100 > chancetohit)
{
this->Message(MT_Emote, "You missed your target");
target->CastToNPC()->Damage(this, 0, 0xffff, 0x07);
}
else
{
// no crits before level 12 cap is maxed
if((GetClass()==RANGER)&&(GetSkill(ARCHERY )>65)&&(rand()%255<(GetSkill(ARCHERY)+p layerDex)/2)&&(chancetohit > 85))
{
this->Message(MT_Emote, "You score a critical hit!(%d)", critDmg);
target->CastToNPC()->Damage(this, critDmg, 0xffff, 0x07);
}
else
{
this->Message(MT_Emote, "You Hit for a total of %d non-melee damage.", TotalDmg);
target->CastToNPC()->Damage(this, TotalDmg, 0xffff, 0x07);
}



So, from this we see max damage is ..

uint8 WDmg = Rangeweapon->common.damage;
uint8 ADmg = Ammo->common.damage;
// These dmg formulae were taken from all over the net.
//No-one knows but Verant. This should be fairly close -BoB
// ** ToDO: take into account trueshot disc (x2.0) and
// Archery Mastery AA when they are available.
// I am still looking for 'double' information too.
// Note: Rangers have a chance of crit dmg with a bow (affected by Dex)

uint8 levelBonus = (pp.STR+pp.level+GetSkill(ARCHERY)) / 100;
uint8 MaxDmg = (WDmg+ADmg)*levelBonus;
sint32 TotalDmg = 0;
sint32 critDmg = 0;


So, max damage should for a 150 damage bow with dmg. 7 arrows,

(150+7) * lvlBonus, where levelbonus is STR+LEVEL+SKILL/100, so assume a Str of 100, level of 20, and skill of 100, and you get 220/100 = 2 by integer division, so max damage should be

157*2 = 314

Then

if (MaxDmg == 0)
MaxDmg = 1;
TotalDmg = 1 + rand()%MaxDmg;

so, damage done on a noncrit for a 150 damage weapon should be
between 1 and 315...

Why its not? My guess is theres an integer division going on screweing something up, or theres an int8 or 2 in there screwing up the calculation.
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:50 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3