View unanswered posts | View active topics It is currently Sun Nov 24, 2024 12:53 am



Reply to topic  [ 5 posts ] 
Damage Calc 
Author Message
Gnoll Commander

Joined: Tue Mar 04, 2014 9:48 pm
Posts: 65
Does anyone know the damage calc for melee and magic damage? I am trying to test out a few combinations and some of the results seem a bit strange so far.


Wed Apr 09, 2014 7:08 pm
Profile
Orc Warlord

Joined: Sun Apr 13, 2014 6:25 am
Posts: 80
I would also like to know this, as well as how life and mana leech are applied.


Sun Apr 13, 2014 6:28 am
Profile
Site Admin
User avatar

Joined: Thu Jan 03, 2013 12:56 am
Posts: 4133
Location: Crofton, Maryland
Let's say you have +10 life leech.
Let's say you're on normal difficulty.
Let's say you just backstabbed for 500 damage.
30% of that physical damage is leechable.
So reduce it to 150 damage.
You will leech 10% of that.
You leech 15 health.

So in reality +10 life leech is actually 3% life leech on normal difficulty.
On nightmare this drops to 2%.
On hell this drops to 1.5%.

_________________
Nevergrind - Web Browser RPG
Nevergrind 2 Test Server
Firmament Wars - Multiplayer Grand Strategy Warfare
YouTube | Facebook | Discord


Sun Apr 13, 2014 11:30 am
Profile WWW
Site Admin
User avatar

Joined: Thu Jan 03, 2013 12:56 am
Posts: 4133
Location: Crofton, Maryland
I wouldn't mind explaining the damage calc, but it hurts my head just thinking about it. Just know the damage/delay and attack are probably the most important things for melee damage. Spell damage is much more straight-forward and is tied to your spell skill level and of course gets altered by stuff like +% magic damage just like physical damage does, too.

_________________
Nevergrind - Web Browser RPG
Nevergrind 2 Test Server
Firmament Wars - Multiplayer Grand Strategy Warfare
YouTube | Facebook | Discord


Sun Apr 13, 2014 11:46 am
Profile WWW
Site Admin
User avatar

Joined: Thu Jan 03, 2013 12:56 am
Posts: 4133
Location: Crofton, Maryland
Feel free to sift the code if you're insane enough to try reading my awful code. Some trivial non-topic lines removed for your sanity:

Determine if hit is a crit, assess skill cost,
Code:
function calculateSkillDamage(minDamage, skillName, multiplier, manaCost, Slot){
   var zig=~~(normalizedDamage(minDamage, skillName, multiplier));
   var damage = zig;
   damage += zig/5;
   //calculate damage and crit chance
   var thisCrit = ( (criticalChance()/100)+coldBloodBonus );
   if(Math.random() >= thisCrit){
      myPhysicalDamage(damage, Slot, skillName, false);
   }else{
      damage=Math.ceil(damage + damage*(criticalDamage()/100));
      myPhysicalDamage(damage, Slot, skillName, true);
      // class crit skills
   }


Normalize a random base damage value for melee skills using primary melee weapon (off-hand weapons do not affect skill damage)
Code:
function normalizedDamage(minDamage, skillName, multiplier){
   //1h calc
   if(eq[12].type==="slashed"||eq[12].type==="crushed"||eq[12].type==="punched"||eq[12].type==="pierced"){
      var foo = Math.random()*( ((eq[12].damage/(totalHaste1()))*30000)*(attackFunct()/1200) );
   }else{//2h calc
      var foo = Math.random()*( ((eq[12].damage/(totalHaste1()))*20000)*(attackFunct()/1200) );
   }
   foo = Math.round(foo * multiplier + minDamage);
   return foo;
}


Commit physical damage:
Code:
function myPhysicalDamage(damage, Slot, skillName, crit, identifyRightHand){
   if(mob[TGT].name===""){ return; }
   if(evadeStatus===true){
      evadeStatus=false;
      damage=(damage*1.6);
      evadeBash();
   }
   if(damage<=1){ damage=1; }
   //%increases
   var phyEnh = enhancePhysicalEquip;
   if(yaulpStatus===true){ phyEnh+=yaulpBonus; }
   if(ancestralRampageStatus===true){ phyEnh+=40; }
   if(mob[Slot].faerieFlameTickCount>0){ phyEnh+=15; }
   if(mob[Slot].frozenStatus===true){
      var shatterBonus = 0;
      if(mob[Slot].shatterStatus===true){
         $("#iceIcon"+Slot).animate({opacity:0},500,function(){ $(this).remove(); });
         shatterBonus = 25;
         clearTimeout(mob[Slot].shatterTimer);
         mob[Slot].frozenStatus=false;
         mob[Slot].shatterStatus=false;
      }
      damage = Math.round(damage*1.25+shatterBonus);
      phyEnh+=(25+shatterBonus);
   }
   damage = (damage+(damage*(phyEnh/100)));
   //mob defense adjustment
   damage = Math.ceil(damage*(1-((mobDefense(Slot)/4)/100) ) );
   //damage negation
   if(mob[Slot].riftStatus===true){
      var stasisCheck = Math.random();
      if(stasisCheck>(.3+(conjurationTotal()/500))){ //do nothing
      }else{
         damage = 0;
         slotDamage(damage, Slot);
         return damage;
      }
   }
   if(mob[Slot].stasisFieldStatus===true){
      if(my.job==="Magician"){
         damage = 0;
         slotDamage(damage, Slot);
         return damage;
      }
   }
   //elemental damage highestElement
   var eDmg = 0;
   if(poisonDamageEquip>0){
      var Pboost = 1+(enhanceAllEquip+enhancePoisonEquip)/100;
      eDmg+=((Pboost*poisonDamageEquip)*(1-((mob[Slot].poison/4)/100) ));   
   }
   if(magicDamageEquip>0){
      var Mboost = 1+(enhanceAllEquip+enhanceMagicEquip)/100;
      eDmg+=((Mboost*magicDamageEquip)*(1-((mob[Slot].magic/4)/100) ));
   }
   if(lightningDamageEquip>0){
      var Lboost = 1+(enhanceAllEquip+enhanceLightningEquip)/100;
      eDmg+=((Lboost*lightningDamageEquip)*(1-((mob[Slot].lightning/4)/100) ));
   }
   if(coldDamageEquip>0){
      var Cboost = 1+(enhanceAllEquip+enhanceColdEquip)/100;
      eDmg+=((Cboost*coldDamageEquip)*(1-((mob[Slot].cold/4)/100) ));
   }
   if(fireDamageEquip>0){
      var Fboost = 1+(enhanceAllEquip+enhanceFireEquip)/100;
      eDmg+=((Fboost*fireDamageEquip)*(1-((mob[Slot].fire/4)/100) ));
   }
   //physical bonus
   if(physicalDamageEquip>0){
      damage = damage + (Math.random()*(physicalDamageEquip*(1-((mobDefense(Slot)/4)/100) ) ) );
   }
   if(eDmg>0){
      if(eDmg<1){ eDmg=1; }
      eDmg = Math.ceil(Math.random()*eDmg);
      myElementalDamage(highestElement, eDmg, Slot);
   }
   damage = Math.round(damage);
   //level check   
   if(mob[Slot].level>my.level){
      levelDifference = 1-(mob[Slot].level-my.level)/100;
      damage=~~(damage*levelDifference)
   }
   if(damage <= 1){ damage = Math.ceil(Math.random()*(my.level/10)); }
   if(damage > 9999){ damage = 9999; }
   //commit damage
   if(mob[Slot].phased===true){ damage=Math.ceil(damage/2); }
   if(mob[Slot].runeHp>0){
      mob[Slot].runeHp-=damage;
      if(mob[Slot].runeHp<=0){ $("#MruneIcon"+Slot).remove(); }
      playAudio("blockBlunt");
   }else{
      mob[Slot].hp-=damage;
      if(skillName==="attack"){
         if(identifyRightHand===true){
            var kek = eq[12].type;
            if(kek==="staff"){ kek="smashed"; }
            //Chat("You "+kek+" "+mob[Slot].name+" for "+damage+" damage.");
         }
         if(identifyRightHand===false){
            //Chat("You "+eq[13].type+" "+mob[Slot].name+" for "+damage+" damage.");
         }
      }
   }


Example melee skill using Rogue's Shadow Strike:
Code:
function shadowStrike(){
   if($NG.shadowstrikeId.hasClass("disabled")===true){return;}
   if(checkBashFear()===true){ return; }
   beginGlobalCooldown();
   var skillName = "Shadow Strike";
   var multiplier = .6;
   var minDamage = 2+(Math.ceil((1.5*offenseTotal()/16)+(weaponSkillCheck()/4.4)/1.5));
   var manaCost = 0;
   calculateSkillDamage(minDamage, skillName, multiplier, manaCost);
}

_________________
Nevergrind - Web Browser RPG
Nevergrind 2 Test Server
Firmament Wars - Multiplayer Grand Strategy Warfare
YouTube | Facebook | Discord


Sun Apr 13, 2014 12:00 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: Google [Bot] and 111 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software