Esempio n. 1
0
        public void Boom(GameObject who = null)
        {
            if (who == null)
            {
                who = ParentObject;
            }
            GameObject explosive = Explosive;

            Explosive = null;
            ForceDropSelf();
            Cell currentCell = ParentObject.CurrentCell;

            if (currentCell != null)
            {
                currentCell.RemoveObject(ParentObject);
                currentCell.AddObject(explosive);
                if (explosive.pRender != null && ParentObject.pRender != null)
                {
                    explosive.pRender.DisplayName = ParentObject.pRender.DisplayName;
                }
                Event @event = Event.New(Message);
                if (Owner != null && Owner.IsValid())
                {
                    @event.AddParameter("Owner", who);
                }
                explosive.FireEvent(@event);
            }
            ParentObject.Destroy();
        }
        public override bool FireEvent(Event E)
        {
            if (E.ID == "WeaponAfterAttack" || E.ID == "WeaponAfterAttackMissed")
            {
                if (ParentObject.EquippedProperlyBy() != OriginalOwner)
                {
                    SwingsRemaining--;
                    if (SwingsRemaining <= 0)
                    {
                        var ParentsPsiMar = PsiHolder().GetPart <Psychomateriartis>();

                        GameObject equipped = ParentObject.Equipped;
                        DidX("disappear", null, null, null, null, equipped);
                        ParentObject.ForceUnequipRemoveAndRemoveContents(Silent: true);
                        ParentObject.Destroy();
                        ParentsPsiMar.WeaponCounter -= 1;
                        if (equipped != null && equipped.IsValid() && !equipped.IsPlayer() && equipped.pBrain != null)
                        {
                            equipped.pBrain.PerformReequip();
                        }
                    }
                }
            }
            else if ((E.ID == "SyncMutationLevels" || E.ID == "AfterLevelGainedEarly"))
            {
                // AddPlayerMessage("Sync Mutation or Level Gained early, Psionics Props update fire");
                UpdatePsionicProperties();
            }
            else if (E.ID == "PsionicWeaponManifestedEvent")
            {
                var ParentsPsiMar = PsiHolder().GetPart <Psychomateriartis>();

                // var ColorSelected = E.GetStringParameter("ColorChoice");
                var WeaponManifested = E.GetGameObjectParameter("ManifestedWeapon");

                string newName = Popup.AskString("Give your bonded-weapon a name.", "", 99);
                if (!String.IsNullOrEmpty(newName))
                {
                    WeaponManifested.DisplayName = "{{psionic|psionic}} " + newName;
                    WeaponManifested.SetIntProperty("ProperNoun", 1);
                    ParentObject.id = ParentsPsiMar.PsiWeaponsID;
                }

                // WeaponManifested.pRender.TileColor = ParentsPsiMar.GetWeaponTileColor($"&{ColorSelected}");
                // WeaponManifested.pRender.ColorString = ParentsPsiMar.GetWeaponTileColor($"&{ColorSelected}");
            }
            else if (E.ID == "EndTurn")
            {
                // AddPlayerMessage("EndTurnCheck, current weapons ID: " + ParentObject.id);
            }

            return(base.FireEvent(E));
        }
Esempio n. 3
0
        public override bool HandleEvent(InventoryActionEvent e)
        {
            if (e.Command == "Apply" && e.Actor.CheckFrozen())
            {
                GameObject target = e.Actor;
                if (e.Actor.IsPlayer())
                {
                    Cell cell = PickDirection(POV: e.Actor);
                    target = cell.GetCombatTarget(e.Actor);
                    if (target == null)
                    {
                        // cancelled out
                        return(true);
                    }
                }

                if (!target.IsPlayerControlled())
                {
                    if (e.Actor.IsPlayer())
                    {
                        Popup.Show(target.The + target.ShortDisplayName + " refuses your ministrations!");
                    }
                    return(true);
                }

                BodyPart part = Utility.ChooseBodyPart(target, "Apply " + ParentObject.DisplayNameOnly + " to",
                                                       FungalSporeInfection.BodyPartSuitableForFungalInfection);
                if (part == null)
                {
                    // cancelled out
                    return(true);
                }

                var Infection = Utility.GetFungalInfectionFromColor(ParentObject.GetPart <LimberFungalGasGrenade>().Color);
                _ = FungalSporeInfection.ApplyFungalInfection(target, Infection, part);

                if (e.Actor.IsPlayer() && !target.IsPlayer())
                {
                    // ApplyFungalInfection didn't popup, so we need to
                    var blueprint = GameObjectFactory.Factory.Blueprints[Infection];
                    target.pPhysics.PlayWorldSound("FungalInfectionAcquired");
                    Popup.Show(target.The + target.ShortDisplayName + " has contracted " + blueprint.DisplayName() + "&y on " + target.its + " " + part.GetOrdinalName() + ".");
                }

                _ = ParentObject.Destroy();
            }
            return(true);
        }
Esempio n. 4
0
        public void Ticks()
        {
            if (stage < 1)
            {
                return;
            }

            if (!this.Dead)
            {
                long newGrowth = (XRLCore.Core.Game.TimeTicks - this.lastseen);

                if (this.lastseen == 0)
                {
                    newGrowth = 0;
                }
                this.lastseen = XRLCore.Core.Game.TimeTicks;

                //IPart.AddPlayerMessage("tickcheck:"+this.growth.ToString()+"+"+newGrowth.ToString()+"="+(this.growth+newGrowth).ToString());
                this.growth += newGrowth;



                if (this.growth >= stageLength)
                {
                    //IPart.AddPlayerMessage((growth/stageLength).ToString()+" plant growth ticks!");

                    for (int i = 0; i < growth / stageLength; i++)
                    {
                        Tick();
                    }
                    this.growth = this.growth % stageLength;
                    tileupdate();
                }
            }



            if (this.stage >= 5 && !this.Dead)
            {
                Cell cell = ParentObject.CurrentCell;
                if (cell == null)
                {
                    Popup.Show("Things must grow in the ground.");
                    return;
                }
                GameObject growInto = GameObject.create(Result);



                if (GetPuddle() != null)
                {
                    if (GetPuddle().ComponentLiquids.ContainsKey(acegiak_LiquidRestrainingAgent.ID))
                    {
                        growInto.pPhysics.Takeable    = true;
                        growInto.pPhysics.Weight      = growInto.pPhysics.Weight / 10;
                        growInto.pRender.DisplayName += " bonsai";
                    }
                }

                if (GetPuddle() != null)
                {
                    if (GetPuddle().ComponentLiquids.ContainsKey(acegiak_LiquidFurlingAgent.ID))
                    {
                        GameObject furled = GameObject.create("FurledPlant");
                        furled.GetPart <Render>().DisplayName          = "Furled " + growInto.DisplayNameOnly;
                        furled.GetPart <Render>().DetailColor          = ParentObject.pRender.DetailColor;
                        furled.GetPart <Render>().TileColor            = ParentObject.pRender.TileColor;
                        furled.GetPart <Render>().RenderString         = ParentObject.pRender.RenderString;
                        furled.GetPart <Render>().ColorString          = ParentObject.pRender.ColorString;
                        furled.GetPart <DeploymentGrenade>().Blueprint = growInto.Blueprint;
                        growInto = furled;
                    }
                }



                if (GetPuddle() != null)
                {
                    if (GetPuddle().ComponentLiquids.ContainsKey(acegiak_LiquidSoothingAgent.ID))
                    {
                        if (growInto.GetPart <Brain>() != null)
                        {
                            growInto.GetPart <Brain>().PerformReequip();
                            growInto.GetPart <Brain>().BecomeCompanionOf(growInto.ThePlayer);
                            growInto.GetPart <Brain>().IsLedBy(growInto.ThePlayer);
                            growInto.GetPart <Brain>().SetFeeling(growInto.ThePlayer, 100);
                            growInto.GetPart <Brain>().Goals.Clear();
                            growInto.GetPart <Brain>().Calm        = false;
                            growInto.GetPart <Brain>().Hibernating = false;
                            growInto.GetPart <Brain>().FactionMembership.Clear();
                            growInto.AddPart(new Combat());
                        }
                    }
                }

                if (growInto.GetPart <Brain>() != null)
                {
                    XRLCore.Core.Game.ActionManager.AddActiveObject(growInto);
                }


                cell.AddObject(growInto);


                ParentObject.FireEvent(new Event("acegiak_SeedGrow", "From", ParentObject, "To", growInto));
                cell.RemoveObject(ParentObject);
                ParentObject.Destroy("matured", true, true);
            }
        }
Esempio n. 5
0
 public override void Destroy()
 => ParentObject.Destroy();