Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.86 KB | None | 0 0
  1. Backstab! First some very basic checks are made, making sure the character can actually backstab, setting up reuse time and haste's effect on it, and making sure the rogue is behind the mob and using a piercer. After that we check for assassinate:
  2. int asschance = 2; if (other->IsNPC() && !other->IsEngaged()) asschance = 20; if (IsClient() && CastToClient()->GetActiveAA(0) == 1) asschance = 100;
  3.  
  4. First we set up assassinate chance. Base chance to assassinate is 2%. If the mob is not aggroed on anything before the backstab hits, the chance jumps all the way up to 20%, making rogues 10 times more likely to assassinate if they sneak up behind a mob and starting the fight with it. And of course, if the rogue has clicked Lethal Strike, the chance is set to 100%.
  5. if(level >= 60 && other->IsNPC() && !other->CastToNPC()->Kaezulian() && other->GetLevel() <= 52+GetAA(204)*2 && Chance(asschance)
  6. Here we set up requisites, applicable targets, and exceptions for assassinate. The rogue must be 60 or higher, of course. The target must be 52 plus 2 for every rank of assassination mastery or lower to be assassinated. The assassinate chance has to succeed, and the mob must be alive and not invul. Finally, Kaezulian war mobs are not applicable assassinate targets for whatever reason.
  7.  
  8. if (IsClient()) CastToClient()->SetActiveAA(0,0); RogueAssassinate(other);
  9. } else {
  10. RogueBackstab(other, weapon1, GetEffectiveSkill(BACKSTAB));
  11. }
  12.  
  13. If assassinate succeeds, Lethal Strike is turned off (whether or not it was on) and the assassinate code is checked to occur later. If assassinate fails, the backstab damage code is checked to occur and gets the rogue's backstab skill to work with it. If the backstab button is hit and neither of those things happen:
  14.  
  15. else {
  16. if (GetAA(124)) { const Item_Struct* weapon1 = 0; if (IsClient() && CastToClient()->GetInv().GetItem(SLOT_PRIMARY)) weapon1 = CastToClient()->GetInv().GetItem(SLOT_PRIMARY)->GetItem(); RogueBackstab(other, weapon1, GetEffectiveSkill(BACKSTAB), true); } else { Attack(other, 13); }
  17. }
  18.  
  19. If the rogue is not behind the target, the game checks for Chaotic Stab. If chaotic stab is there, it sets up the weapon info and backstab skill for use in the backstab damage calc, AND sets the boolean check for "chaotic" to true. If the rogue doesn't have Chaotic Stab, they just to a regular primary hand attack.
  20. void Mob::RogueBackstab(Mob* other, const Item_Struct *weapon1, int16 bs_skill, bool chaotic)
  21. Here we finally get into the damage code. Relevant stuff is called up, and some boring checks are performed, such as checking for skill ups, checking to see if backstab has missed, and making sure backstabbing pets can't wake up mezzed mobs with it.
  22.  
  23. float number = 2; if (GetClass() == 9) { if (GetLevel() >= 65) number = 7; else if (GetLevel() >= 62) number = 6; else if (GetLevel() >= 59) number = 5; else if (GetLevel() >= 55) number = 4.5; else if (GetLevel() >= 50) number = 4; else if (GetLevel() >= 40) number = 3.5; else if (GetLevel() >= 30) number = 3; else if (GetLevel() >= 20) number = 2.5; }
  24. Here we set up the first BIG modifier, and it is totally level-based. This bit is pretty self explanatory so far; at 65, the modifier is 7.
  25. number += GetAA(103); if (chaotic) number /= 2;
  26.  
  27. This modifier is also where Improved Backstab comes into play. Each of the three ranks adds 1. This puts the max modifier at 65 at 10. This is also where Chaotic Stab gets its damage reduced; the modifier is cut in half for those.
  28. int damage = 0; if (IsClient()) { float recmod = GetRecLevelMod(weapon1->Common.RecommendedLevel); float weapon_damage = weapon1->Common.Damage*recmod; if (weapon1 && weapon1->Common.ElemDmgType > 0) { if (!CheckResist(0,other,weapon1->Common.ElemDmgType)) { weapon_damage += weapon1->Common.ElemDmg*recmod; } } if (weapon1 && weapon1->Common.BaneDmg > 0) { if ((weapon1->Common.BaneDmgBody > 0 && other->GetBodyType() == weapon1->Common.BaneDmgBody) || (weapon1->Common. weapon_damage += weapon1->Common.BaneDmg*recmod; }
  29.  
  30. Here we are just finding the mainhand piercer's total damage, with weapon elemental and bane damage taking into consideration.
  31.  
  32. weapon_damage *= 8; if (weapon_damage>80) weapon_damage += ((weapon_damage-79)/2); damage = SetDamage(other, weapon_damage,
  33. BACKSTAB)/5; damage *= number; }
  34.  
  35. This is where the fun really starts. Let's say we have an 18 damage piercer. First we multiply that by 8 (144). If that totals over 80 (i.e., the piercer's damage is over 10) this gets a relative bonus, putting our 18 damage piercer at 176.5. We send this value for weapon_damage off to the Damage Formula to be used as normal. After that is all figured out, the resulting damage value is multiplied by our modifier. (This is why high end rogue backstabs are always multiples of 10; it is in fact multiplied by 10 for them after all the damage is calced and the AC differences factored in and everything.)
  36. If a mob is a rogue using backstab they do a totally different thing which isn't really worth the time explaining but should be included for completeness' sake.
  37.  
  38. else
  39. {
  40. int16 mylevel = GetLevel(); int max_hit = CastToNPC()->max_dmg; if (max_hit == 0) { if (!GetOwner()) { if (mylevel < 45) max_hit = mylevel*2+2; else if (mylevel <= 50) max_hit = mylevel*2+12; else if (mylevel <= 53) max_hit = mylevel*3+2; else if (mylevel <= 56) max_hit = mylevel*3+12; else if (mylevel <= 59) max_hit = mylevel*4+2; else max_hit = mylevel*4+12; } else max_hit = mylevel+4; } int min_hit = max_hit/2; if(max_hit <= min_hit) damage = min_hit; else damage = rand()%(max_hit-min_hit) + min_hit; damage *= number; damage = ACEffects(other, damage);
  41. }
  42. For interest, some backstab ranges:
  43. Fully AA'd 65, 150 worn ATK, 250 backstab skill, 250 blade/strike, no ATK buffs, before mob AC, 18 dmg dagger: 2810 to 11270
  44. The same versus a lvl 68 mob with AC setting 0: 1010 to 9460
  45. The same with 17 dmg dagger before AC: 2620 to 10510
  46. Versus the same mob as above: 950 to 8820
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement