Monster to Player Magic Damage Calculation

02/11/2010 18:59 master15#1
Someone know the right calculation for MVP damage? I'm with small problemas at that... Ive tryied to many ways but never get the correct =/
02/11/2010 19:06 Kiyono#2
You know that this is the wrong section right?
02/11/2010 19:16 Korvacs#3
Moved.
02/12/2010 05:51 andyd123#4
Generally, though I'm not sure if I ever checked to make sure this was right, I don't see any reason why it shouldn't be.


Code:
int Damage = 0;
				if(Info.MinAttack < Info.MaxAttack)
					Damage = Nano.Rand.Next(Info.MinAttack, Info.MaxAttack);
				else
					Damage = Nano.Rand.Next(Info.MaxAttack, Info.MinAttack);
				Damage -= Attacked.Client.Defense;
				if(Attacked.Client.Reborn == 1)
				{
					Damage = (int)Math.Floor(Damage*.7);
				}
				else if(Attacked.Client.Reborn == 2)
				{
					Damage = (int)Math.Floor(Damage*.7);
					Damage = (int)Math.Floor(Damage*.5);
				}
				double Tort = 0;
				Tort += Attacked.Client.NTG*0.02;
				Tort += Attacked.Client.RTG*0.04;
				Tort += Attacked.Client.STG*0.06;
				Damage = (int)Math.Floor(Damage*(1-Tort));
				if(Attacked.Client.Bless > 0)
				{
					Damage = (int)Math.Floor(Damage * (1 - (Attacked.Client.Bless*0.01)));
				}
Textual explanation:
1. Generate random value between monster's min and max attack
2. Subtract exact physical defense (or, for magical attacks, subtract all magical defense)
3. Check if player is 1st or 2nd rbn, and reduce damage by 30% and/or 50%
4. Calculate tortoise gem reduction, subtract that
5. Take client's bless score (-1,3,5,7 items) and reduce damage by that amount
Good to go.