public float SkillDifCalculation(Item weapon, Mobile m) { float dif = 0f; // i must find some formula for this if(this is Character) { int skid = weapon.GetSkillId(); if ( skid != 0 ) { Skill sk3 = this.AllSkills[(ushort)skid]; if (sk3 != null) { if (m is Character) { /* not sure by this formula*/ Skill sk4 = m.AllSkills[(ushort)DefenseSkill.SkillId]; dif = (float)(sk3.CurrentVal(this) - sk4.CurrentVal(m))/5; } else dif = (float)(sk3.CurrentVal(this) - m.Level*5)/5; } } } else { if (m is Character) { /* not sure by this formula*/ Skill sk5 = m.AllSkills[(ushort)DefenseSkill.SkillId]; dif = (float)(5*this.Level - sk5.CurrentVal(m))/5; } else dif = (float)(5*this.Level - m.Level*5)/5; } return dif; }
public float RangedCriticalChanceCalculation(Item weapon,Mobile m) { float critChance = 5f; // for creatures base is 5% if(this is Character) { int skid = weapon.GetSkillId(); critChance = (this as Character).BaseCritChance; if ( skid != 0 ) { Skill sk2 = this.AllSkills[(ushort)skid]; if (sk2 != null) { if (m is Character) { /* not sure by this formula*/ Skill sk1 = m.AllSkills[(ushort)DefenseSkill.SkillId]; critChance += (float)(sk2.CurrentVal(this) - sk1.CurrentVal(m))/5; } else critChance += (float)(sk2.CurrentVal(this) - m.Level*5)/5; } } } else { if (m is Character) { /* not sure by this formula*/ Skill sk1 = m.AllSkills[(ushort)DefenseSkill.SkillId]; critChance += (float)(5*this.Level - sk1.CurrentVal(m))/5; } else critChance += (float)(5*this.Level - m.Level*5)/5; } switch (this.Classe) { case Classes.Rogue : break; case Classes.Hunter : break; case Classes.Druid : break; case Classes.Warrior : if (this.HaveTalent(Talents.AxeSpecialization) && weapon.SubClass == 0 ) { AuraEffect effect1 = (AuraEffect) this.GetTalentEffect(Talents.AxeSpecialization); critChance +=effect1.S1; } if (this.HaveTalent(Talents.PolearmSpecialization) && weapon.SubClass == 6 ) { AuraEffect effect1 = (AuraEffect) this.GetTalentEffect(Talents.PolearmSpecialization); critChance +=effect1.S1; } if (this.HaveTalent(Talents.Cruelty) && weapon.ObjectClass == 2) { AuraEffect effect1 = (AuraEffect) this.GetTalentEffect(Talents.Cruelty); critChance +=effect1.S1; } break; } critChance +=(float)this.PhysicalCriticalBonus; return critChance; }
public bool SkillUpWeapon(Item weapon) { if ( attackTarget == null ) return false; int prob = Level * 5; if ( weapon == null ) { weapon = activeWeapon = ChooseWeapon(); } if ( this is Character ) { int skid = weapon.GetSkillId(); if ( skid != 0 ) { Skill sk = allSkills[ (ushort)skid ]; if ( sk == null ) { Console.WriteLine("Unknown skill id for weapon {0} = id = {1} class {2}. Please send that to DrNexus !!!!!!!!", weapon.Name, skid, this.Classe ); return false; } if ( sk.Current >= sk.Cap( this ) ) return false; prob = sk.CurrentVal(this); int diff = Difficulty( prob, attackTarget.Level * 5 ); if ( SkillUp( sk.Current, diff, 0.01 ) ) { sk.Current++; if ( this is Character ) ( this as Character ).SendSkillUpdate(); } } if ( StatUp( str, prob, 1 ) ) str++; } return true; }