public void UseSkinning( Mobile.Casting cast, Character c, Mobile go ) { c.cast = cast; int rdiff = CurrentVal(c) - 1; int res = StrSkillCheck( c, rdiff ); if ( res > 50 && !go.Skinned ) { //c.SpellSuccess(); float reussite = (float)res; reussite = reussite / 10f; ArrayList loot = new ArrayList(); c.LootOwner = go.Guid; if ( go.SkinLoot != null ) { ArrayList sl = new ArrayList(); foreach( Loot l in go.SkinLoot ) { if ( Utility.RandomDouble() * 100 < l.Probability ) { int n = (int)( reussite * l.Probability ); sl.Add( l.Create( 1 ) ); } } if ( sl.Count == 0 ) { c.SpellFaillure( SpellFailedReason.FailedAttempt ); return; } go.Skinned = true; if ( Current < Cap( c ) && c.SkillUp( Current, rdiff, 1 ) ) { Current++; c.SendSkillUpdate(); } c.SpellSuccess(); c.previousSpellCasted = cast.id; go.Treasure = (Item[])sl.ToArray( typeof( Item ) ); c.SendLootDetails( go.Guid, go, 0 ); go.SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_DYNAMIC_FLAGS, (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { go.DynFlags( c ), go.Flags } ); } else c.SpellFaillure( SpellFailedReason.FailedAttempt ); } else { c.SpellFaillure( SpellFailedReason.FailedAttempt ); go.SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_DYNAMIC_FLAGS, (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { go.DynFlags( c ), go.Flags } ); } }
public bool SkillCheck(Mobile.Casting cast, Mobile c ) { if ( !( c is Character ) ) { c.SpellSuccess(); return false; } if ( resistance == Resistances.Arcane ) { Skill sk = c.AllSkills[ (ushort)arcaneSkill.Id ]; if ( sk != null )// met a jour avec le skill connu { int start = sk.Index; int rdiff = sk.CurrentVal(c); int res = sk.IqSkillCheck( c, rdiff ); if ( c is Character && sk.Current < sk.Cap( c ) && c.SkillUp( sk.Current, rdiff, 5 ) ) { sk.Current++; ( c as Character ).SendSmallUpdate( new int[]{ start, start + 1, start + 2 }, new object[]{ (int)arcaneSkill.Id, (short)arcaneSkill.CurrentVal(c), (short)arcaneSkill.Cap( c ), (int)0 } ); } if ( res > 25 ) c.SpellSuccess(); else c.SpellFaillure( SpellFailedReason.Fizzled ); } } else if ( resistance == Resistances.Frost ) { Skill sk = c.AllSkills[ (ushort)arcaneSkill.Id ]; if ( sk != null )// met a jour avec le skill connu { int start = sk.Index; int rdiff = sk.CurrentVal(c); int res = sk.IqSkillCheck( c, rdiff ); if ( c is Character && sk.Current < sk.Cap( c ) && c.SkillUp( sk.Current, rdiff, 5 ) ) { sk.Current++; ( c as Character ).SendSmallUpdate( new int[]{ start, start + 1, start + 2 }, new object[]{ (int)arcaneSkill.Id, (short)arcaneSkill.CurrentVal(c), (short)arcaneSkill.Cap( c ), (int)0 } ); } c.SendSmallUpdateToPlayerNearMe( new int[]{ 23 + c.ManaType }, new object[] { c.Mana } ); if ( res > -25 ) c.SpellSuccess(); else c.SpellFaillure( SpellFailedReason.Fizzled ); } } else if ( resistance == Resistances.Fire && ( c as Character ).Classe == Classes.Warlock ) { Skill sk = c.AllSkills[ (ushort)Destruction.SkillId ]; if ( sk != null )// met a jour avec le skill connu { int start = sk.Index; int rdiff = sk.CurrentVal(c); int res = sk.SpiritSkillCheck( c, rdiff ); if ( c is Character && sk.Current < sk.Cap( c ) && c.SkillUp( sk.Current, rdiff, 5 ) ) { sk.Current++; ( c as Character ).SendSmallUpdate( new int[]{ start, start + 1, start + 2 }, new object[]{ (int)arcaneSkill.Id, (short)arcaneSkill.CurrentVal(c), (short)arcaneSkill.Cap( c ), (int)0 } ); } c.SendSmallUpdateToPlayerNearMe( new int[]{ 23 + c.ManaType }, new object[] { c.Mana } ); if ( res > -25 ) c.SpellSuccess(); else c.SpellFaillure( SpellFailedReason.Fizzled ); } } else if ( resistance == Resistances.Fire ) { Skill sk = c.AllSkills[ (ushort)fireSkill.Id ]; if ( sk != null )// met a jour avec le skill connu { int start = sk.Index; int rdiff = sk.CurrentVal(c); int res = sk.IqSkillCheck( c, rdiff ); if ( c is Character && sk.Current < sk.Cap( c ) && c.SkillUp( sk.Current, rdiff, 5 ) ) { sk.Current++; ( c as Character ).SendSmallUpdate( new int[]{ start, start + 1, start + 2 }, new object[]{ (int)arcaneSkill.Id, (short)arcaneSkill.CurrentVal(c), (short)arcaneSkill.Cap( c ), (int)0 } ); } c.SendSmallUpdateToPlayerNearMe( new int[]{ 23 + c.ManaType }, new object[] { c.Mana } ); if ( res > -25 ) c.SpellSuccess(); else c.SpellFaillure( SpellFailedReason.Fizzled ); } } else if ( resistance == Resistances.Shadow ) { Skill sk = c.AllSkills[ (ushort)Affliction.SkillId ]; if ( sk != null )// met a jour avec le skill connu { int start = sk.Index; int rdiff = sk.CurrentVal(c); int res = sk.SpiritSkillCheck( c, rdiff ); if ( c is Character && sk.Current < sk.Cap( c ) && c.SkillUp( sk.Current, rdiff, 5 ) ) { sk.Current++; ( c as Character ).SendSmallUpdate( new int[]{ start, start + 1, start + 2 }, new object[]{ (int)arcaneSkill.Id, (short)arcaneSkill.CurrentVal(c), (short)arcaneSkill.Cap( c ), (int)0 } ); } c.SendSmallUpdateToPlayerNearMe( new int[]{ 23 + c.ManaType }, new object[] { c.Mana } ); if ( res > -25 ) c.SpellSuccess(); else c.SpellFaillure( SpellFailedReason.Fizzled ); } } else c.SpellSuccess(); return false; }