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); }