public void CollectSeeds(GameObject who)
        {
            if (who.HasSkill("CookingAndGathering_Harvestry"))
            {
                if (last == 0)
                {
                    this.hasSeed = Stat.Rnd2.NextDouble() < Chance / 100f;
                }
                if (last == 0 || XRLCore.Core.Game.TimeTicks - last > 1200 * 5)
                {
                    if (this.hasSeed)
                    {
                        GameObject gameObject = CreateSeed();
                        string     verb       = "harvest";
                        string     extra      = gameObject.a + gameObject.ShortDisplayName;
                        IPart.XDidY(who, verb, extra, null, false, null, who);

                        who.TakeObject(gameObject, true, 0);
                    }
                    else
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnly + ParentObject.GetVerb("have") + " no seeds.");
                    }
                    this.hasSeed = Stat.Rnd2.NextDouble() < Chance / 100f;

                    this.last = XRLCore.Core.Game.TimeTicks;
                }
                else
                {
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnly + ParentObject.GetVerb("have") + " no seeds.");
                }
            }
        }
Example #2
0
 public override bool FireEvent(Event E)
 {
     if (E.ID == "AIGetOffensiveMutationList")
     {
         int                  intParameter        = E.GetIntParameter("Distance");
         GameObject           gameObjectParameter = E.GetGameObjectParameter("Target");
         List <AICommandList> list = (List <AICommandList>)E.GetParameter("List");
         if (pActivatedAbility != null && !ParentObject.AreHostilesAdjacent() && pActivatedAbility.Cooldown <= 0 && intParameter > 3 && !ParentObject.AreHostilesAdjacent() && intParameter < 6 + ParentObject.GetIntProperty("LungeRangeModifier") && ParentObject.HasLOSTo(gameObjectParameter))
         {
             List <Cell> list2 = PickLine(2, AllowVis.OnlyVisible);
             if (list2 == null)
             {
                 return(true);
             }
             if (list2.Count != 2)
             {
                 return(true);
             }
             for (int i = 0; i < list2.Count; i++)
             {
                 foreach (GameObject item in list2[i].LoopObjectsWithPart("Combat"))
                 {
                     if (ParentObject.HasPart("Brain") && ParentObject.GetPart <Brain>().GetFeeling(item) >= 0)
                     {
                         return(true);
                     }
                 }
             }
             list.Add(new AICommandList("CommandAcegiakPolearmLunge", 1));
         }
         return(true);
     }
     if (E.ID == "CommandAcegiakPolearmLunge")
     {
         if (!IsPrimaryPolearmEquipped())
         {
             if (ParentObject.IsPlayer())
             {
                 Popup.Show("You must have a polearm equipped to Polearm Lunge.");
             }
             return(true);
         }
         if (ParentObject.OnWorldMap())
         {
             if (ParentObject.IsPlayer())
             {
                 Popup.Show("You cannot Lunge on the world map.");
             }
             return(true);
         }
         if (ParentObject.pPhysics != null && ParentObject.pPhysics.IsFrozen())
         {
             Popup.Show("You are frozen solid!");
             return(true);
         }
         List <Cell> list3 = PickLine(2, AllowVis.OnlyVisible, ValidLungeTarget);
         if (list3 == null)
         {
             return(true);
         }
         int num  = 3;
         int num2 = 2;
         if (list3.Count != num)
         {
             if (IsPlayer())
             {
                 Popup.Show("You must Lunge 2 spaces.");
             }
             return(false);
         }
         if (!list3[list3.Count - 1].HasObjectWithPart("Combat"))
         {
             if (IsPlayer())
             {
                 Popup.Show("You must Lunge at a target!");
             }
             return(false);
         }
         Physics pPhysics = ParentObject.pPhysics;
         string  text     = ParentObject.pRender.ColorString + ParentObject.pRender.RenderString;
         if (ParentObject.IsPlayer())
         {
             list3.RemoveAt(0);
         }
         int num3 = 10;
         foreach (Cell item2 in list3)
         {
             List <GameObject> objectsWithPart = item2.GetObjectsWithPart("Combat");
             if (objectsWithPart.Count > 0)
             {
                 if (objectsWithPart[0].IsPlayer())
                 {
                     IPart.AddPlayerMessage("&R" + ParentObject.The + ParentObject.DisplayName + " &R" + ParentObject.GetVerb("lunge", PrependSpace: false) + " you!");
                 }
                 if (ParentObject.DistanceTo(item2) == 2)
                 {
                     ParentObject.FireEvent(Event.New("CommandAttackCell", "Cell", item2, "Properties", "Lunging"));
                 }
                 pActivatedAbility.Cooldown = 0;
                 ParentObject.FireEvent(Event.New("LungedTarget", "Defender", objectsWithPart[0]));
                 objectsWithPart[0].FireEvent(Event.New("WasLunged", "Attacker", ParentObject));
                 return(true);
             }
         }
     }
     return(base.FireEvent(E));
 }
Example #3
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "ObjectCreated")
            {
                AddBodyPart();
            }


            if (E.ID == "GetInventoryActions")
            {
                //if(Volume > 0){
                // E.AddInventoryAction("Drink", 'k',  false, "drin&Wk&y", "InvCommandDrinkObject");
                E.AddInventoryAction("Milk", 'm', false, "&Wm&yilk", "InvCommandMilk");
                // E.AddInventoryAction("Collect", 'c',  false, "&Wc&yollect", "InvCommandCollectObject");
                //}
            }

            if (E.ID == "InvCommandMilk")
            {
                GameObject GO = CheckGlands();
                if (GO != null)
                {
                    if (ParentObject.pBrain.IsHostileTowards(E.GetGameObjectParameter("Owner")))
                    {
                        if (ParentObject.MakeSave("Strength", 18, E.GetGameObjectParameter("Owner"), null, "Milking"))
                        {
                            if (IPart.Visible(ParentObject))
                            {
                                ParentObject.ParticleText(IPart.ConsequentialColor(ParentObject) + "*resisted*");
                            }
                            if (E.GetGameObjectParameter("Owner").IsPlayer())
                            {
                                IPart.AddPlayerMessage("&r" + ParentObject.The + ParentObject.ShortDisplayName + "&r" + ParentObject.GetVerb("resist") + " your milking attempt.");
                            }
                            else if (ParentObject.IsPlayer())
                            {
                                IPart.AddPlayerMessage("&gYou resist " + Grammar.MakePossessive(E.GetGameObjectParameter("Owner").the + E.GetGameObjectParameter("Owner").ShortDisplayName) + "&g milking attempt.");
                            }
                            E.RequestInterfaceExit();
                            return(false);
                        }
                    }
                    GO.FireEvent(E.Copy("InvCommandPourObject"));
                }
            }


            // if (E.ID == "GetShortDescription")
            // {
            //  string text = "\n&CEndowed with pendulous milk glands.";
            //  E.SetParameter("Postfix", E.GetStringParameter("Postfix") + text);
            //  return true;
            // }

            return(true);
        }
Example #4
0
        public bool Kiss(GameObject who)
        {
            if (!hasPart(ParentObject, "face"))
            {
                if (who.IsPlayer())
                {
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y doesn't have a face.");
                }
                return(true);
            }
            if (!hasPart(who, "face"))
            {
                if (who.IsPlayer())
                {
                    Popup.Show("You don't have a face.");
                }
                return(true);
            }

            string beguiled  = "";
            string hbeguiled = " &Mkissed you back&y.";

            if (ParentObject.GetIntProperty("BeguilingBonusApplied") > 0)
            {
                beguiled  = "\n" + ParentObject.It + ParentObject.GetVerb("quake") + " with fear and manic ecstasy.";
                hbeguiled = " could not resist.";
            }
            else
            {
                if (kissableIfPositiveFeeling && ParentObject.pBrain.GetFeeling(who) < 55)
                {
                    if (who.IsPlayer())
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("shy") + " away from you.");
                    }
                    ParentObject.pBrain.AdjustFeeling(who, -5);

                    if (ParentObject.pBrain.GetFeeling(who) < 0)
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!");
                    }
                    return(true);
                }
                if (!isAttractedTo(who))
                {
                    if (who.IsPlayer())
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y isn't attracted to you.");
                    }
                    ParentObject.pBrain.AdjustFeeling(who, -10);

                    if (ParentObject.pBrain.GetFeeling(who) < 0)
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!");
                    }
                    return(true);
                }
            }

            if (ParentObject.GetPart <acegiak_Romancable>() != null)
            {
                if (ParentObject.GetPart <acegiak_Romancable>().patience <= 0)
                {
                    ParentObject.pBrain.AdjustFeeling(who, -5);
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y doesn't want to kiss you right now.");

                    if (ParentObject.pBrain.GetFeeling(who) < 0)
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!");
                    }
                }
                ParentObject.GetPart <acegiak_Romancable>().patience--;
            }



            string     verb         = "kiss";
            GameObject parentObject = ParentObject;

            IPart.XDidYToZ(who, verb, parentObject, null, null, true);
            if (who.IsPlayer())
            {
                if (ParentObject.HasPropertyOrTag("SpecialKissResponse"))
                {
                    Popup.Show(ParentObject.GetTag("SpecialKissResponse"));
                }
                else
                {
                    KissBuff(who);
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y " + ParentObject.GetPropertyOrTag("KissResponse", "&Mkisses you back") + "." + beguiled);
                    JournalAPI.AddAccomplishment("&y You kissed " + ParentObject.a + ParentObject.DisplayNameOnlyDirect + " and " + ParentObject.it + hbeguiled, "general", null, -1L);
                }
            }
            ParentObject.Heartspray();
            who.UseEnergy(1000, "Kissing");
            ParentObject.FireEvent(Event.New("ObjectKissed", "Object", ParentObject, "Kisser", who));
            return(true);
        }
Example #5
0
 public string verbForm(string verb)
 {
     string[] words = verb.Split(' ');
     words[0] = ParentObject.GetVerb(words[0]);
     return(String.Join(" ", words));
 }
        public void TailStrike(XRL.World.GameObject Defender, int Hitbonus)
        {
            ThickTail Tail = base.ParentObject.Equipped.GetPart <Mutations>().GetMutation("ThickTail") as ThickTail;

            var       TailSource         = ParentObject;
            var       Owner              = TailSource.Equipped;
            Mutations HasSynergyMutation = Owner.GetPart <Mutations>();

            if (Defender != null && Defender.PhaseAndFlightMatches(Owner) && Defender.CurrentCell != null && Owner.CurrentCell != null && Owner.DistanceTo(Defender) <= 1)
            {
                if (Defender.pBrain != null)
                {
                    Defender.pBrain.GetAngryAt(Owner, -20);
                }
                if (Stat.Random(1, 20) + Hitbonus + Owner.StatMod("Agility", 0) > Stats.GetCombatDV(Defender))
                {
                    var    data            = Tail.GetData(Tail.Level);
                    int    PenetrationCont = Stat.RollDamagePenetrations(Stats.GetCombatAV(Defender), (Stat.Roll(data.Penetration, null) + Stat.Roll(data.BonusPen)), Stat.Roll(data.Penetration, null) + Stat.Roll(data.BonusPen));
                    string resultColor     = Stat.GetResultColor(PenetrationCont);
                    int    DamageBaseInit  = 0;

                    if (PenetrationCont > 0)
                    {
                        for (int i = 0; i < PenetrationCont; i++)
                        {
                            DamageBaseInit += Stat.Roll(data.BaseDamage, null);
                            CombatJuice.punch(Owner, Defender);
                        }
                        Damage damage = new Damage(DamageBaseInit);
                        damage.AddAttribute("Physical");
                        damage.AddAttribute("Bludgeoning");
                        Event @event = Event.New("TakeDamage", 0, 0, 0);
                        @event.AddParameter("Damage", damage);
                        @event.AddParameter("Owner", Owner);
                        @event.AddParameter("Attacker", Owner);
                        if (HasSynergyMutation.HasMutation("Quills"))
                        {
                            @event.AddParameter("Damage", data.BonusDamage);
                        }
                        if (DamageBaseInit > 0 && Defender.FireEvent(@event))
                        {
                            if (Owner.IsPlayer())
                            {
                                IComponent <GameObject> .AddPlayerMessage(string.Concat(new string[]
                                {
                                    "&gYou strike ",
                                    resultColor,
                                    "(x",
                                    PenetrationCont.ToString(),
                                    ")&y for ",
                                    damage.Amount.ToString(),
                                    " &ydamage with your " + base.ParentObject.DisplayName + "!"
                                }));
                            }
                            else if (Defender.IsPlayer())
                            {
                                IComponent <GameObject> .AddPlayerMessage(string.Concat(new string[]
                                {
                                    ParentObject.The,
                                    ParentObject.ShortDisplayName,
                                    " &r",
                                    ParentObject.GetVerb("strike", false, false),
                                    " ",
                                    resultColor,
                                    "(x",
                                    PenetrationCont.ToString(),
                                    ")&r for ",
                                    damage.Amount.ToString(),
                                    " &ydamage with ",
                                    ParentObject.its,
                                    " tail!"
                                }));
                            }
                        }
                        else if (Owner.IsPlayer())
                        {
                            IComponent <GameObject> .AddPlayerMessage("&rYou fail to deal damage to " + Defender.the + Defender.DisplayNameOnly + " &rwith your " + base.ParentObject.DisplayName + "!");
                        }
                        else if (Defender.IsPlayer())
                        {
                            IComponent <GameObject> .AddPlayerMessage(string.Concat(new string[]
                            {
                                ParentObject.The,
                                ParentObject.DisplayName,
                                " &g",
                                ParentObject.GetVerb("fail", false, false),
                                " to damage you with ",
                                ParentObject.its,
                                " tail!"
                            }));
                        }
                    }
                }
            }
        }
 public override bool FireEvent(Event E)
 {
     if (E.ID == "CanSmartUse")
     {
         if ((!E.GetGameObjectParameter("User").IsPlayer() || !ParentObject.IsPlayerLed()))
         {
             return(false);
         }
     }
     else if (E.ID == "CanHaveSmartUseConversation")
     {
         return(false);
     }
     else if (E.ID == "CommandSmartUse")
     {
         GameObject gameObjectParameter = E.GetGameObjectParameter("User");
         if (!gameObjectParameter.IsPlayer() || !ParentObject.IsPlayerLed())
         {
             Drink(gameObjectParameter);
         }
     }
     else if (
         (E.ID == "InvCommandPourObject" || E.ID == "InvCommandDrinkObject" || E.ID == "InvCommandCollectObject") &&
         !GrantsWater(E.GetGameObjectParameter("Owner"))
         )
     {
         return(false);
     }
     else if (E.ID == "InvCommandDrinkObject" && !GrantsWater(E.GetGameObjectParameter("Owner")))
     {
         return(false);
     }
     else if (E.ID == "InvCommandFillFrom")
     {
         Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y's cap " + ParentObject.GetVerb("elude") + " your grasp.");
         return(false);
     }
     else if (E.ID == "GetShortDescription")
     {
         int Rep = GetFactionReputationFeeling(IPart.ThePlayer);
         if (LastRepOptimization != Rep)
         {
             Description Desc = ParentObject.GetPart <Description>();
             if (GrantsWater(IPart.ThePlayer, DoPopup: false))
             {
                 Desc.Short = FriendlyDescription;
                 E.SetParameter("ShortDescription", FriendlyDescription);
             }
             else
             {
                 Desc.Short = UnfriendlyDescription;
                 E.SetParameter("ShortDescription", UnfriendlyDescription);
             }
             LastRepOptimization = Rep;
         }
     }
     return(base.FireEvent(E));
 }
 public bool GrantsWater(GameObject Who, bool DoPopup = true)
 {
     if (GetFactionReputationFeeling(Who) < UnfriendlyRepThreshold)
     {
         if (DoPopup && Who.IsPlayer())
         {
             Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("recognize") + " your hostility towards slimes and refuses you access to its water.");
         }
         return(false);
     }
     if ((ParentObject.GetPart("LiquidVolume") as LiquidVolume).Volume == 0)
     {
         if (DoPopup && Who.IsPlayer())
         {
             Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("has") + " no more fresh water for you to drink.");
         }
         return(false);
     }
     return(true);
 }
        public override bool HandleEvent(GetShortDescriptionEvent E)
        {
            string Glyph = (ParentObject.IsPlayer() ? "You" : ParentObject.The + ParentObject.ShortDisplayName) + ParentObject.GetVerb("bear", true, true) + "bear a psionic glyph on " + ParentObject.Poss("forehead");

            if (E.Postfix.Length > 0 && E.Postfix[E.Postfix.Length - 1] != '\n')
            {
                E.Postfix.Append('\n');
            }
            E.Postfix.Append('\n').Append(Glyph);
            return(true);
        }
Example #10
0
        public bool Constrict(GameObject Target, Event E = null)
        {
            // AddPlayerMessage("Phase: initialize constrict");
            CheckConstricted();
            if (Constricted != null)
            {
                EndConstriction(Constricted, null, null);
                if (Constricted != null)
                {
                    // AddPlayerMessage("Phase: end constrict");
                    return(false);
                }
            }
            // AddPlayerMessage("Phase: 1");
            // !Target.CanChangeMovementMode("Constricted", false, true, false)
            if (!Target.CanChangeBodyPosition("Constricted", false, true, false))
            {
                if (ParentObject.IsPlayer())
                {
                    Popup.Show(string.Concat(new string[]
                    {
                        "You cannot do that while ",
                        Target.the,
                        Target.ShortDisplayName,
                        "&y",
                        Target.Is,
                        " in ",
                        Target.its,
                        " present situation."
                    }), true);
                }
                return(false);
            }
            // AddPlayerMessage("Phase: 2");
            if (!Target.PhaseAndFlightMatches(ParentObject))
            {
                return(false);
            }
            // AddPlayerMessage("Phase: 3");
            if (Target.SameAs(ParentObject))
            {
                return(false);
            }
            // AddPlayerMessage("Phase: 4");
            Cell currentCell = ParentObject.pPhysics.CurrentCell;

            // AddPlayerMessage("Phase: 5");
            if (currentCell == null)
            {
                return(false);
            }
            // Save vs constriction
            // AddPlayerMessage("Phase: 6");
            if (ResistanceSave(Target))
            {
                // AddPlayerMessage("Phase: 6a");
                if (ParentObject.IsPlayer())
                {
                    // AddPlayerMessage("Phase: 6b");
                    Popup.Show("You fail to constrict " + Target.the + Target.ShortDisplayName + ".", true);
                }
                else if (Target.IsPlayer())
                {
                    // AddPlayerMessage("Phase: 7");
                    IPart.AddPlayerMessage(string.Concat(new string[]
                    {
                        ParentObject.The,
                        ParentObject.ShortDisplayName,
                        "&y",
                        ParentObject.GetVerb("try", true, false),
                        " to wrap around and constrict you, but",
                        ParentObject.GetVerb("fail", true, false),
                        "."
                    }));
                }
                else if (IPart.Visible(ParentObject))
                {
                    // AddPlayerMessage("Phase: 8");
                    IPart.AddPlayerMessage(string.Concat(new string[]
                    {
                        ParentObject.The,
                        ParentObject.ShortDisplayName,
                        "&y",
                        ParentObject.GetVerb("try", true, false),
                        " to wrap around and constrict ",
                        Target.the,
                        Target.ShortDisplayName,
                        "&y, but",
                        ParentObject.GetVerb("fail", true, false),
                        "."
                    }));
                }
                // CheckEnterDamage(Target, true);
                ParentObject.UseEnergy(1000, "Position");
                if (E != null)
                {
                    // AddPlayerMessage("Phase: 9");
                    E.RequestInterfaceExit();
                }
                return(false);
            }
            if (Target.CurrentCell != currentCell && !ParentObject.DirectMoveTo(Target.CurrentCell, 0, true, true))
            {
                // AddPlayerMessage("Phase: 10");
                if (E != null)
                {
                    // AddPlayerMessage("Phase: 11");
                    E.RequestInterfaceExit();
                }
                return(false);
            }
            // AddPlayerMessage("Phase: 12");
            // CheckEnterDamage(Target, false);
            string     verb         = "are";
            string     preposition  = "constricted by";
            GameObject parentObject = ParentObject;

            XDidYToZ(Target, verb, preposition, parentObject, null, null);
            Constricted = Target;
            Target.ApplyEffect(new Constricted(ParentObject), null);
            ParentObject.UseEnergy(1000, "Position");
            ParentObject.FireEvent(Event.New("Constricted", "Object", Target));
            Target.FireEvent(Event.New("ObjectConstricted", "Object", ParentObject));
            if (E != null)
            {
                E.RequestInterfaceExit();
            }
            return(true);
        }