Exemplo n.º 1
0
        public void BirthEgg()
        {
            Cell          currentCell = ParentObject.GetCurrentCell();
            GameObject    gameObject  = currentCell.AddObject(SpawnBlueprint);
            OvipositorEgg Spawn       = gameObject.GetPart <OvipositorEgg>();

            Spawn.Mother = ParentObject;
            XDidY(ParentObject, "lay", "an egg", ".");
        }
Exemplo n.º 2
0
        public void musicalParticles()
        {
            Cell currentCell = ParentObject.GetCurrentCell();

            if (currentCell != null && currentCell.IsVisible())
            {
                int             x2 = currentCell.X;
                int             y  = currentCell.Y;
                ParticleManager particleManager = XRLCore.ParticleManager;
                particleManager.AddSinusoidal("&W" + '\u000e', x2, y, 1.5f * (float)Stat.Random(1, 6), 0.1f * (float)Stat.Random(1, 60), 0.1f + 0.025f * (float)Stat.Random(0, 4), 1f, 0f, 0f, -0.1f - 0.05f * (float)Stat.Random(1, 6), 999);
                particleManager.AddSinusoidal("&Y" + '\u000d', x2, y, 1.5f * (float)Stat.Random(1, 6), 0.1f * (float)Stat.Random(1, 60), 0.1f + 0.025f * (float)Stat.Random(0, 4), 1f, 0f, 0f, -0.1f - 0.05f * (float)Stat.Random(1, 6), 999);
                particleManager.AddSinusoidal("&W" + '\u000d', x2, y, 1.5f * (float)Stat.Random(1, 6), 0.1f * (float)Stat.Random(1, 60), 0.1f + 0.025f * (float)Stat.Random(0, 4), 1f, 0f, 0f, -0.1f - 0.05f * (float)Stat.Random(1, 6), 999);
                particleManager.AddSinusoidal("&Y" + '\u000e', x2, y, 1.5f * (float)Stat.Random(1, 6), 0.1f * (float)Stat.Random(1, 60), 0.1f + 0.025f * (float)Stat.Random(0, 4), 1f, 0f, 0f, -0.1f - 0.05f * (float)Stat.Random(1, 6), 999);
            }
        }
Exemplo n.º 3
0
        public override bool FireEvent(Event E)
        {
            //...
            if (E.ID == "Regenerating" && ParentObject.HasEffect("Submerged"))
            {
                int RegenerationAmountParameter = E.GetIntParameter("Amount");
                RegenerationAmountParameter += (int)Math.Ceiling((float)RegenerationAmountParameter);
                E.SetParameter("Amount", RegenerationAmountParameter);
            }
            else if (E.ID == "BeginMove" && ParentObject.HasEffect("Submerged"))
            {
                Cell Cell = E.GetParameter("DestinationCell") as Cell;
                if (((!Cell.HasObjectWithPart("LiquidVolume") || (Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200) && ParentObject.IsPlayer() && ParentObject.HasEffect("Submerged")))
                {
                    if (Popup.ShowYesNo("Surface and go ashore?") == (int)DialogResult.Yes)
                    {
                        ParentObject.Splash("{{b|*}}");
                        ParentObject.RemoveEffect("Submerged");
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            else if (E.ID == "DiveCommand")
            {
                Cell Cell = ParentObject.GetCurrentCell();

                Mutations ParentsMutations = ParentObject.GetPart <Mutations>();
                if (ParentObject.HasEffect("Flying"))
                {
                    if (IsPlayer())
                    {
                        AddPlayerMessage("You cannot do this while flying");
                    }
                    return(false);
                }
                else if (!Cell.HasObjectWithPart("LiquidVolume"))
                {
                    AddPlayerMessage("You try to dive into the earth, you imagine this would be easier if the ground were, say, just a tad less hard.");
                    return(false);
                }
                else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200)
                {
                    AddPlayerMessage("Its too shallow to dive in!");
                    return(false);
                }
                else if (ParentObject.HasEffect("Submerged"))
                {
                    // AddPlayerMessage("Your return to the surface.");
                    ParentObject.Splatter("{{B|*}}");
                    ParentObject.RemoveEffect("Submerged");
                }
                else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200 && ParentsMutations.HasMutation("Amphibious"))
                {
                    AddPlayerMessage("You feel right at home.");
                    ParentObject.Splatter("{{B|*}}");
                    ParentObject.ApplyEffect(new Submerged(Duration: Effect.DURATION_INDEFINITE));
                }
                else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200 && !ParentsMutations.HasMutation("Amphibious"))
                {
                    ParentObject.Splatter("{{B|*}}");
                    ParentObject.ApplyEffect(new Submerged(Duration: Effect.DURATION_INDEFINITE));
                }
            }
            else if (E.ID == "EndTurn")
            {
                Cell Cell = ParentObject.GetCurrentCell();

                if (ParentObject.HasEffect("Flying") && (ParentObject.HasEffect("Submerged")))
                {
                    ParentObject.RemoveEffect(new Flying());
                    AddPlayerMessage("Removing Paradox Incident.");
                }
                else if (ParentObject.IsHealingPool() && ParentObject.HasEffect("Submerged"))
                {
                    ParentObject.Heal(+ParentObject.Statistics["Toughness"].Modifier);
                }
                else if (((!Cell.HasObjectWithPart("LiquidVolume") || (Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200) && ParentObject.HasEffect("Submerged")))
                {
                    ParentObject.Splash("{{b|*}}");
                    ParentObject.RemoveEffect("Submerged");
                    return(false);
                }
            }
            //...---------------------------------------------------------------------------------------------
            else if (E.ID == "DeepStrikeCommand")
            {
                if (!ParentObject.HasEffect("Submerged") && ParentObject.IsPlayer())
                {
                    AddPlayerMessage("You must be submerged in deep pools of liquid to use this attack.");
                }
                else if (!ParentObject.HasEffect("Submerged") && !ParentObject.IsPlayer())
                {
                }
                else if (ParentObject.HasEffect("Submerged"))
                {
                    string Direction = E.GetStringParameter("Direction");

                    if (Direction == null)
                    {
                        if (ParentObject != null)
                        {
                            Direction = PickDirectionS();
                            try
                            {
                                Patch_PhaseAndFlightMatches.TemporarilyDisabled = true;
                                Event e     = Event.New("CommandAttackDirection", "Direction", Direction);
                                bool  num11 = FireEvent(e);
                                ParentObject.FireEvent(e);
                                XDidY(ParentObject, "rush", "from the depths to strike!", "!", "C", ParentObject);
                                Patch_PhaseAndFlightMatches.TemporarilyDisabled = false;
                            }
                            catch
                            {
                            }
                        }
                    }
                }
            }
            else if (E.ID == "AIGetOffensiveMutationList")
            {
                //AddPlayerMessage("I'mma keel yo ass.");
                if (IsMyActivatedAbilityAIUsable(DiveActivatedAbility))
                {
                    if (!ParentObject.HasEffect("Submerged") && (ParentObject.CurrentCell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200)
                    {
                        E.AddAICommand("DiveCommand");
                    }
                }
                int intParameter = E.GetIntParameter("Distance");
                if (E.GetGameObjectParameter("Target") != null && intParameter <= 1 && !ParentObject.IsFrozen() && IsMyActivatedAbilityAIUsable(DeepStrikeActivatedAbility))
                {
                    E.AddAICommand("DeepStrikeCommand");
                }
            }
            else if (E.ID == "BeginTakeAction")
            {
                if (ParentObject.HasEffect("Flying") && (ParentObject.HasEffect("Submerged")))
                {
                    ParentObject.RemoveEffect(new Flying());
                    AddPlayerMessage("Removing Paradox Incident.");
                }
            }

            return(base.FireEvent(E));
        }
        public override bool FireEvent(Event E)
        {
            if (E.ID == "AttackerHit" && ParentObject.HasEffect("SlumberStance"))
            {
                try
                {
                    var    salthopperDamageSystem = ParentObject.GetPart <WM_MMA_PathSaltHopper>();
                    Damage Damage   = E.GetParameter <Damage>("Damage");
                    var    Attacker = ParentObject;


                    if (salthopperDamageSystem.NegEffectsCollectiveTI.Any(Attacker.HasEffect))
                    {
                        Damage.Amount = (int)Math.Round(Damage.Amount * 1.15f);
                    }
                    if (salthopperDamageSystem.NegEffectsCollectiveTII.Any(Attacker.HasEffect))
                    {
                        Damage.Amount = (int)Math.Round(Damage.Amount * 1.55f);
                    }
                    if (salthopperDamageSystem.NegEffectsCollectiveTIII.Any(Attacker.HasEffect))
                    {
                        Damage.Amount = (int)Math.Round(Damage.Amount * 2.5f);
                    }
                    else
                    {
                    }
                }
                catch
                {
                }
            }
            else if (E.ID == "AttackerAfterAttack" && ParentObject.HasEffect("SlumberStance"))
            {
                // AddPlayerMessage("Execute Attacker hit on Slumberstyle");

                Damage Damage   = E.GetParameter <Damage>("Damage");
                var    Attacker = ParentObject;
                var    Defender = E.GetGameObjectParameter("Defender");
                var    Weapon   = E.GetGameObjectParameter("Weapon");

                Event E2 = Event.New("SlumberCleaveEvent");
                E2.SetParameter("Attacker", ParentObject);
                E2.SetParameter("Defender", Defender);
                E2.SetParameter("Damage", Damage.Amount);

                ParentObject.FireEvent(E2);
            }
            else if (E.ID == "SlumberCleaveEvent" && ParentObject.HasEffect("SlumberStance"))
            {
                GameObject Attacker     = E.GetGameObjectParameter("Attacker");
                GameObject Defender     = E.GetGameObjectParameter("Defender");
                int        DamageAmount = E.GetParameter <int>("Damage");

                int ParentsStr = ParentObject.Statistics["Strength"].Modifier;

                // AddPlayerMessage("var check 1");

                var AttackerLevels = Attacker.Statistics["Level"].BaseValue;

                // AddPlayerMessage("var check 2");

                var AttackerCell          = Attacker.GetCurrentCell();
                var AttackersAdacentCells = AttackerCell.GetLocalAdjacentCells();

                // AddPlayerMessage("slumberstyle initiated vars");
                string[] directionList = Directions.DirectionList;
                foreach (string direction3 in directionList)
                {
                    GameObject Flankers = ParentObject.GetCurrentCell().GetCellFromDirection(direction3)?.GetCombatTarget(ParentObject, AllowInanimate: false);
                    if (Stat.Random(1, 100) <= 3 + AttackerLevels / 3)
                    {
                        // AddPlayerMessage("Dismember is Firing?");

                        var FlankersBody = Flankers.Body.GetParts();
                        foreach (var ob in FlankersBody)
                        {
                            if (Stat.Random(1, 100) <= 2 + (AttackerLevels / 10) && ob.IsSeverable() && ob.ParentBody != ParentObject.Body)
                            {
                                if (ob.AnyMortalParts() || ob.Mortal)
                                {
                                    if (ob.Type == "Head")
                                    {
                                        ob.Dismember();
                                        Flankers.Die(ParentObject, ParentObject.it + " lob " + Flankers.its + ob.Name + ", killing it!", null);
                                    }
                                    else if (ob.Type == "Body")
                                    {
                                        ob.Dismember();
                                        Flankers.Die(ParentObject, ParentObject.it + "obliterates" + Flankers.its + ob.Name + ", killing it!", null);
                                    }
                                }
                            }
                            else if (ob.IsSeverable() && ob.Appendage && !ob.Mortal && ob.ParentBody != ParentObject.Body)
                            {
                                ob.Dismember();
                            }
                        }
                    }
                    if (Stat.Random(1, 100) <= 25 + AttackerLevels / 3)
                    {
                        // AddPlayerMessage("Push is firing?");

                        Flankers.TakeDamage(ref (DamageAmount));
                        RageStrikePulse(Flankers.CurrentCell);
                        Flankers.Push(direction3, 1000, 1);
                    }
                }
            }
            else if (E.ID == "SlumberWitnessEvent" && ParentObject.HasEffect("SlumberStance"))
            {
                // AddPlayerMessage("slumberstarting for each 2");

                var Attacker = E.GetGameObjectParameter("Attacker");
                var Defender = E.GetGameObjectParameter("Defender");

                var AttackerLevels = Attacker.Statistics["Level"].BaseValue;

                var CheckCells = Attacker.CurrentCell.GetLocalAdjacentCells();

                var CellQuery = CheckCells.Where(C => C.HasObjectWithTagOrProperty("Brain") || C.HasObjectWithTagOrProperty("Combat") && C.HasCombatObject() && !C.HasObject(Attacker));

                foreach (var c2 in CellQuery)
                {
                    // AddPlayerMessage("slumberstarting for each 3");
                    var FrightenedFlankers = c2.GetObjectsInCell();
                    var FrightQuery        = FrightenedFlankers.Where(Obj => !Obj.MakeSave("Ego", 20 + (AttackerLevels / 3), Attacker, "Ego", "Ego", false) && Obj != Attacker && Obj.HasPart("Brain") || Obj.HasPart("Combat"));

                    foreach (var o2 in FrightenedFlankers)
                    {
                        // AddPlayerMessage("slumberstarting for each 4");
                        string text = (int)Math.Floor((double)(AttackerLevels / 2) + 3.0) + "d6";
                        int    num  = ParentObject.StatMod("Ego");

                        o2.pBrain.Goals.Clear();
                        o2.pBrain.PushGoal(new Flee(Attacker, 5 + (AttackerLevels / 2), false));
                        // AddPlayerMessage(o2.The + " flees in horror of " + Attacker.Its + " torrent of rage.");
                    }
                }
            }
            else if (E.ID == "PerformMeleeAttack" && ParentObject.HasEffect("SlumberStance"))
            {
                int HitBonus = E.GetIntParameter("HitBonus");

                HitBonus = +1;
            }

            // if (E.ID == "EndTurn" && ParentObject.HasEffect("SlumberStance"))
            // {
            //     AddPlayerMessage(" ");
            // }

            return(base.FireEvent(E));
        }
Exemplo n.º 5
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "GetShortDescription")
            {
                StringBuilder    stringBuilder    = Event.NewStringBuilder();
                ActivePartStatus activePartStatus = GetActivePartStatus();
                stringBuilder.Append("\n&CBurns oil to motor forwards at high speeds.");
                if (activePartStatus == ActivePartStatus.EMP)
                {
                    stringBuilder.Append(" (&WEMP&C)");
                }
                else if (activePartStatus == ActivePartStatus.Unpowered)
                {
                    stringBuilder.Append(" (&Kunpowered&C)");
                }
                else if (activePartStatus == ActivePartStatus.Booting && ParentObject.GetPart <BootSequence>().IsObvious())
                {
                    stringBuilder.Append(" (&bwarming up&C)");
                }
                else if (activePartStatus != 0 && activePartStatus != ActivePartStatus.NeedsSubject)
                {
                    stringBuilder.Append(" (&rnonfunctional&C)");
                }
                E.AddParameter("Postfix", E.GetStringParameter("Postfix") + stringBuilder.ToString());
            }
            if (E.ID == "CommandMove" && GasCheck())
            {
                string direction = E.GetStringParameter("Direction");
                string source    = E.GetStringParameter("Source");

                if (source != "Gas")
                {
                    int        num3        = 10;
                    GameObject riderObject = ParentObject.pPhysics.Equipped;
                    string     text3       = riderObject.pRender.Tile;

                    string colorString = (string.IsNullOrEmpty(riderObject.pRender.TileColor) ? riderObject.pRender.ColorString : riderObject.pRender.TileColor);
                    string detailColor = riderObject.pRender.DetailColor;
                    string text2       = riderObject.pRender.ColorString + riderObject.pRender.RenderString;
                    for (int i = Stat.Rnd2.Next(2, 5); i > 0; i--)
                    {
                        if (riderObject.FireEvent(Event.New("CommandMove", "Direction", direction, "EnergyCost", 0, "Source", "Gas")))
                        {
                            if (Visible())
                            {
                                int    num4 = XRL.Rules.Stat.RandomCosmetic(1, 3);
                                string text = string.Empty;
                                if (num4 == 1)
                                {
                                    text = string.Empty + '°';
                                }
                                if (num4 == 2)
                                {
                                    text = string.Empty + '±';
                                }
                                if (num4 == 3)
                                {
                                    text = string.Empty + '²';
                                }
                                riderObject.ParticleBlip("&Y^K" + text, 3);
                            }
                        }
                    }
                }
            }
            if (E.ID == "EndTurn")
            {
                if (Ability.ToggleState)
                {
                    ParentObject.pPhysics.Equipped.Smoke();
                }
            }
            if (E.ID == "AfterMoved")
            {
                Cell cell        = E.GetParameter("FromCell") as Cell;
                Cell currentCell = ParentObject.GetCurrentCell();
                if (cell != null && cell.ParentZone == currentCell.ParentZone && PlumeLevel > 0 && IsReady())
                {
                    string directionFromCell = currentCell.GetDirectionFromCell(cell);
                    Cell   cell2             = cell.GetCellFromDirection(directionFromCell);
                    if (cell2 == null || cell2.ParentZone != currentCell.ParentZone)
                    {
                        cell2 = cell;
                    }
                    cell2?.ParticleBlip("&r^W" + (char)(219 + Stat.Random(0, 4)), 6);
                    cell?.ParticleBlip("&R^W" + (char)(219 + Stat.Random(0, 4)), 3);
                }
            }
            if (E.ID == "AIGetOffensiveMutationList")
            {
                if (ParentObject.pPhysics != null && ParentObject.pPhysics.IsFrozen())
                {
                    return(true);
                }
                List <XRL.World.AI.GoalHandlers.AICommandList> CommandList = (List <XRL.World.AI.GoalHandlers.AICommandList>)E.GetParameter("List");
                if (Ability != null)
                {
                    CommandList.Add(new XRL.World.AI.GoalHandlers.AICommandList("CommandAcegiakGasGasGas", 1));
                }
                return(true);
            }
            if (E.ID == "CommandAcegiakGasGasGas")
            {
                if (Ability == null)
                {
                    return(true);
                }
                Ability.ToggleState = !Ability.ToggleState;
            }
            if (E.ID == "Equipped")
            {
                GameObject gameObjectParameter = E.GetGameObjectParameter("EquippingObject");
                AddSkill(gameObjectParameter);
                gameObjectParameter.RegisterPartEvent(this, "CommandMove");
                gameObjectParameter.RegisterPartEvent(this, "CommandAcegiakGasGasGas");
            }
            if (E.ID == "Unequipped")
            {
                GameObject gameObjectParameter2 = E.GetGameObjectParameter("UnequippingObject");
                RemoveSkill(gameObjectParameter2);
                gameObjectParameter2.UnregisterPartEvent(this, "CommandMove");
                gameObjectParameter2.UnregisterPartEvent(this, "CommandAcegiakGasGasGas");
            }
            return(base.FireEvent(E));
        }