Beispiel #1
0
 private void RandomizeName()
 {
     string[] array =
     {
         "Oh god!",
         "The pain!",
         "It hurts so much",
         "STOP IT!!",
         "Training Dummy",
         "What'd I do to you?",
         "WHY???",
         "Stop hitting me",
         "Why you do this?",
         "IT HUURRRTS",
         "Oof",
         "Ouch",
         "BLARGH",
         "I give up!",
         "Do you even lift?",
         "Ok, that one hurt",
         "That tickled",
         "That all you got?",
         "Dost thou even hoist?",
         "Nice try",
         "Weak",
         "Try again"
     };
     Name = array[CDGMath.RandomInt(0, array.Length - 1)];
 }
        public static void Display(int numEntities)
        {
            float step = 1320f / numEntities;

            lock (_defaultCommands)
                for (int i = 0; i < numEntities; i++)
                {
                    Instance.Run(new Vector2(step * i, 720f), x =>
                    {
                        x.Sprite.ForceDraw = true;

                        var cmd           = _defaultCommands[0];
                        cmd.Properties[1] = "0.8";

                        cmd = _defaultCommands[1];
                        cmd.Properties[1] = CDGMath.RandomFloat(-180f, 180f).ToString();

                        cmd = _defaultCommands[2];
                        cmd.Properties[1] = CDGMath.RandomInt(-50, 50).ToString();
                        cmd.Properties[3] = CDGMath.RandomInt(-50, 0).ToString();

                        cmd                  = _defaultCommands[3];
                        cmd.Duration         = 0.5f;
                        cmd.InitialValues[0] = 0.8f;
                    });
                }
        }
Beispiel #3
0
        public static void Display(Vector2 position, int numSprites = 30, float duration = 0.4f)
        {
            float step            = duration / numSprites;
            float currentDuration = 0f;

            lock (_defaultCommands)
                for (int i = 0; i < numSprites; i++)
                {
                    Instance.Run(new Vector2(position.X + CDGMath.RandomInt(-100, 100), position.Y + CDGMath.RandomInt(-100, 100)), x =>
                    {
                        x.Sprite.TextureColor = Color.Black;

                        var cmd      = _defaultCommands[0];
                        cmd.Duration = currentDuration;

                        cmd               = _defaultCommands[1];
                        cmd.Duration      = duration - currentDuration;
                        cmd.Properties[1] = currentDuration.ToString();
                        cmd.Properties[3] = position.X.ToString();
                        cmd.Properties[5] = position.Y.ToString();
                    });

                    currentDuration += step;
                }
        }
Beispiel #4
0
        public void Update(GameTime gameTime)
        {
            var num = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (!m_silhouetteFlying && m_silhouetteTimer > 0f)
            {
                m_silhouetteTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (m_silhouetteTimer <= 0f)
                {
                    var num2 = CDGMath.RandomInt(1, 100);
                    if (num2 > 95)
                    {
                        ShowSilhouette(true);
                    }
                    else if (num2 > 65)
                    {
                        ShowSilhouette(false);
                    }
                    else
                    {
                        m_silhouetteTimer = 5f;
                    }
                }
            }
            if (!m_silhouetteFlying && m_silhouetteTimer <= 0f)
            {
                m_silhouetteTimer = 5f;
            }
            if (m_silhouette.SpriteName == "GardenPerson_Sprite")
            {
                m_silhouette.Rotation += 120f * num;
            }
        }
Beispiel #5
0
        public void CastFireball()
        {
            var projectileData = new ProjectileData(this)
            {
                SpriteName          = "WizardFireballProjectile_Sprite",
                SourceAnchor        = m_spellOffset,
                Target              = m_target,
                Speed               = new Vector2(ProjectileSpeed, ProjectileSpeed),
                IsWeighted          = false,
                RotationSpeed       = 0f,
                Damage              = Damage,
                AngleOffset         = 0f,
                CollidesWithTerrain = false,
                Scale               = ProjectileScale
            };

            if (Difficulty == GameTypes.EnemyDifficulty.ADVANCED)
            {
                projectileData.AngleOffset = CDGMath.RandomInt(-25, 25);
            }
            if (Difficulty == GameTypes.EnemyDifficulty.EXPERT)
            {
                projectileData.SpriteName          = "GhostBossProjectile_Sprite";
                projectileData.CollidesWithTerrain = false;
            }
            SoundManager.Play3DSound(this, m_target, "FireWizard_Attack_01", "FireWizard_Attack_02",
                                     "FireWizard_Attack_03", "FireWizard_Attack_04");
            var projectileObj = m_levelScreen.ProjectileManager.FireProjectile(projectileData);

            projectileObj.Rotation = 0f;
            if (Difficulty != GameTypes.EnemyDifficulty.EXPERT)
            {
                Tween.RunFunction(0.15f, this, "ChangeFireballState", projectileObj);
            }
        }
Beispiel #6
0
 public override void OnEnter()
 {
     m_smoke1.Position = new Vector2(CDGMath.RandomInt(300, 1000),
                                     m_text.Y + m_text.Height / 2f - 30f + CDGMath.RandomInt(-100, 100));
     m_smoke2.Position = new Vector2(CDGMath.RandomInt(200, 700),
                                     m_text.Y + m_text.Height / 2f - 30f + CDGMath.RandomInt(-50, 50));
     m_smoke3.Position = new Vector2(CDGMath.RandomInt(300, 800),
                                     m_text.Y + m_text.Height / 2f - 30f + CDGMath.RandomInt(-100, 100));
     m_smoke1.Opacity = (m_smoke2.Opacity = (m_smoke3.Opacity = 0f));
     Tween.To(m_smoke1, m_fadeInSpeed, Tween.EaseNone, "Opacity", "0.3");
     Tween.To(m_smoke2, m_fadeInSpeed, Tween.EaseNone, "Opacity", "0.2");
     Tween.To(m_smoke3, m_fadeInSpeed, Tween.EaseNone, "Opacity", "0.15");
     BackBufferOpacity = 0f;
     m_text.Opacity    = 0f;
     Tween.To(this, m_fadeInSpeed, Tween.EaseNone, "BackBufferOpacity", m_backBufferOpacity.ToString());
     Tween.To(m_text, m_fadeInSpeed, Tween.EaseNone, "Opacity", "1");
     if (m_typewriteText)
     {
         m_text.Visible = false;
         Tween.RunFunction(m_fadeInSpeed, m_text, "BeginTypeWriting", m_text.Text.Length * 0.05f, "");
     }
     else
     {
         m_text.Visible = true;
     }
     base.OnEnter();
 }
Beispiel #7
0
        public void ShatterExpertIceball(int numIceballs)
        {
            SoundManager.Play3DSound(this, m_target, "Ice_Wizard_Attack");
            if (m_iceballSummon.SpriteName == "WizardIceSpell_Sprite")
            {
                m_iceballSummon.PlayAnimation("Grown", "End");
            }
            var projectileData = new ProjectileData(this)
            {
                SpriteName          = "WizardIceProjectile_Sprite",
                SourceAnchor        = m_spellOffset,
                Target              = null,
                Speed               = new Vector2(ProjectileSpeed, ProjectileSpeed),
                IsWeighted          = false,
                RotationSpeed       = 0f,
                Damage              = Damage,
                AngleOffset         = 0f,
                CollidesWithTerrain = false,
                Scale               = ProjectileScale
            };
            var num = 60f;

            for (var i = 0; i < numIceballs; i++)
            {
                float num2 = CDGMath.RandomInt(0, 360);
                projectileData.Angle = new Vector2(num2, num2);
                var projectileObj = m_levelScreen.ProjectileManager.FireProjectile(projectileData);
                Tween.RunFunction(0.15f, this, "ChangeIceballState", projectileObj);
                num2 += num;
            }
            projectileData.Dispose();
        }
Beispiel #8
0
 private void RandomizeItem()
 {
     if (Game.PlayerStats.Class != 16 && Game.PlayerStats.Class != 17)
     {
         var spellList = ClassType.GetSpellList(Game.PlayerStats.Class);
         do
         {
             Spell = spellList[CDGMath.RandomInt(0, spellList.Length - 1)];
         } while ((Game.PlayerStats.Traits.X == 31f || Game.PlayerStats.Traits.Y == 31f) &&
                  (Spell == 6 || Spell == 4 || Spell == 11));
         Array.Clear(spellList, 0, spellList.Length);
         ID = Spell;
     }
     else if (Game.PlayerStats.Class == 16)
     {
         ID    = 13;
         Spell = 13;
     }
     else if (Game.PlayerStats.Class == 17)
     {
         ID    = 14;
         Spell = 14;
     }
     m_icon.ChangeSprite(SpellType.Icon(Spell));
 }
Beispiel #9
0
        public static void Display(Vector2 start, Vector2 end, int numCoins)
        {
            float delay = 0.32f;

            lock (_defaultCommands)
                for (int i = 0; i < numCoins; i++, delay += 0.05f)
                {
                    Instance.Run(start, x =>
                    {
                        int xDrift = CDGMath.RandomInt(-30, 30);
                        int yDrift = CDGMath.RandomInt(-30, 30);

                        var cmd           = _defaultCommands[0];
                        cmd.Properties[1] = xDrift.ToString();
                        cmd.Properties[3] = yDrift.ToString();

                        cmd = _defaultCommands[1];
                        cmd.Properties[1] = delay.ToString();
                        cmd.Properties[3] = end.X.ToString();
                        cmd.Properties[5] = end.Y.ToString();

                        cmd.InitialValues[0] = start.X + xDrift;
                        cmd.InitialValues[1] = start.Y + yDrift;
                    });
                }
        }
Beispiel #10
0
        public static void Display(Vector2 position, bool horizontal, float length)
        {
            int     numEffects = (int)(length / 20);
            float   posScale   = length / numEffects;
            Vector2 posFactor  = (horizontal ? new Vector2(1f, 0f) : new Vector2(0f, -1f)) * posScale;

            lock (_defaultCommands)
                for (int i = 0; i < numEffects; i++)
                {
                    Instance.Run(position * (i + 1), x =>
                    {
                        float randScale = CDGMath.RandomFloat(0.5f, 0.8f);

                        var cmd           = _defaultCommands[1];
                        cmd.Properties[1] = CDGMath.RandomFloat(-30f, 30f).ToString();

                        cmd = _defaultCommands[2];
                        cmd.Properties[1] = CDGMath.RandomInt(-10, 10).ToString();
                        cmd.Properties[3] = CDGMath.RandomInt(-20, 0).ToString();

                        cmd = _defaultCommands[3];
                        cmd.Properties[1] = randScale.ToString();
                        cmd.Properties[3] = randScale.ToString();
                    });
                }
        }
Beispiel #11
0
 public void ActivateTarget()
 {
     if (m_numTargets - m_currentTargetIndex < m_targetIcons.NumChildren)
     {
         m_targetIcons.GetChildAt(m_numTargets - m_currentTargetIndex).Visible = false;
         GiveGold();
     }
     if (m_currentTargetIndex >= m_numTargets)
     {
         m_currentTarget = null;
         return;
     }
     if (m_currentTarget != null)
     {
         m_targetSpeed += m_targetSpeedMod;
     }
     m_currentTarget         = m_targetList[m_currentTargetIndex];
     m_currentTarget.Visible = true;
     if (!IsReversed)
     {
         Tween.By(m_currentTarget, 2f, Quad.EaseOut, "X", (-400 + CDGMath.RandomInt(-200, 200)).ToString());
         return;
     }
     Tween.By(m_currentTarget, 2f, Quad.EaseOut, "X", (400 + CDGMath.RandomInt(-200, 200)).ToString());
 }
Beispiel #12
0
 public static void FadeOutOffset(ProjectileObj proj, bool hitPlayer)
 {
     Tween.StopAllContaining(proj, false);
     proj.IsCollidable = false;
     Tween.By(proj, 0.3f, Linear.EaseNone, "X", CDGMath.RandomInt(-50, 50).ToString(), "Y", CDGMath.RandomInt(-100, 100).ToString());
     Tween.To(proj, 0.3f, Linear.EaseNone, "Opacity", "0");
     Tween.AddEndHandlerToLastTween(proj, "KillProjectile");
 }
Beispiel #13
0
 public void AnimateJukebox()
 {
     Tween.To(m_jukeBox, 0.2f, Tween.EaseNone, "ScaleY", "2.9", "ScaleX", "3.1", "Rotation", "0");
     Tween.AddEndHandlerToLastTween(this, "AnimateJukebox2");
     Player.AttachedLevel.ImpactEffectPool.DisplayMusicNote(
         new Vector2(m_jukeBox.Bounds.Center.X + CDGMath.RandomInt(-20, 20),
                     m_jukeBox.Bounds.Top + CDGMath.RandomInt(0, 20)));
 }
Beispiel #14
0
 public static void Display(Vector2 position)
 {
     lock (_defaultTweens)
         Instance.Run(position, x =>
         {
             x.TweenCommands[1].Properties[1] = CDGMath.RandomInt(-45, 45).ToString();
         });
 }
Beispiel #15
0
 new public static void Display(Vector2 position, int numEffects = 10)
 {
     lock (_defaultTweens)
         for (int i = 0; i < numEffects; i++)
         {
             Instance.Run(new Vector2(position.X + CDGMath.RandomInt(-30, 30), position.Y + CDGMath.RandomInt(-30, 30)), Initialize);
         }
 }
Beispiel #16
0
        public void ItemSpinAnimation3()
        {
            var scale = m_itemSprite.Scale;

            m_itemSprite.Scale = Vector2.One;
            var num = 130f / m_itemSprite.Height;

            m_itemSprite.Scale = scale;
            Tween.To(m_itemSprite, 0.2f, Tween.EaseNone, "ScaleX", num.ToString(), "ScaleY", num.ToString());
            Tween.To(m_itemSprite, 0.2f, Tween.EaseNone, "X", 660.ToString(), "Y", 390.ToString());
            Tween.To(m_itemFoundText, 0.3f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            Tween.To(m_continueText, 0.3f, Linear.EaseNone, "Opacity", "1");
            scale             = m_tripStat1.Scale;
            m_tripStat1.Scale = Vector2.One;
            num = 130f / m_tripStat1.Height;
            m_tripStat1.Scale = scale;
            Tween.To(m_tripStat1, 0.2f, Tween.EaseNone, "ScaleX", num.ToString(), "ScaleY", num.ToString());
            Tween.To(m_tripStat1, 0.2f, Tween.EaseNone, "X", 830.ToString(), "Y", 390.ToString());
            scale             = m_tripStat2.Scale;
            m_tripStat2.Scale = Vector2.One;
            num = 130f / m_tripStat2.Height;
            m_tripStat2.Scale = scale;
            Tween.To(m_tripStat2, 0.2f, Tween.EaseNone, "ScaleX", num.ToString(), "ScaleY", num.ToString());
            Tween.To(m_tripStat2, 0.2f, Tween.EaseNone, "X", 490.ToString(), "Y", 390.ToString());
            Tween.To(m_tripStat1FoundText, 0.3f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            Tween.To(m_tripStat2FoundText, 0.3f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            for (var i = 0; i < m_levelUpParticles.Length; i++)
            {
                m_levelUpParticles[i].AnimationDelay = 0f;
                m_levelUpParticles[i].Visible        = true;
                m_levelUpParticles[i].Scale          = new Vector2(0.1f, 0.1f);
                m_levelUpParticles[i].Opacity        = 0f;
                m_levelUpParticles[i].Position       = new Vector2(660f, 360f);
                m_levelUpParticles[i].Position      += new Vector2(CDGMath.RandomInt(-100, 100), CDGMath.RandomInt(-50, 50));
                var duration = CDGMath.RandomFloat(0f, 0.5f);
                Tween.To(m_levelUpParticles[i], 0.2f, Linear.EaseNone, "delay", duration.ToString(), "Opacity", "1");
                Tween.To(m_levelUpParticles[i], 0.5f, Linear.EaseNone, "delay", duration.ToString(), "ScaleX", "2",
                         "ScaleY", "2");
                Tween.To(m_levelUpParticles[i], duration, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(m_levelUpParticles[i], "PlayAnimation", false);
            }
            m_itemFoundSprite.Position = new Vector2(660f, 190f);
            m_itemFoundSprite.Scale    = Vector2.Zero;
            m_itemFoundSprite.Visible  = true;
            Tween.To(m_itemFoundSprite, 0.5f, Back.EaseOut, "delay", "0.05", "ScaleX", "1", "ScaleY", "1");
            m_levelUpBGImage.Position = m_itemFoundSprite.Position;
            m_levelUpBGImage.Y       += 30f;
            m_levelUpBGImage.Scale    = Vector2.Zero;
            m_levelUpBGImage.Visible  = true;
            Tween.To(m_levelUpBGImage, 0.5f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            Tween.To(this, 0.5f, Linear.EaseNone, "BackBufferOpacity", "0.5");
            if (m_itemSpinning)
            {
                m_itemSprite.Rotation = -25f;
            }
            m_itemSpinning = false;
            Tween.RunFunction(0.5f, this, "UnlockControls");
        }
Beispiel #17
0
        public void SwitchRandomType()
        {
            byte b;

            for (b = m_currentAttackType; b == m_currentAttackType; b = (byte)CDGMath.RandomInt(0, 2))
            {
            }
            SwitchType(b);
        }
Beispiel #18
0
 public static void RandomIntro(TextObj textObj, int wordWrap = 0)
 {
     textObj.Text = intro[CDGMath.RandomInt(0, intro.Length - 1)] +
                    middle[CDGMath.RandomInt(0, middle.Length - 1)] + end[CDGMath.RandomInt(0, end.Length - 1)];
     if (wordWrap > 0)
     {
         textObj.WordWrap(wordWrap);
     }
 }
Beispiel #19
0
 public static void Display(Vector2 position)
 {
     lock (_defaultTweens)
         Instance.Run(position, x =>
         {
             var cmd           = x.TweenCommands[1];
             cmd.Properties[1] = CDGMath.RandomInt(-20, 20).ToString();
             cmd.Properties[3] = CDGMath.RandomInt(-70, -50).ToString();
         });
 }
Beispiel #20
0
 public IntroRoomObj()
 {
     m_rainFG = new List <RaindropObj>();
     for (var i = 0; i < 500; i++)
     {
         var item =
             new RaindropObj(new Vector2(CDGMath.RandomInt(-100, 2640), CDGMath.RandomInt(-400, 720)));
         m_rainFG.Add(item);
     }
 }
Beispiel #21
0
 public static ProjectileObj Fire(GameObj source, bool randomize)
 {
     return(Instance.Fire(source, null, x =>
     {
         if (randomize)
         {
             x.InitAngleOffset = CDGMath.RandomInt(-8, 8);
         }
         x.TextureColor = Color.CadetBlue;
     }));
 }
Beispiel #22
0
        private void TeleportPlayer()
        {
            var levelScreen = Game.ScreenManager.GetLevelScreen();
            var player      = Game.ScreenManager.Player;

            player.UpdateCollisionBoxes();
            if (levelScreen != null)
            {
                var position = default(Vector2);
                var num      = levelScreen.RoomList.Count - 1;
                if (num < 1)
                {
                    num = 1;
                }
                var index   = CDGMath.RandomInt(0, num);
                var roomObj = levelScreen.RoomList[index];
                while (roomObj.Name == "Boss" || roomObj.Name == "Start" || roomObj.Name == "Ending" ||
                       roomObj.Name == "Compass" || roomObj.Name == "ChallengeBoss" || roomObj.Name == "Throne" ||
                       roomObj.Name == "Tutorial" || roomObj.Name == "EntranceBoss" || roomObj.Name == "Bonus" ||
                       roomObj.Name == "Linker" || roomObj.Name == "Secret" || roomObj.Name == "CastleEntrance" ||
                       roomObj.DoorList.Count < 2)
                {
                    index   = CDGMath.RandomInt(0, num);
                    roomObj = levelScreen.RoomList[index];
                }
                foreach (var current in roomObj.DoorList)
                {
                    var flag = false;
                    position.X = current.Bounds.Center.X;
                    string doorPosition;
                    if ((doorPosition = current.DoorPosition) != null)
                    {
                        if (!(doorPosition == "Left") && !(doorPosition == "Right"))
                        {
                            if (doorPosition == "Bottom")
                            {
                                position.Y = current.Bounds.Top - (player.Bounds.Bottom - player.Y);
                                flag       = true;
                            }
                        }
                        else
                        {
                            flag       = true;
                            position.Y = current.Bounds.Bottom - (player.Bounds.Bottom - player.Y);
                        }
                    }
                    if (flag)
                    {
                        break;
                    }
                }
                player.TeleportPlayer(position, m_teleporter);
            }
        }
Beispiel #23
0
        public EnemyObj_Portrait(PlayerObj target, PhysicsManager physicsManager, ProceduralLevelScreen levelToAttachTo,
                                 GameTypes.EnemyDifficulty difficulty)
            : base("EnemyPortrait_Character", target, physicsManager, levelToAttachTo, difficulty)
        {
            Type = 32;
            var spriteName = "FramePicture" + CDGMath.RandomInt(1, 16) + "_Sprite";

            GetChildAt(0).ChangeSprite(spriteName);
            GetChildAt(0);
            DisableCollisionBoxRotations = false;
        }
Beispiel #24
0
        public void GiveGold(ItemDropManager itemDropManager, int amount = 0)
        {
            int num;

            if (ChestType == 1)
            {
                num = CDGMath.RandomInt((int)BronzeChestGoldRange.X, (int)BronzeChestGoldRange.Y) * 10;
            }
            else if (ChestType == 2 || ChestType == 4)
            {
                num = CDGMath.RandomInt((int)SilverChestGoldRange.X, (int)SilverChestGoldRange.Y) * 10;
            }
            else
            {
                num = CDGMath.RandomInt((int)GoldChestGoldRange.X, (int)GoldChestGoldRange.Y) * 10;
            }
            num += (int)Math.Floor(GoldIncreasePerLevel * Level * 10f);
            if (amount != 0)
            {
                num = amount;
            }
            var num2 = num / 500;

            num -= num2 * 500;
            var num3 = num / 100;

            num -= num3 * 100;
            var num4 = num / 10;
            var num5 = 0f;

            for (var i = 0; i < num2; i++)
            {
                Tween.To(this, num5, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem",
                                               new Vector2(Position.X, Position.Y - Height / 2), 11, 500);
                num5 += 0.1f;
            }
            num5 = 0f;
            for (var j = 0; j < num3; j++)
            {
                Tween.To(this, num5, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem",
                                               new Vector2(Position.X, Position.Y - Height / 2), 10, 100);
                num5 += 0.1f;
            }
            num5 = 0f;
            for (var k = 0; k < num4; k++)
            {
                Tween.To(this, num5, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem",
                                               new Vector2(Position.X, Position.Y - Height / 2), 1, 10);
                num5 += 0.1f;
            }
        }
Beispiel #25
0
 public PlayerStats()
 {
     if (!LevelEV.RUN_TUTORIAL && !TutorialComplete && LevelEV.RUN_TESTROOM)
     {
         TutorialComplete = true;
     }
     PlayerName = "Sir Lee";
     SpecialItem = 0;
     Class = 0;
     Spell = 1;
     Age = 30;
     ChildAge = 5;
     LichHealthMod = 1f;
     IsFemale = false;
     TimesCastleBeaten = 0;
     EnemiesKilledList = new List<Vector4>();
     for (var i = 0; i < 34; i++)
     {
         EnemiesKilledList.Add(default(Vector4));
     }
     WizardSpellList = new Vector3(1f, 2f, 8f);
     Traits = new Vector2(0f, 0f);
     Gold = 0;
     CurrentLevel = 0;
     HeadPiece = 1;
     ShoulderPiece = 1;
     ChestPiece = 1;
     LoadStartingRoom = true;
     GetBlueprintArray = new List<byte[]>();
     GetRuneArray = new List<byte[]>();
     GetEquippedArray = new sbyte[5];
     GetEquippedRuneArray = new sbyte[5];
     FamilyTreeArray = new List<FamilyTreeNode>();
     InitializeFirstChild();
     EnemiesKilledInRun = new List<Vector2>();
     CurrentBranches = null;
     for (var j = 0; j < 5; j++)
     {
         GetBlueprintArray.Add(new byte[15]);
         GetRuneArray.Add(new byte[11]);
         GetEquippedArray[j] = -1;
         GetEquippedRuneArray[j] = -1;
     }
     HeadPiece = (byte) CDGMath.RandomInt(1, 5);
     ShoulderPiece = (byte) CDGMath.RandomInt(1, 5);
     ChestPiece = (byte) CDGMath.RandomInt(1, 5);
     CDGMath.RandomInt(0, 14);
     GetBlueprintArray[1][0] = 1;
     GetBlueprintArray[3][0] = 1;
     GetBlueprintArray[0][0] = 1;
     GetRuneArray[1][0] = 1;
     GetRuneArray[0][1] = 1;
 }
Beispiel #26
0
        protected override void InitializeLogic()
        {
            var logicSet = new LogicSet(this);

            logicSet.AddAction(new ChangePropertyLogicAction(this, "Shake", true));
            logicSet.AddAction(new DelayLogicAction(1f));
            logicSet.AddAction(new ChangePropertyLogicAction(this, "Shake", false));
            logicSet.AddAction(new DelayLogicAction(1f));
            var logicSet2 = new LogicSet(this);

            logicSet2.AddAction(new ChaseLogicAction(m_target, Vector2.Zero, Vector2.Zero, true, 1f));
            var logicSet3 = new LogicSet(this);

            logicSet3.AddAction(new ChaseLogicAction(m_target, Vector2.Zero, Vector2.Zero, true, 1.75f));
            ThrowAdvancedProjectiles(logicSet3, true);
            var logicSet4 = new LogicSet(this);

            logicSet4.AddAction(new ChaseLogicAction(m_target, Vector2.Zero, Vector2.Zero, true, 1.75f));
            ThrowExpertProjectiles(logicSet4, true);
            var logicSet5 = new LogicSet(this);

            logicSet5.AddAction(new ChaseLogicAction(m_target, Vector2.Zero, Vector2.Zero, true, 1.25f));
            ThrowProjectiles(logicSet5, true);
            m_generalBasicLB.AddLogicSet(logicSet, logicSet2);
            m_generalAdvancedLB.AddLogicSet(logicSet, logicSet3);
            m_generalExpertLB.AddLogicSet(logicSet, logicSet4);
            m_generalMiniBossLB.AddLogicSet(logicSet, logicSet5);
            m_generalCooldownLB.AddLogicSet(logicSet, logicSet2);
            logicBlocksToDispose.Add(m_generalBasicLB);
            logicBlocksToDispose.Add(m_generalAdvancedLB);
            logicBlocksToDispose.Add(m_generalExpertLB);
            logicBlocksToDispose.Add(m_generalMiniBossLB);
            logicBlocksToDispose.Add(m_generalCooldownLB);
            base.InitializeLogic();
            CollisionBoxes.Clear();
            CollisionBoxes.Add(new CollisionBox((int)(-18f * ScaleX), (int)(-24f * ScaleY), (int)(36f * ScaleX),
                                                (int)(48f * ScaleY), 2, this));
            CollisionBoxes.Add(new CollisionBox((int)(-15f * ScaleX), (int)(-21f * ScaleY), (int)(31f * ScaleX),
                                                (int)(44f * ScaleY), 1, this));
            if (Difficulty == GameTypes.EnemyDifficulty.MINIBOSS)
            {
                (GetChildAt(0) as SpriteObj).ChangeSprite("GiantPortrait_Sprite");
                Scale = new Vector2(2f, 2f);
                AddChild(new SpriteObj("Portrait" + CDGMath.RandomInt(0, 7) + "_Sprite")
                {
                    OverrideParentScale = true
                });
                CollisionBoxes.Clear();
                CollisionBoxes.Add(new CollisionBox(-124, -176, 250, 354, 2, this));
                CollisionBoxes.Add(new CollisionBox(-124, -176, 250, 354, 1, this));
            }
        }
Beispiel #27
0
 public static void Display(Vector2 position, int numEffects = 30)
 {
     lock (_defaultCommands)
         for (int i = 0; i < numEffects; i++)
         {
             Instance.Run(position, x =>
             {
                 var cmd           = _defaultCommands[0];
                 cmd.Properties[1] = CDGMath.RandomInt(-250, 250).ToString();
                 cmd.Properties[3] = CDGMath.RandomInt(500, 800).ToString();
             });
         }
 }
Beispiel #28
0
 public void GivePrint(ItemDropManager manager, PlayerObj player)
 {
     if (Game.PlayerStats.TotalBlueprintsFound >= 75)
     {
         if (ChestType == 3)
         {
             GiveStatDrop(manager, player, 1, 0);
             return;
         }
         GiveGold(manager);
     }
     else
     {
         var getBlueprintArray = Game.PlayerStats.GetBlueprintArray;
         var list = new List <Vector2>();
         var num  = 0;
         foreach (var current in getBlueprintArray)
         {
             var num2  = 0;
             var array = current;
             for (var i = 0; i < array.Length; i++)
             {
                 if (array[i] == 0)
                 {
                     var equipmentData = Game.EquipmentSystem.GetEquipmentData(num, num2);
                     if (Level >= equipmentData.LevelRequirement &&
                         ChestType >= equipmentData.ChestColourRequirement)
                     {
                         list.Add(new Vector2(num, num2));
                     }
                 }
                 num2++;
             }
             num++;
         }
         if (list.Count > 0)
         {
             var vector = list[CDGMath.RandomInt(0, list.Count - 1)];
             Game.PlayerStats.GetBlueprintArray[(int)vector.X][(int)vector.Y] = 1;
             var list2 = new List <object>();
             list2.Add(new Vector2(X, Y - Height / 2f));
             list2.Add(1);
             list2.Add(new Vector2(vector.X, vector.Y));
             (player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(12, true, list2);
             player.RunGetItemAnimation();
             Console.WriteLine(string.Concat("Unlocked item index ", vector.X, " of type ", vector.Y));
             return;
         }
         GiveGold(manager);
     }
 }
Beispiel #29
0
 private void ShowSilhouette(bool showSanta)
 {
     if (m_levelScreen != null)
     {
         m_silhouetteFlying    = true;
         m_silhouette.Rotation = 0f;
         m_silhouette.Flip     = SpriteEffects.None;
         var flag = false;
         if (CDGMath.RandomInt(0, 1) > 0)
         {
             flag = true;
         }
         string[] array =
         {
             "GardenBat_Sprite",
             "GardenCrow_Sprite",
             "GardenBat_Sprite",
             "GardenCrow_Sprite",
             "GardenPerson_Sprite"
         };
         if (!showSanta)
         {
             m_silhouette.ChangeSprite(array[CDGMath.RandomInt(0, 4)]);
         }
         else
         {
             m_silhouette.ChangeSprite("GardenSanta_Sprite");
         }
         m_silhouette.PlayAnimation();
         var arg_A7_0 = Vector2.Zero;
         if (flag)
         {
             m_silhouette.X = -(float)m_silhouette.Width;
         }
         else
         {
             m_silhouette.Flip = SpriteEffects.FlipHorizontally;
             m_silhouette.X    = m_levelScreen.CurrentRoom.Width + m_silhouette.Width;
         }
         m_silhouette.Y = CDGMath.RandomFloat(100f, 500f);
         var num = m_levelScreen.CurrentRoom.Bounds.Width + m_silhouette.Width * 2;
         if (!flag)
         {
             num = -num;
         }
         Tween.By(m_silhouette, CDGMath.RandomFloat(10f, 15f), Tween.EaseNone, "X", num.ToString(), "Y",
                  CDGMath.RandomInt(-200, 200).ToString());
         Tween.AddEndHandlerToLastTween(this, "SilhouetteComplete");
     }
 }
Beispiel #30
0
 public static void Display(Vector2 position)
 {
     lock (_defaultCommands)
         for (int i = 0; i < 4; i++)
         {
             Instance.Run(new Vector2(position.X + CDGMath.RandomInt(-20, 20), position.Y + CDGMath.RandomInt(-20, 20)), x =>
             {
                 var cmd           = _defaultCommands[1];
                 cmd.Properties[1] = CDGMath.RandomInt(-50, 50).ToString();
                 cmd.Properties[3] = CDGMath.RandomInt(-50, 50).ToString();
                 cmd.Properties[5] = CDGMath.RandomInt(-180, 180).ToString();
             });
         }
 }