상속: BaseCreature, ISmallPrey
예제 #1
0
        public override void Effect()
        {
            if( ((IKhaerosMobile)Caster).CanSummon() && Caster is PlayerMobile && CasterHasEnoughMana )
            {
                Caster.Mana -= TotalCost;
                PlayerMobile caster = Caster as PlayerMobile;

                BaseCreature summoned = new Chicken() as BaseCreature;

                switch( caster.ChosenDeity )
                {
                    case ChosenDeity.Arianthynt:
                    {
                        if( FeatLevel > 2 )
                            summoned = new GreaterHuorn();

                        else if( FeatLevel > 1 )
                            summoned = new Huorn();

                        else
                            summoned = new LesserHuorn();

                        break;
                    }
                    case ChosenDeity.Xipotec:
                    {
                        if( FeatLevel > 2 )
                            summoned = new GreaterVolcanicGuardian();

                        else if( FeatLevel > 1 )
                            summoned = new VolcanicGuardian();

                        else
                            summoned = new VolcanicGuardian();

                        break;
                    }
                    case ChosenDeity.Elysia:
                    {
                        if( FeatLevel > 2 )
                            summoned = new GreaterDivineProtector();

                        else if( FeatLevel > 1 )
                            summoned = new DivineProtector();

                        else
                            summoned = new LesserDivineProtector();

                        break;
                    }
                    case ChosenDeity.Ohlm:
                    {
                        if( FeatLevel > 2 )
                            summoned = new GreaterServantOfOhlm();

                        else if( FeatLevel > 1 )
                            summoned = new ServantOfOhlm();

                        else
                            summoned = new LesserServantOfOhlm();

                        break;
                    }
                    case ChosenDeity.Mahtet:
                    {
                        if( FeatLevel > 2 )
                            summoned = new GreaterClericScorpion();

                        else if( FeatLevel > 1 )
                            summoned = new ClericScorpion();

                        else
                            summoned = new LesserClericScorpion();

                        break;
                    }
                    case ChosenDeity.Xorgoth:
                    {
                        if( FeatLevel > 2 )
                            summoned = new GreaterSpiritTotem();

                        else if( FeatLevel > 1 )
                            summoned = new SpiritTotem();

                        else
                            summoned = new LesserSpiritTotem();

                        break;
                    }
                }

                Summon( Caster, summoned, TotalEffect, 533 );
                Success = true;
            }
        }
예제 #2
0
 public virtual void BeginMate(Chicken mate)
 {
     if (AIObject is ChickenAI)
         (AIObject as ChickenAI).BeginMate(mate);
 }
예제 #3
0
        public override bool DoActionInteract()
        {
            m_Mobile.DebugSay("Interacting..");

            if (!m_Mobile.Controlled)
            {
                m_Mobile.DebugSay("I'm wild now... for some reason, I don't wanna bone anymore. Hm.");

                if (m_MateTarget != null)
                {
                    m_MateTarget.EndMate(false);
                }
                EndMate(false);

                Action = ActionType.Wander;

                return(true);
            }

            if (m_Mobile.Deleted || !m_Mobile.Alive)
            {
                m_Mobile.DebugSay("Oh shit, I've got bigger things to worry about now.");

                if (m_MateTarget != null)
                {
                    m_MateTarget.EndMate(false);
                }
                EndMate(false);

                Action = ActionType.Wander;

                return(true);
            }

            if (m_MateTarget == null)
            {
                m_Mobile.DebugSay("My mate target is gone! Going back to wander...");

                EndMate(false);
                Action = ActionType.Wander;

                return(true);
            }

            if (m_Mobile.Female)
            {
                // stand still and get mated with - occasionally make sounds
                if (Utility.RandomDouble() < .3)
                {
                    m_Mobile.PlaySound(Utility.RandomList(111, 113, 114, 115));
                }

                return(true);
            }

            switch (BreedingState)
            {
            case BreedState.Approaching:
            {
                // if we are not at most one tile away from mate target, get one tile away
                if (WalkMobileRange(m_MateTarget, 1, false, 0, 1))
                {
                    m_FightDistance = -1 + (int)Math.Round((m_Mobile.Temper + Utility.RandomMinMax(-10, 10)) / 35.0);
                    m_Ignore        = new List <Chicken>();
                    BreedingState   = BreedState.FightingCompetition;
                }

                break;
            }

            case BreedState.FightingCompetition:
            {
                // depending on temper, fight all other male chickens near target
                if (m_FightDistance > -1)
                {
                    IPooledEnumerable eable = m_Mobile.Map.GetMobilesInRange(m_MateTarget.Location, m_FightDistance);
                    foreach (Mobile m in eable)
                    {
                        Chicken c = m as Chicken;

                        // wisdom, temper and target's damagemin/max affect chance to attack
                        if (c != null && !c.Female && c != m_Mobile && !m_Ignore.Contains(c) &&
                            (m_Mobile.Temper + Utility.RandomMinMax(-10, 10)) > (m_Mobile.Wisdom + c.DamageMax + c.DamageMin))
                        {
                            m_Mobile.Combatant = c;
                            m_Mobile.DebugSay("Get away from my woman!");
                            Action = ActionType.Combat;
                            return(true);
                        }
                        else
                        {
                            m_Ignore.Add(c);
                        }
                    }
                    eable.Free();
                }

                // if we got here, then we're done fighting away competition
                m_Ignore      = null;
                BreedingState = BreedState.MovingIn;

                break;
            }

            case BreedState.MovingIn:
            {
                // if we are not same loc as target, get same loc
                m_Mobile.DebugSay("Gettin in close...");
                if (WalkMobileRange(m_MateTarget, 1, false, 0, 0))
                {
                    if (m_MateTarget.CheckBreedWith(m_Mobile))         // does she like us?
                    {
                        BeginMate(m_MateTarget);
                        m_MateTarget.BeginMate(m_Mobile as Chicken);

                        BreedingState = BreedState.Mating;
                    }
                    else         // shit! rejected!
                    {
                        m_Mobile.DebugSay("Shit! Rejected!");

                        // do NOT endmate on woman! she might be mating with someone else.
                        EndMate(false);
                    }
                }

                break;
            }

            case BreedState.Mating:
            {
                if (!m_MateTarget.CheckBreedWith(m_Mobile))         // does she STILL like us?
                {
                    // crap, she doesn't
                    m_MateTarget.EndMate(false);         // important that this goes first, as EndMateWith nullifies m_MateTarget
                    EndMate(false);

                    m_Mobile.DebugSay("Shit, she don't like me anymore.");

                    break;
                }

                if (m_BeganTheNasty + MateDuration < DateTime.Now)
                {
                    // patience affects chance to successfully procreate
                    if (Utility.RandomDouble() < (MateSuccessChance + (m_Mobile.Patience - 10) / 500.0))
                    {
                        m_Mobile.DebugSay("Smokin a cig...");

                        m_Mobile.PlaySound(Utility.RandomList(111, 113, 114, 115));

                        Chicken    child = m_MateTarget.BreedWith(m_Mobile) as Chicken;
                        ChickenEgg egg;

                        if (Utility.RandomDouble() < StillBornChance)
                        {
                            egg = new ChickenEgg(null);
                        }
                        else
                        {
                            egg = new ChickenEgg(child);
                        }

                        egg.MoveToWorld(m_Mobile.Location, m_Mobile.Map);

                        m_MateTarget.EndMate(true);
                        EndMate(true);
                    }
                    else
                    {
                        m_Mobile.DebugSay("Crap, 'sploded early.");

                        if (m_MateTarget != null)
                        {
                            m_MateTarget.EndMate(false);
                        }
                        EndMate(false);

                        m_Mobile.PlaySound(112);
                    }

                    return(true);
                }
                else
                {
                    m_Mobile.DebugSay("Get down tonight...");

                    if (Utility.RandomDouble() < .3)
                    {
                        m_Mobile.PlaySound(Utility.RandomList(111, 113, 114, 115));
                    }

                    return(true);
                }
            }

            case BreedState.None:
            {
                m_Mobile.DebugSay("I'm not supposed to be breeding. Going back to wander..");

                Action = ActionType.Wander;

                break;
            }

            default:
            {
                Console.WriteLine("{0} had an invalid BreedingState (= {1}). Reverting to none.", this, BreedingState);
                BreedingState = BreedState.None;

                break;
            }
            }

            return(true);
        }
예제 #4
0
 public void BeginMate(Chicken mate)
 {
     // mark us as gettin down
     Action = ActionType.Interact; // important that this happens BEFORE setting BeganTheNasty - OnActionChanged will overwrite it otherwise
     m_BeganTheNasty = DateTime.Now;
     m_MateTarget = mate;
 }
예제 #5
0
        public void EndMate(bool success)
        {
            if (success)
            {
                m_LastMate = DateTime.Now;
            }

            m_MateTarget = null;
            m_NextMateAttempt = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(MinMateAttemptDelay, MaxMateAttemptDelay));
            m_BeganTheNasty = DateTime.MaxValue;
            BreedingState = BreedState.None;
        }
예제 #6
0
        public bool CheckMateAccept(Chicken male)
        {
            if (m_Mobile.Deleted || !m_Mobile.Alive)
                return false; // we've got bigger shit to worry about

            if (!m_Mobile.Female || male == null || male.Female)
                return false; // chickens only swing one way

            if (!m_Mobile.Controlled)
                return false; // only tame chickens mate

            if ((Action != ActionType.Wander && Action != ActionType.Interact) || 
                m_Mobile.ControlOrder != OrderType.None || m_BecameIdle + MateIdleDelay > DateTime.Now)
                return false; // we are busy

            if (m_MateTarget == male)
                return true; // we're already mating with them, they're ok

            if (m_MateTarget != null && m_MateTarget != male)
                return false; // we're already mating with someone else

            if (m_LastMate + FemaleMateDelay > DateTime.Now)
                return false; // haven't waited long enough yet - need to recoup!

            // male's wisdom can up chances up to .10, our patience can up chances up to .05, our temper can lower chances up to .15
            double score = Utility.RandomDouble() - male.Wisdom / 1000.0 - m_Mobile.Patience / 2000.0 + m_Mobile.Temper * 3.0 / 2000.0;
            if (score < MateAcceptChance)
                return true;
            else
                return false;
        }
예제 #7
0
        protected virtual void FindMate()
        {
            if (m_Mobile.Female)
                return;

            m_Mobile.DebugSay("Love shack.. In the looove shack...");
            IPooledEnumerable eable = m_Mobile.Map.GetMobilesInRange(m_Mobile.Location);
            m_MateTarget = null;
            double dist = Double.MaxValue;

            // find the closest female chicken
            foreach (Mobile m in eable)
            {
                Chicken c = m as Chicken;
                double d = m_Mobile.GetDistanceToSqrt(m);
                if (c != null && c.Female && d < dist)
                {
                    m_MateTarget = c;
                    dist = d;
                }
            }
            eable.Free();

            if (m_MateTarget != null)
                m_Mobile.DebugSay("A woman!");
            else
                m_Mobile.DebugSay("Man, it's a sausage fest around here...");
        }
예제 #8
0
 public ChickenAI(BaseCreature m)
     : base(m)
 {
     m_MateTarget = null;
     m_BecameIdle = DateTime.Now;
     m_NextMateAttempt = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(MinMateAttemptDelay, MaxMateAttemptDelay));
     m_LastMate = DateTime.MinValue;
     m_BeganTheNasty = DateTime.MaxValue;
     m_Ignore = null;
 }
예제 #9
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Birthdate = reader.ReadDateTime();
                        m_Chick = reader.ReadMobile() as Chicken;
                        m_Health = reader.ReadInt();

                        break;
                    }
            }
        }
예제 #10
0
        public ChickenEgg(Chicken child)
            : base()
        {
            m_Birthdate = DateTime.Now + TimeSpan.FromDays(2.0 + Utility.RandomDouble());
            m_Chick = child;
            m_Hatch = null;
            m_Health = 5;

            if (m_Chick != null)
            {
                m_Chick.SpawnerTempMob = true;
                m_Eggs.Add(this);
            }
        }