コード例 #1
0
            private bool CheckForSpecialBottle(BaseCreature bc, Corpse corpse, BloodBottle bottle)
            {
                double rnd = Utility.RandomDouble();

                if (bc.IsPlagued && 0.01 > rnd && bc.HitsMax >= 100)
                {
                    bottle.ConvertToSpecial("Bottle of plagued blood", 0x558, true, 1001);
                    return true;
                }
                else if (bc.IsParagon && 0.01 > rnd && bc.HitsMax >= 100)
                {
                    bottle.ConvertToSpecial("Bottle of paragon blood", 0x501, true, 1002);
                    return true;
                }
                else if (Region.Find(corpse.Location, corpse.Map) is Regions.CursedCaveRegion && 0.10 > rnd)
                {
                    bottle.ConvertToSpecial("Bottle of mutated blood", 0x96, false, 1003);
                    return true;
                }

                return false;
            }
コード例 #2
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (m_ToolKit == null || m_ToolKit.Deleted)
                    return;

                if (o is Corpse && !((Corpse)o).Deleted)
                {
                    Corpse corpse = (Corpse)o;

                    if (!from.InRange(corpse.Location, 4))
                    {
                        from.SendLocalizedMessage(500446); // That is too far away.
                        return;
                    }

                    Item bottle = from.Backpack.FindItemByType(typeof(Bottle), true);
                    if (bottle == null)
                    {
                        from.SendLocalizedMessage(1044558); // You don't have any empty bottles.
                        return;
                    }

                    string sErrorMsg = "";

                    if (!CheckCorpse(corpse, out sErrorMsg))
                    {
                        from.SendMessage(sErrorMsg);
                        return;
                    }

                    if (!CheckOwner(corpse.Owner, out sErrorMsg))
                    {
                        from.SendMessage(sErrorMsg);
                        return;
                    }

                    BaseCreature bcOwner = (BaseCreature)corpse.Owner;
                    int bloodAmount = CheckBloodAmount(bcOwner, out sErrorMsg);
                    if (bloodAmount <= 0)
                    {
                        from.SendMessage(sErrorMsg);
                        return;
                    }

                    if (from.BeginAction(typeof(BloodDrainToolkit)))
                    {
                        if (from.CheckSkill(SkillName.Healing, 0, 100))
                        {
                            bool bSpecial = false;

                            corpse.Channeled = true;
                            corpse.Hue = 0x835;

                            bottle.Consume();

                            BloodBottle newBloodBottle = new BloodBottle(bloodAmount, GetQuality(from), bcOwner.Name, bcOwner.GetType());
                            bSpecial = CheckForSpecialBottle(bcOwner, corpse, newBloodBottle);
                            from.AddToBackpack(newBloodBottle);

                            from.PlaySound(0x4E);
                            from.SendMessage("You drain some {0} from the creature.", bSpecial ? "special blood" : "blood");
                        }
                        else
                            from.SendMessage("You fail to drain blood from the creature.");

                        if (--m_ToolKit.UsesRemaining <= 0)
                        {
                            from.SendLocalizedMessage(1044038); // You have worn out your tool!
                            m_ToolKit.Delete();
                        }

                        Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerStateCallback(ReleaseToolLock), from);
                    }
                    else
                        from.SendLocalizedMessage(501789); // You must wait before trying again.
                }
                else
                    from.SendLocalizedMessage(1042600); // That is not a corpse!
            }