public ItemHeroConfig.ItemHeroCategoryParameters GetCategoryParameters()
        {
            ItemHeroConfig.ItemHeroCategoryParameters           config = new ItemHeroConfig.ItemHeroCategoryParameters();
            DynData <ItemHeroConfig.ItemHeroCategoryParameters> d      = new DynData <ItemHeroConfig.ItemHeroCategoryParameters>(config);

            d.Set <Amplitude.StaticString>("CategoryName", GetCategoryName());
            d.Set <Amplitude.StaticString>("TypeName", GetCategoryTypeName());
            return(config);
        }
Exemple #2
0
        private void GameSelectionPanel_LaunchSelectedShipOutAnimation(On.GameSelectionPanel.orig_LaunchSelectedShipOutAnimation orig, GameSelectionPanel self, bool nextOrPrevious, bool playOutSFX)
        {
            DynData <GameSelectionPanel> d = new DynData <GameSelectionPanel>(self);

            Amplitude.StaticString temp = d.Get <Amplitude.StaticString>("selectedShipName");
            if (temp == GetName())
            {
                d.Set <Amplitude.StaticString>("selectedShipName", AnimationPodWrapper.Value);
            }
            orig(self, nextOrPrevious, playOutSFX);
            d.Set <Amplitude.StaticString>("selectedShipName", temp);
        }
Exemple #3
0
        // This uses default animation for Pod
        private void GameSelectionPanel_LaunchSelectedShipInAnimation(On.GameSelectionPanel.orig_LaunchSelectedShipInAnimation orig, GameSelectionPanel self)
        {
            DynData <GameSelectionPanel> d = new DynData <GameSelectionPanel>(self);

            Amplitude.StaticString temp = d.Get <Amplitude.StaticString>("selectedShipName");
            if (temp == GetName())
            {
                d.Set <Amplitude.StaticString>("selectedShipName", AnimationPodWrapper.Value);
            }
            orig(self);
            d.Set <Amplitude.StaticString>("selectedShipName", temp);
        }
Exemple #4
0
        public void FillMap(MapData map, RandoSettings settings, Random random)
        {
            foreach (var room in this.Rooms)
            {
                map.Levels.Add(room.Bake(this.nonce++, settings, random));
            }

            // set warp targets
            foreach (var room in this.Rooms)
            {
                foreach (var node in room.Nodes.Values)
                {
                    foreach (var edge in node.Edges)
                    {
                        var s = edge.CorrespondingEdge(node);
                        if (s.CustomWarp)
                        {
                            var baked = room.BakedRoom;
                            var dyn   = new DynData <LevelData>(baked);
                            dyn.Set <string>("CustomWarp", edge.OtherNode(node).Room.BakedRoom.Name);
                        }
                    }
                }

                if (room.WarpMap != null)
                {
                    var newMap = new Dictionary <string, string>();
                    foreach (var kv in room.WarpMap)
                    {
                        newMap[kv.Key] = kv.Value.BakedRoom.Name;
                    }
                    var dyn = new DynData <LevelData>(room.BakedRoom);
                    dyn.Set <Dictionary <string, string> >("WarpMapping", newMap);
                }

                room.Bake2();
            }

            var hasExtendedVariantTriggers = map.Levels.Exists(levelData =>
                                                               levelData.Triggers.Exists(entityData => extendedVariantsEntities.Contains(entityData.Name)) ||
                                                               levelData.Entities.Exists(entityData => extendedVariantsEntities.Contains(entityData.Name)));
            var hasIsaVariantTriggers = map.Levels.Exists(levelData =>
                                                          levelData.Triggers.Exists(entityData => entityData.Name == "ForceVariantTrigger"));
            var dyn2 = new DynData <MapData>(map);

            dyn2.Set <bool?>("HasExtendedVariantTriggers", hasExtendedVariantTriggers);
            dyn2.Set <bool?>("HasIsaVariantTriggers", hasIsaVariantTriggers);
        }
Exemple #5
0
        private void GameSelectionPanel_Display(On.GameSelectionPanel.orig_Display orig, GameSelectionPanel self, bool isMultiplayer, string mpSaveKey, int slotCount, GameSelectionPanel.GameSelectionFinishedHandler onGameSelectionFinished)
        {
            Log("Attempting to Display!");
            IDatabase <ShipConfig> db = Databases.GetDatabase <ShipConfig>(false);

            Log("Database loaded!");
            if (db.GetValue(this.GetConfig().Name) != null)
            {
                // It already exists within the database, so we can continue
                Log("The shipconfig with name: " + this.GetConfig().Name + " already exists inside the database!");
            }
            else
            {
                db.Add(this.GetConfig());
            }
            DynData <GameSelectionPanel> paneldyn = new DynData <GameSelectionPanel>(self);

            paneldyn.Set <IDatabase <ShipConfig> >("shipConfigDB", db);
            Log("Database set!");

            orig(self, isMultiplayer, mpSaveKey, slotCount, onGameSelectionFinished);

            Log("Available Ships:");
            foreach (string s in paneldyn.Get <List <Amplitude.StaticString> >("availableShips"))
            {
                Log(s);
            }
            Log("DB:");
            foreach (ShipConfig s in paneldyn.Get <IDatabase <ShipConfig> >("shipConfigDB"))
            {
                Log("Name: " + s.Name + " localized: " + s.GetLocalizedName() + " desc: " + s.GetLocalizedDescription() + " abscissa val: " + s.AbscissaValue);
            }
        }
        public static void LeafGolemThrowLeavesSpecialState_OnThrow(On.LeafGolemThrowLeavesSpecialState.orig_OnThrow orig, LeafGolemThrowLeavesSpecialState self)
        {
            specialState     = self;
            specialStateData = new DynData <LeafGolemThrowLeavesSpecialState>(self);
            boss             = specialStateData.Get <LeafGolemBoss>("boss");

            boss.ClearOnThrowHandlers();
            specialStateData.Set("attackSFX", Manager <AudioManager> .Instance.PlaySoundEffect(boss.groundAttackSFX));

            boss.Projectile_1.gameObject.SetActive(true);
            boss.Projectile_2.gameObject.SetActive(true);
            projectile_3.gameObject.SetActive(true);
            projectile_4.gameObject.SetActive(true);
            boss.Projectile_1.transform.position = boss.downProjectileSpawnPos.position;
            boss.Projectile_2.transform.position = boss.downProjectileSpawnPos.position + Vector3.down * 0.75f;
            projectile_3.transform.position      = boss.downProjectileSpawnPos.position;
            projectile_4.transform.position      = boss.downProjectileSpawnPos.position + Vector3.down * 0.75f;

            Vector3 group1Target = boss.Projectile_1.transform.position + Vector3.left * 10f;
            float   duration     = Vector3.Distance(boss.Projectile_1.transform.position, group1Target) / (int)(self.projectileSpeed * 1.5f);

            boss.Projectile_1.GoToQuad(group1Target, duration);
            boss.Projectile_2.GoToQuad(group1Target + Vector3.down * 0.75f, duration);

            Vector3 group2Target = projectile_3.transform.position + Vector3.right * 10f;
            float   duration2    = Vector3.Distance(projectile_3.transform.position, group2Target) / (int)(self.projectileSpeed * 1.5f);

            projectile_3.GoToQuad(group2Target, duration2);
            projectile_4.GoToQuad(group2Target + Vector3.down * 0.75f, duration2);

            boss.Projectile_1.onReachedPosition += OnProjectileReachedUpApart;
            boss.Projectile_2.onReachedPosition += OnProjectileReachedUpApart;
            projectile_3.onReachedPosition      += OnProjectileReachedUpApart;
            projectile_4.onReachedPosition      += OnProjectileReachedUpApart;
        }
        IEnumerator EmeraldGolemRightTripleStompState_TripleStompCoroutine(On.EmeraldGolemRightTripleStompState.orig_TripleStompCoroutine orig, EmeraldGolemRightTripleStompState self)
        {
            DynData <EmeraldGolemRightTripleStompState> selfData = new DynData <EmeraldGolemRightTripleStompState>(self);
            EmeraldGolemBoss boss = selfData.Get <EmeraldGolemBoss>("boss");

            selfData.Set("leftArmCoroutine", boss.leftArm.GoToDefaultPosition());
            yield return(selfData.Get <Coroutine>("leftArmCoroutine"));

            selfData.Set("rightArmCoroutine", boss.StartCoroutine(boss.rightArm.AnimatorQuadrupleStompCoroutine(true, true, true, 573.5f)));
            yield return(selfData.Get <Coroutine>("rightArmCoroutine"));

            selfData.Set("rightArmCoroutine", boss.rightArm.GoToDefaultPosition());
            yield return(selfData.Get <Coroutine>("rightArmCoroutine"));

            selfData.Get <StateMachine>("stateMachine").SetState <EmeraldGolemStompLeftRightState>(new EmeraldGolemStompLeftRightStateParams(1));
        }
        public TemporaryKey(EntityData data, Vector2 offset, EntityID id) : base(data.Position + offset, id, data.NodesOffset(offset))
        {
            this.follower = Get <Follower>();
            // Create sprite
            DynData <Key> dyndata = new DynData <Key>(this);

            sprite = dyndata.Get <Sprite>("sprite");
            Remove(sprite);
            sprite         = new Sprite(GFX.Game, data.Attr("directory", "collectables/FrostHelper/keytemp") + "/");
            sprite.Justify = new Vector2(0.5f, 0.5f);
            sprite.AddLoop("idle", "idle", 0.1f);
            sprite.AddLoop("enter", "enter", 0.1f);
            sprite.Play("idle");
            Add(sprite);
            dyndata.Set("sprite", sprite);
            Follower follower = this.follower;

            follower.OnLoseLeader          = (Action)Delegate.Combine(follower.OnLoseLeader, new Action(Dissolve));
            this.follower.PersistentFollow = false; // was false
            Add(new TransitionListener
            {
                OnOut = delegate(float f)
                {
                    StartedUsing = false;
                    if (!IsUsed)
                    {
                        Dissolve();
                    }
                }
            });
        }
        private void OnPlayerSprite_ctor(On.Celeste.PlayerSprite.orig_ctor orig, Celeste.PlayerSprite self, PlayerSpriteMode mode)
        {
            orig(self, mode);
            if (Settings.Enabled && (self.Mode == PlayerSpriteMode.Madeline || self.Mode == PlayerSpriteMode.MadelineNoBackpack))
            {
                string id = "";
                switch (self.Mode)
                {
                case PlayerSpriteMode.Madeline:
                    id = "player_KaydenFox";
                    break;

                case PlayerSpriteMode.MadelineNoBackpack:
                    id = "player_no_backpack_KaydenFox";
                    break;
                }

                DynData <Celeste.PlayerSprite> spriteDynData = new DynData <Celeste.PlayerSprite>(self);
                spriteDynData.Set("spriteName", id);
                if (!self.HasHair)
                {
                    Celeste.PlayerSprite.CreateFramesMetadata(id);
                }

                Celeste.GFX.SpriteBank.CreateOn(self, id);
            }
        }
        private void GameSelectionPanel_RefreshContent(On.GameSelectionPanel.orig_RefreshContent orig, GameSelectionPanel self)
        {
            if (!run)
            {
                // Set GameConfig
                SetGameConfig();

                // Need to AT LEAST alter the following:
                // GameSelectionPanel.Display --> NullReference
                // Lift.Show() --> IndexOutOfBounds

                // GameSelectionPanel.Display --> NullReference
                var d = new DynData <GameSelectionPanel>(self);
                mod.Log("Before set:");
                mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount"));
                mod.Log("GameSelectionPanel.competitorsTable: " + d.Get <AgeTransform>("competitorsTable"));
                mod.Log("GameSelectionPanel.competitorSlots: " + d.Get <List <CompetitorSlot> >("competitorSlots"));

                d.Set <int>("maxHeroCount", maxHeroShipCountWrapper.Value);

                mod.Log("After set:");
                mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount"));


                run = true;
            }
            orig(self);
        }
        private void GameSelectionPanel_Display(On.GameSelectionPanel.orig_Display orig, GameSelectionPanel self, bool isMultiplayer, string mpSaveKey, int slotCount, GameSelectionPanel.GameSelectionFinishedHandler onGameSelectionFinished)
        {
            // Should happen often enough (before we get to the PodScreen) in order to work out.
            if (!run)
            {
                // Set GameConfig
                SetGameConfig();

                // Need to AT LEAST alter the following:
                // GameSelectionPanel.Display --> NullReference
                // Lift.Show() --> IndexOutOfBounds

                // GameSelectionPanel.Display --> NullReference
                var d = new DynData <GameSelectionPanel>(self);
                mod.Log("Before set:");
                mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount"));
                mod.Log("GameSelectionPanel.competitorsTable: " + d.Get <AgeTransform>("competitorsTable"));
                mod.Log("GameSelectionPanel.competitorSlots: " + d.Get <List <CompetitorSlot> >("competitorSlots"));

                d.Set <int>("maxHeroCount", maxHeroShipCountWrapper.Value);

                mod.Log("After set:");
                mod.Log("GameSelectionPanel.maxHeroCount: " + d.Get <int>("maxHeroCount"));

                run = true;
            }
            orig(self, isMultiplayer, mpSaveKey, slotCount, onGameSelectionFinished);
        }
Exemple #12
0
        IEnumerator NecromancerShootingState_ShootCoroutine(On.NecromancerShootingState.orig_ShootCoroutine orig, NecromancerShootingState self)
        {
            DynData <NecromancerShootingState> selfData = new DynData <NecromancerShootingState>(self);
            NecromancerBoss boss      = selfData.Get <NecromancerBoss>("boss");
            Vector3         targetPos = (!(Manager <PlayerManager> .Instance.Player.transform.position.x > boss.arenaCenter.position.x)) ? boss.castingPosRight.position : boss.castingPosLeft.position;

            boss.Invincibru       = true;
            boss.hurtZone.enabled = false;
            boss.Animator.Update(0f);
            boss.Animator.SetTrigger("TeleportOut");
            yield return(new WaitForSeconds(1f));

            Vector3 position3 = boss.arenaCenter.position;

            if (targetPos.x < position3.x)
            {
                boss.transform.localScale = new Vector3(-1f, 1f, 1f);
            }
            else
            {
                boss.transform.localScale = Vector3.one;
            }

            boss.transform.position = targetPos;
            boss.Animator.SetTrigger("TeleportIn");
            yield return(new WaitForSeconds(0.25f));

            boss.hurtZone.enabled = true;
            boss.Invincibru       = false;
            specialArrows         = true;
            while (selfData.Get <int>("maxWaveCount") > 0)
            {
                boss.Animator.SetBool("Shooting", true);
                yield return(new WaitForSeconds(0.3f));

                float[] pattern = GetRandomShotPattern();
                foreach (float wait in pattern)
                {
                    boss.Animator.SetTrigger("DoShot");
                    yield return(new WaitForSeconds(wait));
                }
                boss.Animator.SetBool("Shooting", false);
                selfData.Set("maxWaveCount", selfData.Get <int>("maxWaveCount") - 1);
                yield return(new WaitForSeconds(1f));
            }
            selfData.Set("allDone", true);
        }
 void ObjectSpawner_Start(On.ObjectSpawner.orig_Start orig, ObjectSpawner self)
 {
     orig(self);
     if (self == spawner)
     {
         DynData <ObjectSpawner> spawnerData = new DynData <ObjectSpawner>(self);
         spawnerData.Set("spawnRect", new Rect(new Vector2(spawner.transform.position.x - 1.03f, spawner.transform.position.y - .5f), new Vector2(2, 3)));
     }
 }
Exemple #14
0
        void PoisonArrow_Explode(On.PoisonArrow.orig_Explode orig, PoisonArrow self)
        {
            orig(self);
            self.GetComponent <SpriteRenderer>().color = Color.white;
            self.damageTypeImmunity = 0;
            DynData <PoisonArrow> selfData = new DynData <PoisonArrow>(self);

            selfData.Set("bounceAtWall", false);
        }
        public ProbabilityWeightDepthRangeConfig[] GetDepthRangeConfigs()
        {
            ProbabilityWeightDepthRangeConfig config = new ProbabilityWeightDepthRangeConfig();
            EvolutiveValueConfig prob = new EvolutiveValueConfig();

            DynData <ProbabilityWeightDepthRangeConfig> d = new DynData <ProbabilityWeightDepthRangeConfig>(config);
            DynData <EvolutiveValueConfig> d2             = new DynData <EvolutiveValueConfig>(prob);

            d.Set("LevelMin", GetMinLevel());
            d.Set("LevelMax", GetMaxLevel());
            d.Set("Start", 0);
            d2.Set("StartValue", GetStartingProbabilityWeight());
            d2.Set("DepthBonus", (float)0);
            d2.Set("MaxValue", (float)-1);
            d.Set("ProbabilityWeight", prob);

            return(new ProbabilityWeightDepthRangeConfig[] { config });
        }
 private static void Player_OnCollideH(On.Celeste.Player.orig_OnCollideH orig, Player self, CollisionData data)
 {
     if (self.StateMachine.State == Player.StDash || self.StateMachine.State == Player.StRedDash)
     {
         bool flag14 = DreamDashCheck(self, Vector2.UnitX * Math.Sign(self.Speed.X));
         if (flag14)
         {
             self.StateMachine.State = FrostModule.CustomDreamDashState;
             DynData <Player> ddata = new DynData <Player>(self);
             ddata.Set("dashAttackTimer", 0f);
             ddata.Set("gliderBoostTimer", 0f);
             return;
         }
     }
     if (self.StateMachine.State != FrostModule.CustomDreamDashState)
     {
         orig(self, data);
     }
 }
        public DialogConfig[] GetIntroDialogs()
        {
            DialogConfig           one = new DialogConfig();
            DynData <DialogConfig> d1  = new DynData <DialogConfig>(one);

            d1.Set <Amplitude.StaticString>("Name", "Intro1");
            d1.Set <string>("Text", "%Hero_" + GetName() + "_Intro1");
            DialogConfig           two = new DialogConfig();
            DynData <DialogConfig> d2  = new DynData <DialogConfig>(two);

            d2.Set <Amplitude.StaticString>("Name", "Intro2");
            d2.Set <string>("Text", "%Hero_" + GetName() + "_Intro2");
            DialogConfig           three = new DialogConfig();
            DynData <DialogConfig> d3    = new DynData <DialogConfig>(three);

            d3.Set <Amplitude.StaticString>("Name", "Intro3");
            d3.Set <string>("Text", "%Hero_" + GetName() + "_Intro3");
            return(new DialogConfig[] { one, two, three });
        }
        public HeroConfig GetHeroConfig()
        {
            HeroConfig           config = new HeroConfig();
            DynData <HeroConfig> d      = new DynData <HeroConfig>(config);

            d.Set <Amplitude.StaticString>("Name", "Hero_" + GetName());
            d.Set <float>("RecruitmentFoodCost", GetRecruitCost());
            d.Set <AITargetType>("AITargetType", GetTargetType());
            d.Set <string>("AttackType", GetAttackType());
            d.Set <string>("Archetype", "%Hero_" + GetName() + "_Archetype");
            d.Set <int>("UnlockLevelCount", GetUnlockLevelCount());
            d.Set <HeroConfig.HeroFaction>("Faction", GetFaction());
            d.Set <DialogConfig[]>("IntroDialogs", GetIntroDialogs());
            d.Set <EquipmentSlotConfig[]>("EquipmentSlots", GetEquipmentSlots());
            return(config);
        }
Exemple #19
0
        public void SetManagerTempo(float Tempo)
        {
            // let me speak to your manager... to change the tempo
            CassetteBlockManager manager = Scene.Tracker.GetEntity <CassetteBlockManager>();

            if (manager != null)
            {
                DynData <CassetteBlockManager> data = new DynData <CassetteBlockManager>(manager);
                data.Set("tempoMult", Tempo);
            }
        }
Exemple #20
0
 void PoisonArrow_StartMovement(On.PoisonArrow.orig_StartMovement orig, PoisonArrow self, int smallShot)
 {
     orig(self, smallShot);
     if (specialArrows)
     {
         self.GetComponent <SpriteRenderer>().color = Color.cyan;
         self.damageTypeImmunity = (EDamageType)255;
         DynData <PoisonArrow> arrowData = new DynData <PoisonArrow>(self);
         arrowData.Set("bounceAtWall", true);
     }
 }
        public HeroLevelConfig[] GetHeroLevelConfigs()
        {
            List <HeroLevelConfig> lst = new List <HeroLevelConfig>();

            foreach (int level in GetLevelUpData().Keys)
            {
                HeroLevelConfig           config = new HeroLevelConfig();
                DynData <HeroLevelConfig> d      = new DynData <HeroLevelConfig>(config);
                d.Set <Amplitude.StaticString>("Name", "Hero_" + GetName() + "_LVL" + level);
                d.Set <float>("FoodCost", (float)Convert.ToDouble(GetLevelUpData()[level][0]));
                string[] skills = new string[GetLevelUpData()[level].Length - 1];
                for (int i = 1; i < GetLevelUpData()[level].Length; i++)
                {
                    skills[i - 1] = GetLevelUpData()[level][i];
                }
                d.Set <string[]>("Skills", skills);
                lst.Add(config);
            }
            return(lst.ToArray());
        }
        public RarityConfig GetConfig(string name, Dictionary <string, int> dictOfData)
        {
            RarityConfig config = new RarityConfig();
            ProbabilityWeightDepthRangeConfig prob = new ProbabilityWeightDepthRangeConfig();
            EvolutiveValueConfig prob2             = new EvolutiveValueConfig();

            DynData <RarityConfig> d = new DynData <RarityConfig>(config);
            DynData <ProbabilityWeightDepthRangeConfig> d2 = new DynData <ProbabilityWeightDepthRangeConfig>(prob);
            DynData <EvolutiveValueConfig> d3 = new DynData <EvolutiveValueConfig>(prob2);

            config.XmlSerializableName = name;
            d2.Set("LevelMin", dictOfData["LevelMin"]);
            d2.Set("LevelMax", dictOfData["LevelMax"]);
            d2.Set("Start", dictOfData["Start"]);
            d3.Set("StartValue", (float)dictOfData["StartValue"]);
            d3.Set("DepthBonus", (float)dictOfData["DepthBonus"]);
            d3.Set("MaxValue", (float)dictOfData["MaxValue"]);
            d2.Set("ProbabilityWeight", prob2);
            d.Set("DepthRanges", new ProbabilityWeightDepthRangeConfig[] { prob });
            return(config);
        }
Exemple #23
0
        private void _GotoTitleScreen()
        {
            OuiTitleScreen title = Overworld.Goto <OuiTitleScreen>();

            title.IsStart(Overworld, Overworld.StartMode.Titlescreen);
            title.IsStart(Overworld, Overworld.StartMode.MainMenu);

            DynData <OuiTitleScreen> data = new DynData <OuiTitleScreen>(title);

            data.Set <float>("alpha", 0);
            title.Visible = true;
        }
        public static void DreamDashEnd()
        {
            Player           player = FrostModule.StateGetPlayer();
            DynData <Player> data   = new DynData <Player>(player);

            player.Depth = 0;
            if (!data.Get <bool>("dreamJump"))
            {
                player.AutoJump      = true;
                player.AutoJumpTimer = 0f;
            }
            bool flag2 = !player.Inventory.NoRefills;

            if (flag2)
            {
                player.RefillDash();
            }
            player.RefillStamina();
            player.TreatNaive = false;
            CustomDreamBlock dreamBlock = data.Get <CustomDreamBlock>("customDreamBlock");

            if (dreamBlock != null)
            {
                bool flag4 = player.DashDir.X != 0f;
                if (flag4)
                {
                    data.Set("jumpGraceTimer", 0.1f);
                    data.Set("dreamJump", true);
                }
                else
                {
                    data.Set("jumpGraceTimer", 0f);
                }
                dreamBlock.OnPlayerExit(player);
                data.Set <CustomDreamBlock>("customDreamBlock", null);
            }
            player.Stop(data.Get <SoundSource>("dreamSfxLoop"));
            player.Play("event:/char/madeline/dreamblock_exit", null, 0f);
            Input.Rumble(RumbleStrength.Medium, RumbleLength.Short);
        }
        public void LeafGolemThrowLeavesState_OnThrow(On.LeafGolemThrowLeavesState.orig_OnThrow orig, LeafGolemThrowLeavesState self)
        {
            state     = self;
            stateData = new DynData <LeafGolemThrowLeavesState>(self);
            boss      = stateData.Get <LeafGolemBoss>("boss");

            stateData.Set("attackSFX", Manager <AudioManager> .Instance.PlaySoundEffect(boss.groundAttackSFX));
            boss.Projectile_1.gameObject.SetActive(true);
            boss.Projectile_1.transform.position = boss.leftRightProjectileSpawnPos.position;
            RaycastHit2D raycastHit2D = Physics2D.Raycast(boss.Projectile_1.transform.position, Vector3.right * boss.LookDir, float.PositiveInfinity, LayerMaskConstants.GROUND_8_AND_16);

            projectileTargetPos = raycastHit2D.point;
            ref Vector3 reference = ref projectileTargetPos;
        public static void DreamDashBegin()
        {
            Player           player       = FrostModule.StateGetPlayer();
            DynData <Player> data         = new DynData <Player>(player);
            SoundSource      dreamSfxLoop = data.Get <SoundSource>("dreamSfxLoop");
            bool             flag         = dreamSfxLoop == null;

            if (flag)
            {
                dreamSfxLoop = new SoundSource();
                player.Add(dreamSfxLoop);
                data.Set("dreamSfxLoop", dreamSfxLoop);
            }
            player.Speed      = player.DashDir * 240f;
            player.TreatNaive = true;
            player.Depth      = -12000;
            data.Set("dreamDashCanEndTimer", 0.1f);
            player.Stamina = 110f;
            data.Set("dreamJump", false);
            player.Play("event:/char/madeline/dreamblock_enter", null, 0f);
            player.Loop(dreamSfxLoop, "event:/char/madeline/dreamblock_travel");
        }
        private void GotoNextEndless(ILContext il)
        {
            var cursor = new ILCursor(il);

            if (!cursor.TryGotoNext(MoveType.Before, instr => instr.MatchLdarg(0),
                                    instr => instr.MatchLdfld <AreaComplete>("snow")))
            {
                throw new Exception("Can't find patch point 2!");
            }

            var label = cursor.MarkLabel();

            cursor.Index = 0;
            if (!cursor.TryGotoNext(MoveType.After, instr => instr.MatchStfld <AreaComplete>("canConfirm")))
            {
                throw new Exception("Can't find patch point 1");
            }

            cursor.EmitDelegate <Func <bool> >(() => {
                var settings = this.endingSettings;
                if (settings == null || settings.Algorithm != LogicType.Endless)
                {
                    return(false);
                }

                if (!genTask.IsCompleted)
                {
                    typeof(AreaComplete).GetField("canConfirm", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Engine.Scene, true);
                    return(true);
                }


                var session    = SaveData.Instance.CurrentSession;
                var time       = session.Time;
                var deaths     = session.Deaths;
                var clean      = session.SeedCleanRandom();
                var dynOld     = new DynData <Session>(session);
                var berries    = dynOld.Get <Entities.BerrySet>("GrabbedLifeBerries");
                session        = new Session(genTask.Result);
                session.Time   = time;
                session.Deaths = deaths;
                session.SeedCleanRandom(clean);
                var dynNew = new DynData <Session>(session);
                dynNew.Set("GrabbedLifeBerries", berries);
                UseSession = session;
                StartMe    = genTask.Result;
                genTask    = null;
                return(true);
            });
            cursor.Emit(Mono.Cecil.Cil.OpCodes.Brtrue, label);
        }
 public static void Update_MouseEvents(InputManager self)
 {
     DynData<InputManager> d = new DynData<InputManager>(self);
     List<ClickDownInfo> leftClickInfos = d.Get<List<ClickDownInfo>>("leftClickInfos");
     List<ClickDownInfo> rightClickInfos = d.Get<List<ClickDownInfo>>("rightClickInfos");
     List<ClickDownInfo> middleClickInfos = d.Get<List<ClickDownInfo>>("middleClickInfos");
     if (!AgeManager.IsMouseCovered)
     {
         if (TASInputPlayer.GetMouseButtonDown(0))
         {
             TriggerClickDownEvent(self, "OnLeftClickDown", ref leftClickInfos);
         }
         if (TASInputPlayer.GetMouseButtonDown(1))
         {
             TriggerClickDownEvent(self, "OnRightClickDown", ref rightClickInfos);
         }
         if (TASInputPlayer.GetMouseButtonDown(2))
         {
             TriggerClickDownEvent(self, "OnMiddleClickDown", ref middleClickInfos);
         }
         // TODO MAYBE ADD MOUSEWHEEL?
     }
     if (TASInputPlayer.GetMouseButtonUp(0) && leftClickInfos != null)
     {
         TriggerClickUpEvent(self, "OnLeftClickUp", ref leftClickInfos);
     }
     if (TASInputPlayer.GetMouseButtonUp(1) && rightClickInfos != null)
     {
         TriggerClickUpEvent(self, "OnRightClickUp", ref rightClickInfos);
     }
     if (TASInputPlayer.GetMouseButtonUp(2) && middleClickInfos != null)
     {
         TriggerClickUpEvent(self, "OnMiddleClickUp", ref middleClickInfos);
     }
     d.Set("leftClickInfos", leftClickInfos);
     d.Set("rightClickInfos", rightClickInfos);
     d.Set("middleClickInfos", middleClickInfos);
 }
        public void AddItems(params NimbatusItem[] Items)
        {
            foreach (NimbatusItem nimbatusItem in Items)
            {
                nimbatusItem.InitStackSettings();
                nimbatusItem.InitDronePerkSettings(SerializableMonobehaviour <DronePerkManager, DronePerkManagerData>
                                                   .Instance.ActivePerk);
                var dynItem = new DynData <NimbatusItem>(nimbatusItem);
                if (SaveGameManager.CurrentGameSettings.HasPartUnlocking)
                {
                    dynItem.Set("Unlocked", true);

                    if (nimbatusItem.DoNotImport || dynItem.Get <bool>("IsStackable"))
                    {
                        dynItem.Set("Unlocked", false);
                    }
                    if (nimbatusItem is WeaponAttributeUpgrade)
                    {
                        dynItem.Set("Unlocked", nimbatusItem.AlwaysUnlocked);
                    }
                    dynItem.Set("UnlimitedStackSize", !dynItem.Get <bool>("IsStackable"));
                    dynItem.Set("CurrentStackSize", 0);
                }
                else if (nimbatusItem.DoNotImport)
                {
                    dynItem.Set("Unlocked", false);
                }
                else
                {
                    dynItem.Set("Unlocked",
                                !(nimbatusItem is WeaponAttributeUpgrade) ||
                                RuntimeGlobals.GameModeSettings.AllTechnologyUnlocked);
                    if (nimbatusItem.AlwaysUnlocked)
                    {
                        dynItem.Set("Unlocked", true);
                    }
                    dynItem.Set("UnlimitedStackSize", true);
                }

                ModItemPrefabs.Add(nimbatusItem);
                ItemPrefabs.AddRange(ModItemPrefabs);
            }
        }
        private static bool SessionVariable(Session session, string name, bool?set = null)
        {
            var dyn = new DynData <Session>(session);

            if (set != null)
            {
                dyn.Set <bool>(name, set.Value);
                return(set.Value);
            }
            else
            {
                return(dyn.Get <bool?>(name) ?? false);
            }
        }