Exemplo n.º 1
0
        public override void OnDoubleClick(Mobile from)
        {
            ArrayList pets = new ArrayList();

            foreach (Mobile m in World.Mobiles.Values)
            {
                if (m is HenchmanMonster || m is HenchmanArcher || m is HenchmanFighter || m is HenchmanWizard)
                {
                    BaseCreature bc = (BaseCreature)m;
                    if (bc.Controlled && bc.ControlMaster == from)
                    {
                        pets.Add(bc);
                    }
                }
            }

            int nFollowers = from.FollowersMax - from.Followers;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);
            }
            else if (HenchDead > 0)
            {
                from.SendMessage("They are dead and you must hire a healer to resurrect them.");
            }
            else if (pets.Count > 1)
            {
                from.SendMessage("You already have enough henchman in your group.");
            }
            else if (nFollowers < 1)
            {
                from.SendMessage("You already have enough henchman in your group.");
            }
            else if (HenchmanFunctions.IsInRestRegion(from) == true)
            {
                Map map = from.Map;

                int nMounted = 0;
                if (from.Mounted == true)
                {
                    nMounted = 1;
                }

                int nCap   = (int)(from.Skills.Cap / 100);
                int nTotal = from.SkillsTotal;
                if (nTotal > (nCap * 100))
                {
                    nTotal = nCap * 100;
                }

                int nSkills = nTotal / nCap;
                int nStats  = from.RawStr + from.RawDex + from.RawInt;

                BaseCreature friend = new HenchmanWizard(HenchBody, nMounted, nSkills, nStats);
                friend.Delete();

                if (this is HenchmanMonsterItem)
                {
                    friend = new HenchmanMonster(HenchBody, nMounted, nSkills, nStats, HenchWeaponID, HenchShieldID);
                }
                else if (this is HenchmanWizardItem)
                {
                    friend = new HenchmanWizard(HenchBody, nMounted, nSkills, nStats);
                }
                else if (this is HenchmanFighterItem)
                {
                    friend = new HenchmanFighter(HenchBody, nMounted, nSkills, nStats);
                }
                else if (this is HenchmanArcherItem)
                {
                    friend = new HenchmanArcher(HenchBody, nMounted, nSkills, nStats);
                }

                bool    validLocation = false;
                Point3D loc           = from.Location;

                for (int j = 0; !validLocation && j < 10; ++j)
                {
                    int x = X + Utility.Random(3) - 1;
                    int y = Y + Utility.Random(3) - 1;
                    int z = map.GetAverageZ(x, y);

                    if (validLocation = map.CanFit(x, y, this.Z, 16, false, false))
                    {
                        loc = new Point3D(x, y, Z);
                    }
                    else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                    {
                        loc = new Point3D(x, y, z);
                    }
                }

                friend.ControlMaster = from;
                friend.Controlled    = true;
                friend.ControlOrder  = OrderType.Come;
                friend.ControlSlots  = 1;
                friend.Loyalty       = 100;
                friend.Title         = HenchTitle;
                friend.SpeechHue     = HenchSpeech;
                friend.Name          = HenchName;
                friend.Fame          = HenchTimer;
                friend.Hunger        = HenchBandages;

                if (!(this is HenchmanMonsterItem))
                {
                    friend.Hue        = HenchHue;
                    friend.HairItemID = HenchHair;
                    friend.HairHue    = HenchHairHue;
                    HenchmanFunctions.DressUp(this, friend, from);
                    HenchmanFunctions.NormalizeArmor(friend);
                }

                int nTime = (int)(friend.Fame / 5);
                from.SendMessage("" + friend.Name + " will probably adventure with you for another " + nTime.ToString() + " minutes.");

                friend.MoveToWorld(loc, map);
                this.LootType    = LootType.Blessed;
                this.Visible     = false;
                this.HenchSerial = friend.Serial;

                if (!(this is HenchmanMonsterItem))
                {
                    switch (Utility.Random(8))
                    {
                    case 0: friend.Say("I am ready for adventure."); break;

                    case 1: friend.Say("Where are we off to?"); break;

                    case 2: friend.Say("" + from.Name + ", I am here to serve."); break;

                    case 3: friend.Say("May monsters fear our hardy band."); break;

                    case 4: friend.Say("What dungeon do we dare explore?"); break;

                    case 5: friend.Say("I have been waiting here too long."); break;

                    case 6: friend.Say("Hello, " + from.Name + "."); break;

                    case 7: friend.Say("Fame and fortune await!"); break;
                    }
                }
            }
            else
            {
                from.SendMessage("You can only call your henchman from a home, inn, or tavern.");
            }
        }
Exemplo n.º 2
0
        public override void OnDoubleClick(Mobile from)
        {
            int nFollowers = from.FollowersMax - from.Followers;

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("This must be in your backpack to use.");
            }
            else if (nFollowers < 1)
            {
                from.SendMessage("You already have enough henchman in your group.");
            }
            else if (HenchmanFunctions.IsInRestRegion(from) == false)
            {
                Map map = from.Map;

                int magery = (int)(from.Skills[SkillName.Magery].Value);

                BaseCreature prisoner = new LockedCreature(this.TrappedAI, this.TrappedSkills, magery, this.TrappedHits, this.TrappedStam, this.TrappedMana, this.TrappedStr, this.TrappedDex, this.TrappedInt, this.TrappedPoison, this.TrappedImmune, this.TrappedAngerSound, this.TrappedIdleSound, this.TrappedDeathSound, this.TrappedAttackSound, this.TrappedHurtSound);

                bool    validLocation = false;
                Point3D loc           = from.Location;

                for (int j = 0; !validLocation && j < 10; ++j)
                {
                    int x = X + Utility.Random(3) - 1;
                    int y = Y + Utility.Random(3) - 1;
                    int z = map.GetAverageZ(x, y);

                    if (validLocation = map.CanFit(x, y, this.Z, 16, false, false))
                    {
                        loc = new Point3D(x, y, Z);
                    }
                    else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                    {
                        loc = new Point3D(x, y, z);
                    }
                }

                prisoner.ControlMaster = from;
                prisoner.Controlled    = true;
                prisoner.ControlOrder  = OrderType.Come;

                prisoner.Name        = this.TrappedName;
                prisoner.Title       = this.TrappedTitle;
                prisoner.Body        = this.TrappedBody;
                prisoner.BaseSoundID = this.TrappedBaseSoundID;
                prisoner.Hue         = this.TrappedHue;
                prisoner.AI          = AIType.AI_Mage; if (this.TrappedAI == 2)
                {
                    prisoner.AI = AIType.AI_Melee;
                }
                prisoner.DamageMin              = this.TrappedDmgMin;
                prisoner.DamageMax              = this.TrappedDmgMax;
                prisoner.ColdDamage             = this.TrappedColdDmg;
                prisoner.EnergyDamage           = this.TrappedEnergyDmg;
                prisoner.FireDamage             = this.TrappedFireDmg;
                prisoner.PhysicalDamage         = this.TrappedPhysicalDmg;
                prisoner.PoisonDamage           = this.TrappedPoisonDmg;
                prisoner.ColdResistSeed         = this.TrappedColdRst;
                prisoner.EnergyResistSeed       = this.TrappedEnergyRst;
                prisoner.FireResistSeed         = this.TrappedFireRst;
                prisoner.PhysicalResistanceSeed = this.TrappedPhysicalRst;
                prisoner.PoisonResistSeed       = this.TrappedPoisonRst;
                prisoner.VirtualArmor           = this.TrappedVirtualArmor;
                prisoner.CanSwim  = this.TrappedCanSwim;
                prisoner.CantWalk = this.TrappedCantWalk;

                from.BoltEffect(0);
                from.PlaySound(0x665);
                from.PlaySound(0x03E);
                prisoner.MoveToWorld(loc, map);
                from.SendMessage("You smash the bottle, releasing " + prisoner.Name + "!");
                this.Delete();
            }
            else
            {
                from.SendMessage("You don't think it would be a good idea to do that here.");
            }
        }