public Esquimo(Vector2 scroll, String[] flags)
            : base(scroll)
        {
            //Source sprite
            this.sRect = new Rectangle(0, 0, 245, 591);
            this.Scale = Vector2.One;

            this.eyesSrcRect = new Rectangle(0, 600, 245, 460);
            this.eyesDstRect = ComputeDstRect(this.eyesSrcRect);

            this.ttl = InfiniteTimeToLive;

            //Stats
            this.wpn = null;

            this.hp = 2401;
            this.maxLifebarValue = hp;
            this.chocolateShieldHp = 300;
            this.initChocolateShieldHp = this.chocolateShieldHp;
            this.regenCooldown = regenTimeConst;
            this.concentrateCooldown = 0f;

            this.points = 182000;

            this.attackType = EsquimoAttacks.None;
            this.attackCooldown = 5000f;
            this.faceState = EsquimoFaceState.Normal;

            this.flagsOnDeath = flags;
            this.Flip = SpriteEffects.FlipHorizontally;
            this.InfiniteMovePattern = true;
            this.hitbox = new EmptyHitbox(this);

            this.speed = new Vector2(-50, 200);
            this.movePattern = new MovePattern();
            this.movePattern.AddPoint(new Point(TGPAContext.Instance.ScreenWidth / 2, TGPAContext.Instance.ScreenHeight / 2));

            this.DrawLifebar = true;
            this.DrawWarning = true;
        }
Exemple #2
0
        public Esquimo(Vector2 scroll, String[] flags)
            : base(scroll)
        {
            //Source sprite
            this.sRect = new Rectangle(0, 0, 245, 591);
            this.Scale = Vector2.One;

            this.eyesSrcRect = new Rectangle(0, 600, 245, 460);
            this.eyesDstRect = ComputeDstRect(this.eyesSrcRect);

            this.ttl = InfiniteTimeToLive;

            //Stats
            this.wpn = null;

            this.hp = 2401;
            this.maxLifebarValue       = hp;
            this.chocolateShieldHp     = 300;
            this.initChocolateShieldHp = this.chocolateShieldHp;
            this.regenCooldown         = regenTimeConst;
            this.concentrateCooldown   = 0f;

            this.points = 182000;

            this.attackType     = EsquimoAttacks.None;
            this.attackCooldown = 5000f;
            this.faceState      = EsquimoFaceState.Normal;

            this.flagsOnDeath        = flags;
            this.Flip                = SpriteEffects.FlipHorizontally;
            this.InfiniteMovePattern = true;
            this.hitbox              = new EmptyHitbox(this);

            this.speed       = new Vector2(-50, 200);
            this.movePattern = new MovePattern();
            this.movePattern.AddPoint(new Point(TGPAContext.Instance.ScreenWidth / 2, TGPAContext.Instance.ScreenHeight / 2));

            this.DrawLifebar = true;
            this.DrawWarning = true;
        }
Exemple #3
0
        public override void Update(GameTime gameTime)
        {
            bool attack = true;

            //Special attacks updates
            if (this.attackType == EsquimoAttacks.Regen)
            {
                if (this.chocolateShieldHp < initChocolateShieldHp)
                {
                    attack = false;
                    this.chocolateShieldHp++;

                    //Chocolate particules going on the boss
                    Vector2 particuleLocation   = RandomMachine.GetRandomVector2(0, TGPAContext.Instance.ScreenWidth, 0, TGPAContext.Instance.ScreenHeight);
                    Vector2 middle              = Vectors.ConvertPointToVector2(this.dRect.Center);
                    Vector2 particuleTrajectory = RandomMachine.GetRandomVector2(middle.X - dRect.Width / 3, middle.X + dRect.Width / 3, middle.Y - dRect.Height / 3, middle.Y + dRect.Height / 3) - particuleLocation;

                    ChocolatePiece choc = new ChocolatePiece(particuleLocation,
                                                             particuleTrajectory,
                                                             RandomMachine.GetRandomFloat(0.5f, 0.9f),
                                                             RandomMachine.GetRandomInt(0, 4));
                    TGPAContext.Instance.ParticleManager.AddParticle(choc, false);
                }
                else
                {
                    this.attackCooldown = 0f;
                    this.regenCooldown  = regenTimeConst;
                    attack = true;
                }
            }
            else if (this.attackType == EsquimoAttacks.Concentrate)
            {
                this.location.X += shake;
                shake            = -shake;

                if (concentrateCooldown <= 0f)
                {
                    if (this.wpn == null)
                    {
                        this.wpn = new EsquimoConcentrateGun();
                    }
                }
            }

            //Decrease cooldowns
            if (this.faceCooldown > 0f)
            {
                this.faceCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (this.attackCooldown > 0f)
            {
                this.attackCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
                attack = false;
            }

            if (this.concentrateCooldown > 0f)
            {
                this.concentrateCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (this.regenCooldown > 0f)
            {
                //Do not decrease cooldown if hp > 1/3
                if (this.chocolateShieldHp < (this.initChocolateShieldHp / 3))
                {
                    this.regenCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
                }
            }
            else if (this.attackType != EsquimoAttacks.Regen)
            {
                attack = true; //Short circuit attack system to heal
            }

            //Change state is necessary
            if ((this.faceCooldown < 0f) && (this.faceState != EsquimoFaceState.Normal))
            {
                this.faceState = EsquimoFaceState.Normal;
            }

            //Boss is hit : change face
            if (IsHit)
            {
                this.faceState    = EsquimoFaceState.Hit;
                this.faceCooldown = 2000f;

                if (this.chocolateShieldHp > 0)
                {
                    Vector2 particuleLocation = Vectors.ConvertPointToVector2(this.dRect.Center);

                    particuleLocation.X += RandomMachine.GetRandomInt(-this.dRect.Width / 4, this.dRect.Width / 4);

                    ChocolatePiece choc = new ChocolatePiece(particuleLocation,
                                                             RandomMachine.GetRandomVector2(-50, 50, 10, 200),
                                                             RandomMachine.GetRandomFloat(0.1f, 0.7f),
                                                             RandomMachine.GetRandomInt(0, 4));
                    TGPAContext.Instance.ParticleManager.AddParticle(choc, false);
                }
            }

            //Find a new attack
            if (attack)
            {
                //Initialisation for combat
                if (this.attackType == EsquimoAttacks.None)
                {
                    this.hitbox      = new SquareHitbox(this, new Vector2(0.6f, 0.1f));
                    this.movePattern = new MovePattern();
                    this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Right - this.dRect.Width, TGPAContext.Instance.ScreenHeight / 2));
                }

                this.faceState    = EsquimoFaceState.Attack;
                this.faceCooldown = 2000f;
                this.speed        = new Vector2(-100f, 200f);

                //Special attack : Regeneration
                //****************************************************
                if ((this.regenCooldown <= 0f) && (this.attackType != EsquimoAttacks.Regen))
                {
                    this.wpn            = null;
                    this.speed          = new Vector2(-200f, 200f);
                    this.attackCooldown = 12000f;
                    this.attackType     = EsquimoAttacks.Regen;

                    this.movePattern = new MovePattern();

                    for (int i = 0; i < 15; i++)
                    {
                        this.movePattern.AddPoint(new Point(RandomMachine.GetRandomInt(TGPAContext.Instance.ScreenWidth / 3, TGPAContext.Instance.TitleSafeArea.Right),
                                                            RandomMachine.GetRandomInt(TGPAContext.Instance.TitleSafeArea.Top, TGPAContext.Instance.TitleSafeArea.Bottom)));
                    }
                }
                else
                {
                    int rand = RandomMachine.GetRandomInt(0, 6);

                    //Wave Attack
                    //****************************************************
                    if ((rand < 4) && (this.attackType != EsquimoAttacks.Wave))
                    {
                        this.attackType = EsquimoAttacks.Wave;

                        this.attackCooldown = 7500f;
                        this.speed          = new Vector2(-50, RandomMachine.GetRandomInt(75, 200));

                        this.movePattern = new MovePattern();

                        for (int i = 0; i < 10; i++)
                        {
                            this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Right - (this.dRect.Width / 2), RandomMachine.GetRandomInt(25, TGPAContext.Instance.TitleSafeArea.Bottom - 25)));
                        }

                        this.wpn = new EsquimoWaveGun();
                    }
                    //Sticks rain Attack
                    //****************************************************
                    else if ((rand == 4) && (this.attackType != EsquimoAttacks.StickRain))
                    {
                        this.attackType = EsquimoAttacks.StickRain;

                        this.attackCooldown = 10000f;
                        this.speed          = new Vector2(-50, 75f);

                        this.movePattern = new MovePattern();

                        for (int i = 0; i < 3; i++)
                        {
                            this.movePattern.AddPoint(new Point(
                                                          RandomMachine.GetRandomInt(TGPAContext.Instance.ScreenWidth / 2, 2 * TGPAContext.Instance.ScreenWidth / 3),
                                                          TGPAContext.Instance.TitleSafeArea.Bottom / 2));
                        }

                        this.wpn = new EsquimoStickGun();
                    }
                    //Random nuts after concentration Attack
                    //****************************************************
                    else if ((rand == 5) && (this.attackType != EsquimoAttacks.Concentrate))
                    {
                        this.attackType = EsquimoAttacks.Concentrate;

                        this.faceCooldown = 6000f;
                        this.faceState    = EsquimoFaceState.Concentrate;

                        this.attackCooldown = 6000f;
                        this.speed          = new Vector2(-50, 25f);

                        this.movePattern = new MovePattern();
                        for (int i = 0; i < 3; i++)
                        {
                            this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Right - (this.dRect.Width / 2), RandomMachine.GetRandomInt(25, TGPAContext.Instance.TitleSafeArea.Bottom - 25)));
                        }

                        this.wpn = null;
                        this.concentrateCooldown = 2500f;
                    }
                }
            }

            //Sprite updates
            //************************************************
            //Facial animation
            switch (this.faceState)
            {
            case EsquimoFaceState.Normal:
                eyesSrcRect.X = 0;
                break;

            case EsquimoFaceState.Attack:
                eyesSrcRect.X = 0;
                break;

            case EsquimoFaceState.Hit:
                eyesSrcRect.X = 245;
                break;

            case EsquimoFaceState.Concentrate:
                eyesSrcRect.X = 490;
                break;
            }

            //Chocolate shield state
            if (chocolateShieldHp > (3 * initChocolateShieldHp) / 4)
            {
                this.sRect.X = 0;
            }
            else if (chocolateShieldHp > (initChocolateShieldHp / 2))
            {
                this.sRect.X = 245;
            }
            else if (chocolateShieldHp > (initChocolateShieldHp / 4))
            {
                this.sRect.X = 490;
            }
            else if (chocolateShieldHp > 0)
            {
                this.sRect.X = 735;
            }
            else
            {
                this.sRect.X = 980;
            }

            base.Update(gameTime);
            eyesDstRect = ComputeDstRect(eyesSrcRect);
        }
        public override void Update(GameTime gameTime)
        {
            bool attack = true;

            //Special attacks updates
            if (this.attackType == EsquimoAttacks.Regen)
            {
                if (this.chocolateShieldHp < initChocolateShieldHp)
                {
                    attack = false;
                    this.chocolateShieldHp++;

                    //Chocolate particules going on the boss
                    Vector2 particuleLocation = RandomMachine.GetRandomVector2(0, TGPAContext.Instance.ScreenWidth, 0, TGPAContext.Instance.ScreenHeight);
                    Vector2 middle = Vectors.ConvertPointToVector2(this.dRect.Center);
                    Vector2 particuleTrajectory = RandomMachine.GetRandomVector2(middle.X - dRect.Width / 3, middle.X + dRect.Width / 3, middle.Y - dRect.Height / 3, middle.Y + dRect.Height / 3) - particuleLocation;

                    ChocolatePiece choc = new ChocolatePiece(particuleLocation,
                        particuleTrajectory,
                        RandomMachine.GetRandomFloat(0.5f, 0.9f),
                        RandomMachine.GetRandomInt(0, 4));
                    TGPAContext.Instance.ParticleManager.AddParticle(choc, false);
                }
                else
                {
                    this.attackCooldown = 0f;
                    this.regenCooldown = regenTimeConst;
                    attack = true;
                }
            }
            else if (this.attackType == EsquimoAttacks.Concentrate)
            {
                this.location.X += shake;
                shake = -shake;

                if (concentrateCooldown <= 0f)
                {
                    if (this.wpn == null)
                        this.wpn = new EsquimoConcentrateGun();
                }
            }

            //Decrease cooldowns
            if (this.faceCooldown > 0f)
            {
                this.faceCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (this.attackCooldown > 0f)
            {
                this.attackCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
                attack = false;
            }

            if (this.concentrateCooldown > 0f)
            {
                this.concentrateCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (this.regenCooldown > 0f)
            {
                //Do not decrease cooldown if hp > 1/3
                if (this.chocolateShieldHp < (this.initChocolateShieldHp / 3))
                {
                    this.regenCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds;
                }
            }
            else if (this.attackType != EsquimoAttacks.Regen)
            {
                attack = true; //Short circuit attack system to heal
            }

            //Change state is necessary
            if ((this.faceCooldown < 0f) && (this.faceState != EsquimoFaceState.Normal))
            {
                this.faceState = EsquimoFaceState.Normal;
            }

            //Boss is hit : change face
            if (IsHit)
            {
                this.faceState = EsquimoFaceState.Hit;
                this.faceCooldown = 2000f;

                if (this.chocolateShieldHp > 0)
                {
                    Vector2 particuleLocation = Vectors.ConvertPointToVector2(this.dRect.Center);

                    particuleLocation.X += RandomMachine.GetRandomInt(-this.dRect.Width / 4, this.dRect.Width / 4);

                    ChocolatePiece choc = new ChocolatePiece(particuleLocation,
                        RandomMachine.GetRandomVector2(-50, 50, 10, 200),
                        RandomMachine.GetRandomFloat(0.1f, 0.7f),
                        RandomMachine.GetRandomInt(0, 4));
                    TGPAContext.Instance.ParticleManager.AddParticle(choc, false);
                }
            }

            //Find a new attack
            if (attack)
            {
                //Initialisation for combat
                if (this.attackType == EsquimoAttacks.None)
                {
                    this.hitbox = new SquareHitbox(this, new Vector2(0.6f, 0.1f));
                    this.movePattern = new MovePattern();
                    this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Right - this.dRect.Width, TGPAContext.Instance.ScreenHeight / 2));
                }

                this.faceState = EsquimoFaceState.Attack;
                this.faceCooldown = 2000f;
                this.speed = new Vector2(-100f, 200f);

                //Special attack : Regeneration
                //****************************************************
                if ((this.regenCooldown <= 0f) && (this.attackType != EsquimoAttacks.Regen))
                {
                    this.wpn = null;
                    this.speed = new Vector2(-200f, 200f);
                    this.attackCooldown = 12000f;
                    this.attackType = EsquimoAttacks.Regen;

                    this.movePattern = new MovePattern();

                    for (int i = 0; i < 15; i++)
                    {
                        this.movePattern.AddPoint(new Point(RandomMachine.GetRandomInt(TGPAContext.Instance.ScreenWidth / 3, TGPAContext.Instance.TitleSafeArea.Right),
                            RandomMachine.GetRandomInt(TGPAContext.Instance.TitleSafeArea.Top, TGPAContext.Instance.TitleSafeArea.Bottom)));
                    }
                }
                else
                {
                    int rand = RandomMachine.GetRandomInt(0, 6);

                    //Wave Attack
                    //****************************************************
                    if ((rand < 4) && (this.attackType != EsquimoAttacks.Wave))
                    {
                        this.attackType = EsquimoAttacks.Wave;

                        this.attackCooldown = 7500f;
                        this.speed = new Vector2(-50, RandomMachine.GetRandomInt(75, 200));

                        this.movePattern = new MovePattern();

                        for (int i = 0; i < 10; i++)
                        {
                            this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Right - (this.dRect.Width / 2), RandomMachine.GetRandomInt(25, TGPAContext.Instance.TitleSafeArea.Bottom - 25)));
                        }

                        this.wpn = new EsquimoWaveGun();
                    }
                    //Sticks rain Attack
                    //****************************************************
                    else if ((rand == 4) && (this.attackType != EsquimoAttacks.StickRain))
                    {
                        this.attackType = EsquimoAttacks.StickRain;

                        this.attackCooldown = 10000f;
                        this.speed = new Vector2(-50, 75f);

                        this.movePattern = new MovePattern();

                        for (int i = 0; i < 3; i++)
                        {
                            this.movePattern.AddPoint(new Point(
                                            RandomMachine.GetRandomInt(TGPAContext.Instance.ScreenWidth / 2, 2 * TGPAContext.Instance.ScreenWidth / 3),
                                            TGPAContext.Instance.TitleSafeArea.Bottom / 2));
                        }

                        this.wpn = new EsquimoStickGun();
                    }
                    //Random nuts after concentration Attack
                    //****************************************************
                    else if ((rand == 5) && (this.attackType != EsquimoAttacks.Concentrate))
                    {
                        this.attackType = EsquimoAttacks.Concentrate;

                        this.faceCooldown = 6000f;
                        this.faceState = EsquimoFaceState.Concentrate;

                        this.attackCooldown = 6000f;
                        this.speed = new Vector2(-50, 25f);

                        this.movePattern = new MovePattern();
                        for (int i = 0; i < 3; i++)
                        {
                            this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Right - (this.dRect.Width / 2), RandomMachine.GetRandomInt(25, TGPAContext.Instance.TitleSafeArea.Bottom - 25)));
                        }

                        this.wpn = null;
                        this.concentrateCooldown = 2500f;
                    }
                }
            }

            //Sprite updates
            //************************************************
            //Facial animation
            switch (this.faceState)
            {
                case EsquimoFaceState.Normal:
                    eyesSrcRect.X = 0;
                    break;

                case EsquimoFaceState.Attack:
                    eyesSrcRect.X = 0;
                    break;

                case EsquimoFaceState.Hit:
                    eyesSrcRect.X = 245;
                    break;

                case EsquimoFaceState.Concentrate:
                    eyesSrcRect.X = 490;
                    break;
            }

            //Chocolate shield state
            if (chocolateShieldHp > (3 * initChocolateShieldHp) / 4)
            {
                this.sRect.X = 0;
            }
            else if (chocolateShieldHp > (initChocolateShieldHp / 2))
            {
                this.sRect.X = 245;
            }
            else if (chocolateShieldHp > (initChocolateShieldHp / 4))
            {
                this.sRect.X = 490;
            }
            else if (chocolateShieldHp > 0)
            {
                this.sRect.X = 735;
            }
            else
            {
                this.sRect.X = 980;
            }

            base.Update(gameTime);
            eyesDstRect = ComputeDstRect(eyesSrcRect);
        }