コード例 #1
0
        public bool Carve(Mobile from, Item item)
        {
            if (m_ScalesLeft > 0)
            {
                if (DateTime.UtcNow < m_NextCarve)
                {
                    from.SendLocalizedMessage(1112677); // The creature is still recovering from the previous harvest. Try again in a few seconds.
                }
                else
                {
                    from.RevealingAction();

                    if (0.2 > Utility.RandomDouble())
                    {
                        int amount = Math.Min(m_ScalesLeft, Utility.RandomMinMax(2, 3));

                        m_ScalesLeft -= amount;

                        Item scales = new MedusaLightScales(amount);

                        if (from.PlaceInBackpack(scales))
                        {
                            from.SendLocalizedMessage(1112676); // You harvest magical resources from the creature and place it in your bag.
                        }
                        else
                        {
                            scales.MoveToWorld(from.Location, from.Map);
                        }

                        m_NextCarve = DateTime.UtcNow + TimeSpan.FromMinutes(1.0);
                        return(true);
                    }

                    from.SendLocalizedMessage(1112675, "", 33); // Your attempt fails and angers the creature!!

                    PlaySound(GetHurtSound());

                    Combatant = from;
                }
            }
            else
            {
                from.SendLocalizedMessage(1112674); // There's nothing left to harvest from this creature.
            }

            return(false);
        }
コード例 #2
0
ファイル: Medusa.cs プロジェクト: tflynt91/TrueUO
        public bool Carve(Mobile from, Item item)
        {
            if (m_Scales > 0)
            {
                if (DateTime.UtcNow < m_NextCarve)
                {
                    from.SendLocalizedMessage(1112677); // The creature is still recovering from the previous harvest. Try again in a few seconds.
                }
                else
                {
                    int amount = Math.Min(m_Scales, Utility.RandomMinMax(2, 3));

                    m_Scales -= amount;

                    Item scales = new MedusaLightScales(amount);

                    if (from.PlaceInBackpack(scales))
                    {
                        // You harvest magical resources from the creature and place it in your bag.
                        from.SendLocalizedMessage(1112676);
                    }
                    else
                    {
                        scales.MoveToWorld(from.Location, from.Map);
                    }

                    new Blood(0x122D).MoveToWorld(Location, Map);

                    m_NextCarve = DateTime.UtcNow + TimeSpan.FromMinutes(1.0);
                    return(true);
                }
            }
            else
            {
                from.SendLocalizedMessage(1112674); // There's nothing left to harvest from this creature.
            }
            return(false);
        }