public void Target( BaseCreature bc ) { if ( !Caster.CanSee( bc ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } if ( !Caster.InRange( bc, 6 ) ) { Caster.SendLocalizedMessage( 500643 ); // Target is too far away. } else if ( !Caster.CanBeHarmful( bc ) || !bc.CanBeDamaged() ) { Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that! } else if ( bc.Controlled || bc.Name == null ) { Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that! } else if ( bc is BaseChampion || bc.IsParagon || bc is Medusa || bc is Lurg || !SlayerGroup.GetEntryByName( SlayerName.Repond ).Slays( bc ) ) { Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that! } else if ( CheckSequence() ) { double chance = Caster.Skills[SkillName.Spellweaving].Fixed / 1000; chance += ( SpellweavingSpell.GetFocusLevel( Caster ) * 2 ) / 100; if ( chance > Utility.RandomDouble() ) { SpellHelper.Turn( Caster, bc ); bc.ControlSlots = 3; bc.ActiveSpeed = 2; bc.PassiveSpeed = 2; bc.Owners.Add( Caster ); bc.SetControlMaster( Caster ); bc.IsBonded = false; Caster.SendLocalizedMessage( 1072527 ); // You allure the humanoid to follow and protect you. Caster.PlaySound( 0x5C4 ); } else { bc.Combatant = Caster; Caster.SendLocalizedMessage( 1072528 ); // The humanoid becomes enraged by your charming attempt and attacks you. Caster.PlaySound( 0x5C5 ); } } FinishSequence(); }
protected override void OnTick() { if (DateTime.Now >= m_NextHourlyCheck) { m_NextHourlyCheck = DateTime.Now + TimeSpan.FromHours(1.0); } else { return; } List <BaseCreature> toRelease = new List <BaseCreature>(); // added array for wild creatures in house regions to be removed List <BaseCreature> toRemove = new List <BaseCreature>(); foreach (Mobile m in World.Mobiles.Values) { if (m is BaseCreature) { BaseCreature c = (BaseCreature)m; if (c.Controlled && c.Commandable) { if (c.Map != Map.Internal) { c.Loyalty -= BaseCreature.MaxLoyalty / 10; if (c.Loyalty < BaseCreature.MaxLoyalty / 10) { c.Say(1043270, c.Name); // * ~1_NAME~ looks around desperately * c.PlaySound(c.GetIdleSound()); } if (c.Loyalty <= 0) { toRelease.Add(c); } } } // added lines to check if a wild creature in a house region has to be removed or not if (!c.Controlled && !c.IsStabled && (c.Region.IsPartOf <HouseRegion>() && c.CanBeDamaged() || c.RemoveIfUntamed && c.Spawner == null)) { c.RemoveStep++; if (c.RemoveStep >= 20) { toRemove.Add(c); } } else { c.RemoveStep = 0; } } } foreach (BaseCreature c in toRelease) { c.Say(1043255, c.Name); // ~1_NAME~ appears to have decided that is better off without a master! c.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully Happy c.ControlTarget = null; //c.ControlOrder = OrderType.Release; c.AIObject .DoOrderRelease(); // this will prevent no release of creatures left alone with AI disabled (and consequent bug of Followers) c.DropBackpack(); } // added code to handle removing of wild creatures in house regions foreach (BaseCreature c in toRemove) { c.Delete(); } }