public override void OnDoubleClick( Mobile from ) { if ( !this.VerifyMove( from ) ) return; if ( !from.InRange( this.GetWorldLocation(), 2 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "I can't reach that." ); // I can't reach that. return; } Point3D fireLocation = GetFireLocation( from ); if ( fireLocation == Point3D.Zero ) { from.SendAsciiMessage( "There is not a spot nearby to place your campfire." ); // There is not a spot nearby to place your campfire. } else if ( !from.CheckSkill( SkillName.Camping, 0.0, 100.0 ) ) { from.SendAsciiMessage("You fail to ignite the campfire."); // You fail to ignite the campfire. } else { Consume(); if ( !this.Deleted && this.Parent == null ) from.PlaceInBackpack( this ); new Campfire(from).MoveToWorld( fireLocation, from.Map ); } }
public static TimeSpan OnUse( Mobile m ) { m.RevealingAction(); Timer t = m_Table[m] as Timer; if ( t != null && t.Running ) t.Stop(); if ( m.CheckSkill( SkillName.SpiritSpeak, 0, 100 ) ) { if ( t == null ) m_Table[m] = t = new SpiritSpeakTimer( m ); double secs = m.Skills[SkillName.SpiritSpeak].Base / 50; secs *= 90; if ( secs < 10 ) secs = 10; t.Delay = TimeSpan.FromSeconds( secs );//15 seconds to 3 minutes t.Start(); m.CanHearGhosts = true; m.PlaySound( 0x24A ); m.SendLocalizedMessage( 502444 );//You contact the neitherworld. } else { m_Table.Remove( m ); m.SendLocalizedMessage( 502443 );//You fail to contact the neitherworld. m.CanHearGhosts = false; } return TimeSpan.FromSeconds( 10.0 ); }
public static bool CheckResistedEasyStatic( Mobile target, int Circle ) { int sk = (1 + Circle) * 10; // easy resist for mana vamp, poison, etc if (!target.Player) sk *= 2; // make it easy to use these spells on monsters return target.CheckSkill(SkillName.MagicResist, sk - 20, sk + 20); }
public void OnTarget(Mobile from, object obj) { if (!(obj is AlchemyVial)) { from.SendMessage("Chauffer cette solution ne vous servira à rien"); return; } AlchemyVial vial = (AlchemyVial)obj; if (vial.AlchemyLiquidType == LiquidType.None) { from.SendMessage("Votre fiole est vide"); return; } if (vial.AlchemyLiquidType != LiquidType.ChangelingBlood) { from.SendMessage("Il ne servirait à rien de tenter de faire chauffer cette éprouvette"); return; } if (!from.CheckSkill(SkillName.Alchemy,20,90)) { from.SendMessage("L'éprouvette explose!"); from.Hits -= 5; return; } from.SendMessage("Le liquide bout et se transforme. Vous le versez lentement dans une autre éprouvette"); vial.Consume(); from.AddToBackpack(new MorphBase()); }
protected override void OnTarget( Mobile from, object targeted ) { if ( targeted is BaseAssembly ) { BaseAssembly creature = (BaseAssembly)targeted; if ( from.Skills[SkillName.Tinkering].Value < 100.0 && creature.Creator != from ) from.SendMessage( "At your skill level, you can only examine assemblies that you have crafted" ); // At your skill level, you can only lore tamed creatures else { if ( from.CheckSkill( SkillName.Tinkering, 0, 60 ) ) { from.CloseGump( typeof( AnimalLoreGump ) ); from.SendGump( new AnimalLoreGump( (BaseCreature)creature ) ); } else { creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 500334, from.NetState ); // You can't think of anything you know offhand. } } } else { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "That is not an assemby" ); } }
public static int ScaleDamageAgainstResist( double damage, double maxResisted, Mobile target ) { target.CheckSkill( SkillName.MagicResist, 00.0, 100.0 ); double resistFraction = target.Skills[SkillName.MagicResist].Value / 100; double resisted = ( maxResisted * damage ) * resistFraction; return (int)(damage - resisted); }
public TrackWhatGump( Mobile from ) : base( 20, 30 ) { m_From = from; m_Success = from.CheckSkill( SkillName.Tracking, 0.0, 21.1 ); AddPage( 0 ); AddBackground( 0, 0, 440, 135, 5054 ); AddBackground( 10, 10, 420, 75, 2620 ); AddBackground( 10, 85, 420, 25, 3000 ); AddItem( 20, 20, 9682 ); AddButton( 20, 110, 4005, 4007, 1, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 20, 90, 100, 20, 1018087, false, false ); // Animals AddItem( 120, 20, 9607 ); AddButton( 120, 110, 4005, 4007, 2, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 120, 90, 100, 20, 1018088, false, false ); // Monsters AddItem( 220, 20, 8454 ); AddButton( 220, 110, 4005, 4007, 3, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 220, 90, 100, 20, 1018089, false, false ); // Human NPCs AddItem( 320, 20, 8455 ); AddButton( 320, 110, 4005, 4007, 4, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 320, 90, 100, 20, 1018090, false, false ); // Players }
public static TimeSpan OnUse(Mobile m) { if (!m.Hidden) { m.SendLocalizedMessage(502725); // You must hide first } else if (m.Skills[SkillName.Hiding].Base < 80.0) { m.SendLocalizedMessage(502726); // You are not hidden well enough. Become better at hiding. } else if (GetArmorOffset(m) >= 15) { m.SendLocalizedMessage(502727); // You could not hope to move quietly wearing this much armor. } else if (m.CheckSkill(SkillName.Stealth, 0.0, 100.0)) { int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0)); if (steps < 1) steps = 1; m.AllowedStealthSteps = steps; m.SendLocalizedMessage(502730); // You begin to move quietly. return TimeSpan.FromSeconds(10.0); } else { m.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed. m.RevealingAction(); } return TimeSpan.FromSeconds(10.0); }
public void Use( Mobile from, BaseWeapon weapon ) { BeginSwing(); from.Direction = from.GetDirectionTo( GetWorldLocation() ); weapon.PlaySwingAnimation( from ); from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill ); }
public override double GetResistSkill( Mobile m ) { int maxSkill = (1 + (int)Circle) * 10; maxSkill += (1 + ((int)Circle / 6)) * 25; if( m.Skills[SkillName.MagicResist].Value < maxSkill ) m.CheckSkill( SkillName.MagicResist, 0.0, m.Skills[SkillName.MagicResist].Cap ); return m.Skills[SkillName.MagicResist].Value; }
private static void CheckBonusSkill( Mobile m, int cur, int max, SkillName skill ) { if ( !m.Alive ) return; double n = (double)cur / max; double v = Math.Sqrt( m.Skills[skill].Value * 0.005 ); n *= (1.0 - v); n += v; m.CheckSkill( skill, n ); }
public override void OnCarve(Mobile from, Corpse corpse, Item with) { if (corpse.Carved) base.OnCarve(from, corpse, with); if (Utility.RandomDouble() < 0.15) { if (!from.CheckSkill(SkillName.Forensics, 30, 80)) from.SendMessage("Vous auriez gagné à mieux appréhender les cadavres"); else { corpse.DropItem(new UndeadRelic()); from.SendMessage("Vous arrachez un morceau de chair à la liche"); } } base.OnCarve(from, corpse, with); }
public override void OnCarve(Mobile from, Corpse corpse, Item with) { if (corpse.Carved) base.OnCarve(from, corpse, with); if (Utility.RandomDouble() < 0.15) { if (!from.CheckSkill(SkillName.Forensics, 30, 80)) from.SendMessage("Vous auriez gagné à mieux appréhender les cadavres"); else { corpse.DropItem(new ElementalRelic()); from.SendMessage("L'élémental se crystallise"); } } base.OnCarve(from, corpse, with); }
public override void OnCarve(Mobile from, Corpse corpse, Item with) { if (corpse.Carved) base.OnCarve(from, corpse, with); if (Utility.RandomDouble() < 0.15) { if (!from.CheckSkill(SkillName.Forensics, 30, 80)) from.SendMessage("Vous auriez gagné à mieux appréhender les cadavres"); else { corpse.DropItem(new ReptiledRelic()); from.SendMessage("Un pan de cuir se détache du ventre de la bête"); } } base.OnCarve(from, corpse, with); }
public void Use( Mobile from ) { from.Direction = from.GetDirectionTo( GetWorldLocation() ); Effects.PlaySound( GetWorldLocation(), Map, 0x4F ); if ( from.CheckSkill( SkillName.Stealing, m_MinSkill, m_MaxSkill ) ) { SendLocalizedMessageTo( from, 501834 ); // You successfully avoid disturbing the dip while searching it. } else { Effects.PlaySound( GetWorldLocation(), Map, 0x390 ); BeginSwing(); ProcessDelta(); SendLocalizedMessageTo( from, 501831 ); // You carelessly bump the dip and start it swinging. } }
public static TimeSpan OnUse( Mobile m ) { if ( Core.AOS ) { Spell spell = new SpiritSpeakSpell( m ); spell.Cast(); if ( spell.IsCasting ) return TimeSpan.FromSeconds( 5.0 ); return TimeSpan.Zero; } m.RevealingAction(); if ( m.CheckSkill( SkillName.SpiritSpeak, 0, 100 ) ) { if ( !m.CanHearGhosts ) { Timer t = new SpiritSpeakTimer( m ); double secs = m.Skills[SkillName.SpiritSpeak].Base / 50; secs *= 90; if ( secs < 15 ) secs = 15; t.Delay = TimeSpan.FromSeconds( secs );//15seconds to 3 minutes t.Start(); m.CanHearGhosts = true; } m.PlaySound( 0x24A ); m.SendLocalizedMessage( 502444 );//You contact the neitherworld. } else { m.SendLocalizedMessage( 502443 );//You fail to contact the neitherworld. m.CanHearGhosts = false; } return TimeSpan.FromSeconds( 1.0 ); }
public static TimeSpan OnUse(Mobile m) { m.RevealingAction(); Timer t = m_Table[m] as Timer; if (t != null && t.Running) t.Stop(); if (m.CheckSkill(SkillName.SpiritSpeak, 0, 100)) { if (t == null) m_Table[m] = t = new SpiritSpeakTimer(m); double secs = m.Skills[SkillName.SpiritSpeak].Base / 50; secs *= 90; if (secs < 10) secs = 10; t.Delay = TimeSpan.FromSeconds(secs);//15 seconds to 3 minutes t.Start(); m.CanHearGhosts = true; IPooledEnumerable eable = m.Map.GetMobilesInRange(m.Location, Core.GlobalMaxUpdateRange); // find all the dead people we can see in range and send them foreach (Mobile g in eable) { if (!g.Alive && m.CanSee(g) && Utility.InUpdateRange(m.Location, g.Location)) m.Send(new MobileIncoming(m, g)); } eable.Free(); m.PlaySound(0x24A); m.SendLocalizedMessage(502444);//You contact the neitherworld. } else { m_Table.Remove(m); m.SendLocalizedMessage(502443);//You fail to contact the neitherworld. m.CanHearGhosts = false; } return TimeSpan.FromSeconds(10.0); }
public virtual bool CheckResisted(Mobile target, double damage) { bool canattack = false; int noto = Notoriety.Compute( Caster, target ); if (noto == Notoriety.Enemy) canattack = true; else if (((Caster.FindItemOnLayer(Layer.TwoHanded) is OrderShield) && (target.FindItemOnLayer(Layer.TwoHanded) is ChaosShield)) && target is PlayerMobile) canattack = true; else if (((Caster.FindItemOnLayer(Layer.TwoHanded) is ChaosShield) && (target.FindItemOnLayer(Layer.TwoHanded) is OrderShield)) && target is PlayerMobile) canattack = true; if (SpellHelper.IsTown(target.Location, Caster) && !canattack) damage = 1; double sk = damage * 2.5; if (sk > 124.9) sk = 124.9; return target.CheckSkill(SkillName.MagicResist, sk - 25.0, sk + 25.0); }
public virtual bool CheckResisted( Mobile target ) { double n = GetResistPercent( target ); n /= 100.0; if( n <= 0.0 ) return false; if( n >= 1.0 ) return true; int maxSkill = (1 + (int)Circle) * 10; maxSkill += (1 + ((int)Circle / 6)) * 25; if( target.Skills[SkillName.MagicResist].Value < maxSkill ) target.CheckSkill( SkillName.MagicResist, 0.0, target.Skills[SkillName.MagicResist].Cap ); return (n >= Utility.RandomDouble()); }
public virtual void FinishHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked ) { from.EndAction( locked ); if ( !CheckHarvest( from, tool ) ) return; int tileID; Map map; Point3D loc; if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } else if ( !def.Validate( tileID ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } if ( !CheckRange( from, tool, def, map, loc, true ) ) return; else if ( !CheckResources( from, tool, def, map, loc, true ) ) return; else if ( !CheckHarvest( from, tool, def, toHarvest ) ) return; if ( SpecialHarvest( from, tool, def, map, loc ) ) return; HarvestBank bank = def.GetBank( map, loc.X, loc.Y ); if ( bank == null ) return; HarvestVein vein = bank.Vein; if ( vein != null ) vein = MutateVein( from, tool, def, bank, toHarvest, vein ); if ( vein == null ) return; HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource( from, tool, def, map, loc, vein, primary, fallback ); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if ( skillBase >= resource.ReqSkill && from.CheckSkill( def.Skill, resource.MinSkill, resource.MaxSkill ) ) { type = GetResourceType( from, tool, def, map, loc, resource ); if ( type != null ) type = MutateType( type, from, tool, def, map, loc, resource ); if ( type != null ) { Item item = Construct( type, from ); if ( item == null ) { type = null; } else { //The whole harvest system is kludgy and I'm sure this is just adding to it. if ( item.Stackable ) { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; int racialAmount = (int)Math.Ceiling( amount * 1.1 ); int feluccaRacialAmount = (int)Math.Ceiling( feluccaAmount * 1.1 ); bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human ); bool inFelucca = (map == Map.Felucca); if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount ) item.Amount = feluccaRacialAmount; else if( inFelucca && bank.Current >= feluccaAmount ) item.Amount = feluccaAmount; else if( eligableForRacialBonus && bank.Current >= racialAmount ) item.Amount = racialAmount; else item.Amount = amount; } bank.Consume( item.Amount, from ); if ( Give( from, item, def.PlaceAtFeetIfFull ) ) { SendSuccessTo( from, item, resource ); } else { SendPackFullTo( from, item, def, resource ); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if ( bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill ) { Item bonusItem = Construct( bonus.Type, from ); if ( Give( from, bonusItem, true ) ) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo( from ); } else { //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** START *** //item.Delete(); bonusItem.Delete(); //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** END *** } } if ( tool is IUsesRemaining ) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if ( toolWithUses.UsesRemaining > 0 ) --toolWithUses.UsesRemaining; if ( toolWithUses.UsesRemaining < 1 ) { tool.Delete(); def.SendMessageTo( from, def.ToolBrokeMessage ); } } } } } if ( type == null ) def.SendMessageTo( from, def.FailMessage ); OnHarvestFinished( from, tool, def, vein, bank, resource, toHarvest ); }
public static bool CheckMusicianship( Mobile m ) { m.CheckSkill( SkillName.Musicianship, 0.0, 120.0 ); return ( (m.Skills[SkillName.Musicianship].Value / 100) > Utility.RandomDouble() ); }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( Core.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500596 ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500597 ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500598 ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500599 ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500594 ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500595 ); // You do not have any crossbow bolts with which to practice. else SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = Core.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); return; } Effects.PlaySound( Location, Map, 0x2B1 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
public double GetSuccessChance( Mobile from, Type typeRes, CraftSystem craftSystem, bool gainSkills, ref bool allRequiredSkills ) { double minMainSkill = 0.0; double maxMainSkill = 0.0; double valMainSkill = 0.0; allRequiredSkills = true; for ( int i = 0; i < m_arCraftSkill.Count; i++) { CraftSkill craftSkill = m_arCraftSkill.GetAt(i); double minSkill = craftSkill.MinSkill; double maxSkill = craftSkill.MaxSkill; double valSkill = from.Skills[craftSkill.SkillToMake].Value; if ( valSkill < minSkill ) allRequiredSkills = false; if ( craftSkill.SkillToMake == craftSystem.MainSkill ) { minMainSkill = minSkill; maxMainSkill = maxSkill; valMainSkill = valSkill; } if ( gainSkills ) // This is a passive check. Success chance is entirely dependant on the main skill from.CheckSkill( craftSkill.SkillToMake, minSkill, maxSkill ); } double chance; if ( allRequiredSkills ) chance = craftSystem.GetChanceAtMin( this ) + ((valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) * (1.0 - craftSystem.GetChanceAtMin( this ))); else chance = 0.0; if ( allRequiredSkills && valMainSkill == maxMainSkill ) chance = 1.0; return chance; }
public void Shoot( Mobile from, Mobile target ) { if ( from == target ) return; if ( m_UsesRemaining < 1 ) { // You have no shuriken in your ninja belt! from.SendLocalizedMessage( 1063297 ); } else if ( m_Using ) { // You cannot throw another shuriken yet. from.SendLocalizedMessage( 1063298 ); } else if ( !BasePotion.HasFreeHand( from ) ) { // You must have a free hand to throw shuriken. from.SendLocalizedMessage( 1063299 ); } else if ( from.InRange( target, 2 ) ) { from.SendLocalizedMessage( 1063303 ); // Your target is too close! } else if ( from.CanBeHarmful( target ) ) { m_Using = true; from.Direction = from.GetDirectionTo( target ); from.RevealingAction(); if ( from.Body.IsHuman ) from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); from.PlaySound( 0x23A ); from.MovingEffect( target, 0x27AC, 1, 0, false, false ); if ( from.CheckSkill( SkillName.Ninjitsu, -10.0, 65.0 ) ) Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( OnShurikenHit ), new object[]{ from, target } ); else ConsumeUse(); Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) ); } }
protected override void OnTarget( Mobile from, object targeted ) { string number; if ( m_CraftSystem is DefTinkering && targeted is Golem ) { Golem g = (Golem)targeted; int damage = g.HitsMax - g.Hits; if ( g.IsDeadBondedPet ) { number = "You can't repair that."; } else if ( damage <= 0 ) { number = "That is already in full repair."; } else { double skillValue = from.Skills[SkillName.Tinkering].Value; if ( skillValue < 60.0 ) { number = "You don't have the required skills to attempt this item."; } else if ( !from.CanBeginAction( typeof( Golem ) ) ) { number = "You must wait before trying again."; } else { if ( damage > (int)(skillValue * 0.3) ) damage = (int)(skillValue * 0.3); damage += 30; if ( !from.CheckSkill( SkillName.Tinkering, 0.0, 100.0 ) ) damage /= 2; Container pack = from.Backpack; if ( pack != null ) { int v = pack.ConsumeUpTo( typeof( IronIngot ), (damage+4)/5 ); if ( v > 0 ) { g.Hits += v*5; number = "You repair the item."; from.BeginAction( typeof( Golem ) ); Timer.DelayCall( TimeSpan.FromSeconds( 12.0 ), new TimerStateCallback( EndGolemRepair ), from ); } else { number = "You do not have sufficient metal to make that."; } } else { number = "You do not have sufficient metal to make that."; } } } } else if ( targeted is BaseWeapon ) { BaseWeapon weapon = (BaseWeapon)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if ( Core.AOS ) { toWeaken = 1; } else if ( skill != SkillName.Tailoring ) { double skillLevel = from.Skills[skill].Base; if ( skillLevel >= 90.0 ) toWeaken = 1; else if ( skillLevel >= 70.0 ) toWeaken = 2; else toWeaken = 3; } if ( m_CraftSystem.CraftItems.SearchForSubclass( weapon.GetType() ) == null && !IsSpecialWeapon( weapon ) ) { number = "That item cannot be repaired."; } else if ( !weapon.IsChildOf( from.Backpack ) ) { number = "The item must be in your backpack to repair it."; } else if ( weapon.MaxHits <= 0 || weapon.Hits == weapon.MaxHits ) { number = "That item is in full repair."; } else if ( weapon.MaxHits <= toWeaken ) { number = "You destroyed the item."; m_CraftSystem.PlayCraftEffect( from ); weapon.Delete(); } else if ( from.CheckSkill( skill, -285.0, 100.0 ) ) { number = "You repair the item."; m_CraftSystem.PlayCraftEffect( from ); weapon.MaxHits -= toWeaken; weapon.Hits = weapon.MaxHits; } else { number = "You fail to repair the item."; m_CraftSystem.PlayCraftEffect( from ); weapon.MaxHits -= toWeaken; if ( weapon.Hits - toWeaken < 0 ) weapon.Hits = 0; else weapon.Hits -= toWeaken; } if ( weapon.MaxHits <= toWeaken ) from.SendAsciiMessage( "That item has been repaired many times, and will break if repairs are attempted again." ); } else if ( targeted is BaseArmor ) { BaseArmor armor = (BaseArmor)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if ( Core.AOS ) { toWeaken = 1; } else if ( skill != SkillName.Tailoring ) { double skillLevel = from.Skills[skill].Base; if ( skillLevel >= 90.0 ) toWeaken = 1; else if ( skillLevel >= 70.0 ) toWeaken = 2; else toWeaken = 3; } if ( m_CraftSystem.CraftItems.SearchForSubclass( armor.GetType() ) == null ) { number = "That item cannot be repaired."; } else if ( !armor.IsChildOf( from.Backpack ) ) { number = "The item must be in your backpack to repair it."; } else if ( armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints ) { number = "That item is in full repair."; } else if ( armor.MaxHitPoints <= toWeaken ) { number = "You destroyed the item."; m_CraftSystem.PlayCraftEffect( from ); armor.Delete(); } else if ( from.CheckSkill( skill, -285.0, 100.0 ) ) { number = "You repair the item."; m_CraftSystem.PlayCraftEffect( from ); armor.MaxHitPoints -= toWeaken; armor.HitPoints = armor.MaxHitPoints; } else { number = "You fail to repair the item."; m_CraftSystem.PlayCraftEffect( from ); armor.MaxHitPoints -= toWeaken; if ( armor.HitPoints - toWeaken < 0 ) armor.HitPoints = 0; else armor.HitPoints -= toWeaken; } if ( armor.MaxHitPoints <= toWeaken ) from.SendAsciiMessage( "That item has been repaired many times, and will break if repairs are attempted again." ); } else if ( targeted is Item ) { number = "That item cannot be repaired."; } else { number = "You can't repair that."; } CraftContext context = m_CraftSystem.GetContext( from ); from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, number ) ); }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this."); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( DateTime.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte." ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot." ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot." ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too close to the target." ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice." ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice." ); // You do not have any crossbow bolts with which to practice. else from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name)); //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.",se.Total.ToString() )); else PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); if (0.4 >= Utility.RandomDouble()) { if (isArrow) { Item Ammo = new Arrow(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } else if (isBolt) { Item Ammo = new Bolt(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } } return; } Effects.PlaySound( Location, Map, /*0x2B1*/ 564 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { if (isArrow) { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break; } } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break; } } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break; } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); /*if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/ if (se.Count == 1) PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); else PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
public bool DoDisposeOre(int x, int y, int z, Map map, Mobile from) { if (!IsMiningTile(x, y, map)) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return false; } HarvestBank bank = Mining.System.OreAndStone.GetBank(map, x, y); if (bank == null) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return false; } if (bank.Current <= 0) { this.Say("No Ore remains !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return false; } HarvestVein vein = bank.DefaultVein; if (vein == null) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return false; } HarvestDefinition def = Mining.System.OreAndStone; HarvestResource res = vein.PrimaryResource; BaseOre ore = Mining.System.Construct(res.Types[0], null) as BaseOre; if (ore == null) { this.Say("I can not mine here !"); m_Mine = false; this.Hue = 0; ControlOrder = OrderType.Follow; return false; } if (ore.Resource > CraftResource.MIron) { double minskill = 0.0; double minskill2 = 0.0; double maxskill = 0.0; double skillbase = this.Skills.Mining.Base; switch (ore.Resource) { case CraftResource.MIron: { minskill = 00.0; minskill2 = 00.0; maxskill = 100.0; } break; case CraftResource.MDullcopper: { minskill = 60.0; minskill2 = 25.0; maxskill = 105.0; } break; case CraftResource.MShadow: { minskill = 65.0; minskill2 = 30.0; maxskill = 110.0; } break; case CraftResource.MCopper: { minskill = 70.0; minskill2 = 35.0; maxskill = 115.0; } break; case CraftResource.MGold: { minskill = 75.0; minskill2 = 40.0; maxskill = 120.0; } break; case CraftResource.MAgapite: { minskill = 80.0; minskill2 = 45.0; maxskill = 120.0; } break; case CraftResource.MVerite: { minskill = 85.0; minskill2 = 50.0; maxskill = 120.0; } break; case CraftResource.MValorite: { minskill = 90.0; minskill2 = 55.0; maxskill = 120.0; } break; } if (Utility.RandomDouble() <= 0.30 || skillbase < minskill) { ore = new IronOre(); minskill = 00.0; minskill2 = 00.0; maxskill = 100.0; } if (!(from.CheckSkill(SkillName.Mining, minskill2, maxskill))) { ore.Delete(); return false; } } ore.Amount = (map == Map.Felucca ? 2 : 1); if (from != null) from.AddToBackpack(ore); else ore.Delete(); bank.Consume( ore.Amount, this); this.Hue = ore.Hue; return true; }
public virtual void CheckGain( Mobile m ) { m.CheckSkill( MoveSkill, RequiredSkill, RequiredSkill + 37.5 ); }
public void Decode( Mobile from ) { if ( m_Completed || m_Decoder != null ) return; if ( m_Level == 0 ) { if ( !CheckYoung( from ) ) { from.SendLocalizedMessage( 1046447 ); // Only a young player may use this treasure map. return; } } else { double minSkill = GetMinSkillLevel(); if ( from.Skills[SkillName.Cartography].Value < minSkill ) from.SendLocalizedMessage( 503013 ); // The map is too difficult to attempt to decode. double maxSkill = minSkill + 60.0; if ( !from.CheckSkill( SkillName.Cartography, minSkill, maxSkill ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503018 ); // You fail to make anything of the map. return; } } from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503019 ); // You successfully decode a treasure map! Decoder = from; if ( Core.AOS ) LootType = LootType.Blessed; DisplayTo( from ); }
public void Use( Mobile from, IPoint3D loc ) { if ( !CheckUse( from ) ) return; from.BeginAction( typeof( FireHorn ) ); Timer.DelayCall( Core.AOS ? TimeSpan.FromSeconds( 6.0 ) : TimeSpan.FromSeconds( 12.0 ), new TimerStateCallback( EndAction ), from ); int music = from.Skills[SkillName.Musicianship].Fixed; int sucChance = 500 + ( music - 775 ) * 2; double dSucChance = ((double)sucChance) / 1000.0; if ( !from.CheckSkill( SkillName.Musicianship, dSucChance ) ) { from.SendLocalizedMessage( 1049618 ); // The horn emits a pathetic squeak. from.PlaySound( 0x18A ); return; } int sulfAsh = Core.AOS ? 4 : 15; from.Backpack.ConsumeUpTo( typeof( SulfurousAsh ), sulfAsh ); from.PlaySound( 0x15F ); Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0 ) ); ArrayList targets = new ArrayList(); bool playerVsPlayer = false; IPooledEnumerable eable = from.Map.GetMobilesInRange( new Point3D( loc ), 2 ); foreach ( Mobile m in eable ) { if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) ) { if ( Core.AOS && !from.InLOS( m ) ) continue; targets.Add( m ); if ( m.Player ) playerVsPlayer = true; } } eable.Free(); if ( targets.Count > 0 ) { int prov = from.Skills[SkillName.Provocation].Fixed; int disc = from.Skills[SkillName.Discordance].Fixed; int peace = from.Skills[SkillName.Peacemaking].Fixed; int minDamage, maxDamage; if ( Core.AOS ) { int musicScaled = music + Math.Max( 0, music - 900 ) * 2; int provScaled = prov + Math.Max( 0, prov - 900 ) * 2; int discScaled = disc + Math.Max( 0, disc - 900 ) * 2; int peaceScaled = peace + Math.Max( 0, peace - 900 ) * 2; int weightAvg = ( musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled ) / 80; int avgDamage; if ( playerVsPlayer ) avgDamage = weightAvg / 3; else avgDamage = weightAvg / 2; minDamage = ( avgDamage * 9 ) / 10; maxDamage = ( avgDamage * 10 ) / 9; } else { int total = prov + disc / 5 + peace / 5; if ( playerVsPlayer ) total /= 3; maxDamage = ( total * 2 ) / 30; minDamage = ( maxDamage * 7 ) / 10; } double damage = Utility.RandomMinMax( minDamage, maxDamage ); if ( Core.AOS && targets.Count > 1 ) damage = (damage * 2) / targets.Count; else if ( !Core.AOS ) damage /= targets.Count; for ( int i = 0; i < targets.Count; ++i ) { Mobile m = (Mobile)targets[i]; double toDeal = damage; if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ) ) { toDeal *= 0.5; m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy. } from.DoHarmful( m ); SpellHelper.Damage( TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0 ); Effects.SendTargetEffect( m, 0x3709, 10, 30 ); } } double breakChance = Core.AOS ? 0.01 : 0.16; if ( Utility.RandomDouble() < breakChance ) { from.SendLocalizedMessage( 1049619 ); // The fire horn crumbles in your hands. this.Delete(); } }