예제 #1
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        //  with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            int items = 0;

            // Draw the items.
            for (int index = 0; index < this.Actions.Count; index++, items++)
            {
                this.Actions[index].Draw(game.SpriteManager);

                // If the item is selected, draws the subitems.
                if (this.Actions[index].Selected)
                {
                    // Draws all the subitems.
                    for (int subindex = 0; subindex < this.Actions[index].Commands.Count; subindex++, items++)
                    {
                        this.Actions[index].Commands[subindex].Draw(game.SpriteManager);
                    }
                }
            }

            // Draws the background of menu.
            game.SpriteManager.Draw(TextureManager.Instance.Sprites.Menu.Background, new Vector2(this.Position.X, 292), new Rectangle(0, 292, TextureManager.Instance.Sprites.Menu.ItemPlayerOne.Width, items * TextureManager.Instance.Sprites.Menu.ItemPlayerOne.Height + ((int)this.Position.Y) - 292), Color.White, 40);

            // Draw the mover.
            this.Mover.Draw(game.SpriteManager, game.AreaManager, gameTime);

            // Draw the aim.
            this.Aim.Draw(game.SpriteManager, game.AreaManager, gameTime);

            base.Draw(gameTime);
        }
예제 #2
0
        /// <summary>
        /// Steal the target's MP.
        /// (((T.INT / C.INT) * 5% T.MP) + 5% T.MP)
        /// </summary>
        /// <param name="command">Skill casted.</param>
        /// <param name="caster">The caster of the skill.</param>
        /// <param name="target">The target of the skill.</param>
        /// <param name="position">The position of the target.</param>
        private void Drain(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Show the animation.
            Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);

            AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Drain, animationPosition);

            // Effects on target.
            if (target != null)
            {
                // Calculate the damage.
                double damage = (((target.Attributes.Inteligence / caster.Attributes.Inteligence) * (0.05f * target.Attributes.MaximumMana)) + (0.05f * target.Attributes.MaximumMana));
                damage += this.Random.NextDouble() * 0.1f * damage;
                damage  = damage < 1 ? 1 : damage;

                target.Mana -= (int)damage;

                // Show the damage.
                game.DamageManager.Queue(new Damage((int)damage, "MP", target.Position, Damage.DamageType.Harmful));

                caster.Mana += (int)damage;

                // Show the gain.
                game.DamageManager.Queue(new Damage((int)damage, "MP", caster.Position, Damage.DamageType.Benefit));
            }

            // Effects on caster.
            caster.Mana -= command.Attribute;
            caster.Time  = 0;
        }
예제 #3
0
        /// <summary>
        /// Fire property skill.
        /// ((LVL + INT) / 6) * 60) - (2 * MDEF)
        /// </summary>
        /// <param name="command">Skill casted.</param>
        /// <param name="caster">The caster of the skill.</param>
        /// <param name="target">The target of the skill.</param>
        /// <param name="position">The position of the target.</param>
        private void Flame(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Show the animation.
            Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);

            AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Flame, animationPosition);

            // Effects on caster.
            caster.Mana -= command.Attribute;
            caster.Time  = 0;

            // Show the mp cost.
            if (caster != target)
            {
                game.DamageManager.Queue(new Damage(command.Attribute, "MP", caster.Position, Damage.DamageType.Harmful));
            }

            // Effects on target.
            if (target != null)
            {
                // Calculate the damage.
                double damage = ((caster.Attributes.Level + caster.Attributes.Inteligence) / 6) * 50 - (2 * target.Attributes.MagicDefense);
                damage += this.Random.NextDouble() * 0.1f * damage;
                damage  = damage < 1 ? 1 : damage;

                target.Life -= (int)damage;

                // Show the damage.
                game.DamageManager.Queue(new Damage((int)damage, null, target.Position, Damage.DamageType.Harmful));
            }
        }
예제 #4
0
        /// <summary>
        /// Reduces 50% of the target life at the cost of the 50% of the caster life.
        /// </summary>
        /// <param name="command">Skill casted.</param>
        /// <param name="caster">The caster of the skill.</param>
        /// <param name="target">The target of the skill.</param>
        /// <param name="position">The position of the target.</param>
        private void Unseal(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Show the animation.
            Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);

            AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Unseal, animationPosition);

            // Effects on caster.
            caster.Life /= 2;
            caster.Time  = 0;

            // Show the hp cost.
            if (caster != target)
            {
                game.DamageManager.Queue(new Damage(caster.Life, null, caster.Position, Damage.DamageType.Harmful));
            }

            // Effects on target.
            if (target != null)
            {
                target.Life /= 2;

                // Show the damage.
                game.DamageManager.Queue(new Damage(target.Life, null, target.Position, Damage.DamageType.Benefit));
            }
        }
예제 #5
0
        /// <summary>
        /// Configure the game, creating all players and its units.
        /// </summary>
        private void ConfigGame()
        {
            IRTGame game = this.Game as IRTGame;

            game.PlayerOne = this.ConfigPlayer(this.PlayerOneConfigurationManager);
            game.PlayerTwo = this.ConfigPlayer(this.PlayerTwoConfigurationManager);
        }
예제 #6
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run. This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // Configuration managers
            this.Components.Add(this.PlayerOneConfigurationManager);
            this.Components.Add(this.PlayerTwoConfigurationManager);

            // Player one configuration items.
            this.Components.Add(this.PlayerOneConfigurationManager.Keyboard);
            this.Components.Add(this.PlayerOneConfigurationManager.PlayerConfig);

            for (int index = 0; index < this.PlayerOneConfigurationManager.UnitsConfig.Count; index++)
            {
                this.Components.Add(this.PlayerOneConfigurationManager.UnitsConfig[index]);
            }

            // Player two configuration items.
            this.Components.Add(this.PlayerTwoConfigurationManager.Keyboard);
            this.Components.Add(this.PlayerTwoConfigurationManager.PlayerConfig);

            for (int index = 0; index < this.PlayerTwoConfigurationManager.UnitsConfig.Count; index++)
            {
                this.Components.Add(this.PlayerTwoConfigurationManager.UnitsConfig[index]);
            }

            // Shows the map.
            IRTGame game = this.Game as IRTGame;

            game.MapManager.Visible = true;

            base.Initialize();
        }
예제 #7
0
        /// <summary>
        /// Increases the Vitality of the caster for 60 seconds.
        /// </summary>
        /// <param name="command">Skill casted.</param>
        /// <param name="caster">The caster of the skill.</param>
        /// <param name="target">The target of the skill.</param>
        /// <param name="position">The position of the target.</param>
        private void Might(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Show the animation.
            Vector2 animationPosition = new Vector2(caster.Position.X + caster.Texture.Width / 2, caster.Position.Y + caster.Texture.Height / 8);

            AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Might, animationPosition);

            // Effects on caster.
            caster.Mana -= command.Attribute;
            caster.Time  = 0;

            // Show the bonus.
            game.DamageManager.Queue(new Damage("VIT++", caster.Position, Damage.DamageType.Benefit));

            ThreadPool.QueueUserWorkItem(delegate(object data)
            {
                Unit unit = data as Unit;

                float oldVitality = unit.Attributes.Vitality;

                unit.Attributes.Vitality *= 2.0f;

                Thread.Sleep(60000);

                unit.Attributes.Vitality = oldVitality;
            }, target);
        }
예제 #8
0
        /// <summary>
        /// Cast the Heal magic.
        /// </summary>
        /// <param name="caster">The unit that cast the magic.</param>
        /// <param name="target">The unit targeted by the magic.</param>
        public void Heal(Unit caster, Unit target)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Effects on caster.
            caster.Mana -= MagicManager.HealCost;
            caster.Time  = 0;

            // Show the mp cost.
            if (caster != target)
            {
                game.DamageManager.Queue(new Damage(MagicManager.HealCost, "MP", caster.Position, Damage.DamageType.Harmful, 0.1f, 10f));
            }

            // Effects on target.
            if (target != null)
            {
                // Heal the target
                double heal = MagicManager.HealBase * 2.95 * caster.Attributes.CalculateMagicAttackFactor() * 0.1;
                target.Life += (int)heal;

                // Show the hp gain.
                game.DamageManager.Queue(new Damage((int)heal, null, target.Position, Damage.DamageType.Benefit, 0.1f, 10f));
            }
        }
예제 #9
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        //  with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            // Draws the background of menu.
            game.SpriteManager.Draw(TextureManager.Instance.Sprites.Menu.Background, new Vector2(this.Position.X, 0), new Rectangle(0, 0, this.PlayerTexture.Width, this.PlayerTexture.Height + ((int)this.Position.Y) - 0), Color.White, 40);

            // Draws the player status background.
            game.SpriteManager.Draw(this.PlayerTexture, this.Position, Color.White, 50);

            // Get the unit information text.
            string unitInformation = String.Format("0{0}/0{1}", this.Player.Units.FindAll(delegate(Unit unit) { return(unit.Life > 0); }).Count, this.Player.Units.Count);

            // Measure the texts size.
            Vector2 nameSize = this.NameSpriteFont.MeasureString(this.Player.Name);
            Vector2 unitSize = this.UnitSpriteFont.MeasureString(unitInformation);

            // Calculate the position of the texts.
            Vector2 namePosition = new Vector2(this.Position.X + this.PlayerTexture.Width - nameSize.X - 10, this.Position.Y + 25);
            Vector2 unitPosition = new Vector2(this.Position.X + this.PlayerTexture.Width - unitSize.X - 10, this.Position.Y + 85);

            // Draws the name of the player.
            game.SpriteManager.DrawString(this.NameSpriteFont, this.Player.Name, namePosition, Color.White, 51);

            // Draws the unit information.
            game.SpriteManager.DrawString(this.UnitSpriteFont, unitInformation, unitPosition, Color.White, 51);

            base.Draw(gameTime);
        }
예제 #10
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        //  with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            // Draws all child drawable components of the screen.
            foreach (GameComponent component in this.Components)
            {
                // Check if the component is a drawable component.
                if (component is DrawableGameComponent)
                {
                    // Check if the component can be drawed
                    if ((component as DrawableGameComponent).Visible)
                    {
                        (component as DrawableGameComponent).Draw(gameTime);
                    }
                }
            }

            // Instance of the game.
            IRTGame game = this.Game as IRTGame;

            // Flush all the drawable managers to be drawn.
            game.AreaManager.Flush();
            game.SpriteManager.Flush();

            // Draw all the 3d effects.
            game.ParticleManager.Draw();
            game.DamageManager.Draw();

            base.Draw(gameTime);
        }
예제 #11
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            this.Map.Effect.Parameters["World"].SetValue(Matrix.Identity);
            this.Map.Effect.Parameters["View"].SetValue(game.Camera.MapView);
            this.Map.Effect.Parameters["Projection"].SetValue(game.Camera.MapProjection);
            this.Map.Effect.Parameters["MaxHeight"].SetValue(this.Map.MaxHeight);
            this.Map.Effect.Parameters["TerrainHeightmap"].SetValue(TextureManager.Instance.Terrains.Terrain);
            this.Map.Effect.Parameters["SandTexture"].SetValue(TextureManager.Instance.Textures.Sand);
            this.Map.Effect.Parameters["GrassTexture"].SetValue(TextureManager.Instance.Textures.Grass);
            this.Map.Effect.Parameters["RockTexture"].SetValue(TextureManager.Instance.Textures.Rock);
            this.Map.Effect.Parameters["SnowTexture"].SetValue(TextureManager.Instance.Textures.Snow);

            // Start the effect.
            this.Map.Effect.Begin();

            // Draws all passes of the current technique.
            foreach (EffectPass pass in this.Map.Effect.CurrentTechnique.Passes)
            {
                pass.Begin();
                this.Map.Draw(gameTime);
                pass.End();
            }

            // End the effect.
            this.Map.Effect.End();

            base.Draw(gameTime);
        }
예제 #12
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run. This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            IRTGame game = this.Game as IRTGame;

            // Add the players to the game and its menus.
            this.Components.Add(game.PlayerOne);
            this.Components.Add(game.PlayerTwo);

            this.Components.Add(game.PlayerOne.Menu);
            this.Components.Add(game.PlayerTwo.Menu);

            // Add the units of the player one and its menus.
            foreach (Unit unit in game.PlayerOne.Units)
            {
                this.Components.Add(unit);
                this.Components.Add(unit.StatusMenu);
                this.Components.Add(unit.ActionManager);
            }

            // Add the units of the player two and its menus.
            foreach (Unit unit in game.PlayerTwo.Units)
            {
                this.Components.Add(unit);
                this.Components.Add(unit.StatusMenu);
                this.Components.Add(unit.ActionManager);
            }

            game.MapManager.Visible = true;

            base.Initialize();
        }
예제 #13
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        //  with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            game.SpriteManager.Draw(TextureManager.Instance.Sprites.TitleScreen, new Vector2(0, 0), Color.White, 100);

            base.Draw(gameTime);
        }
예제 #14
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        /// with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            game.SpriteManager.Draw(this.Texture, this.Position, Color.White, 20);

            base.Draw(gameTime);
        }
예제 #15
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        //  with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            game.SpriteManager.Draw(this.PlayerOneTexture, new Vector2(0, 0), Color.White, 90);
            game.SpriteManager.Draw(this.PlayerTwoTexture, new Vector2(640, 0), Color.White, 90);

            base.Draw(gameTime);
        }
예제 #16
0
        /// <summary>
        /// Large amount of psysical and magic damage, based on level, strength, inteligence and mana left. Cost all mana points of the unit.
        /// ((15 * (LVL / 100) * (ATK + MATK) - (0.5 * (DEF + MDEF)) * MANA / MAXMANA)
        /// </summary>
        /// <param name="command">Skill casted.</param>
        /// <param name="caster">The caster of the skill.</param>
        /// <param name="target">The target of the skill.</param>
        /// <param name="position">The position of the target.</param>
        private void Reject(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Effects on target.
            if (target != null)
            {
                // Calcule the attack.
                double damage;

                damage  = ((15 * (caster.Attributes.Level / 100) * (caster.Attributes.Attack + caster.Attributes.MagicAttack)) - (0.5 * (caster.Attributes.Defense + caster.Attributes.MagicDefense)) * (float)caster.Mana / (float)caster.Attributes.MaximumMana);
                damage += this.Random.NextDouble() * 0.1f * damage;
                damage  = damage < 1 ? 1 : damage;

                // Apply the hit and flee %.
                int percent = caster.Attributes.Hit - target.Attributes.Flee;

                // Limits of flee and hit.
                if (percent > 100)
                {
                    percent = 100;
                }
                if (percent < 0)
                {
                    percent = 0;
                }

                // Hit
                if (this.Random.Next(0, 100) <= percent)
                {
                    target.Life -= (int)damage;

                    Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);
                    AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Reject, animationPosition);

                    game.DamageManager.Queue(new Damage((int)damage, null, target.Position, Damage.DamageType.Harmful));
                }

                // Miss
                else
                {
                    game.DamageManager.Queue(new Damage("MISS", target.Position, Damage.DamageType.Harmful));
                }
            }

            // Show the mp cost.
            if (caster != target)
            {
                game.DamageManager.Queue(new Damage(caster.Mana, "MP", caster.Position, Damage.DamageType.Harmful));
            }

            // Effects on caster.
            caster.Mana = 0;
            caster.Time = 0;
        }
예제 #17
0
        /// <summary>
        /// Handle the CursorDown event.
        /// </summary>
        private void Touch_CursorDown(object sender, CursorDownArgs e)
        {
            IRTGame game = this.Game as IRTGame;

            game.ParticleManager.Queue(
                new ParticleEffect(e.Position, 50, ParticleEffect.EffectType.Ring, 0.2f, 3.0f, Color.SteelBlue)
                );

            //AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Reject, e.Position);
        }
예제 #18
0
        /// <summary>
        /// Handles the CursorUp event.
        /// </summary>
        /// <param name="sender">Always null.</param>
        /// <param name="e">Data of event.</param>
        private void CursorUp_Handler(object sender, CursorUpArgs e)
        {
            // Exits the tile screen, changing the status of game.
            IRTGame game = this.Game as IRTGame;

            game.ChangeScreen(IRTGame.GameScreens.ConfigScreen);

            // Unregister this event dispatcher.
            InputManager.Instance.CursorUp -= this.CursorUp_Handler;
        }
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        /// with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            if (this.ReadyToStart)
            {
                IRTGame game = this.Game as IRTGame;

                game.SpriteManager.Draw(TextureManager.Instance.Sprites.Config.Start, new Vector2(this.BasePositionField.X + 39, this.BasePositionField.Y + 655), Color.White, 30);
            }

            base.Draw(gameTime);
        }
예제 #20
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            // End the game.
            if (game.PlayerOne.Won || game.PlayerTwo.Won)
            {
                game.ChangeScreen(IRTGame.GameScreens.EndScreen);
            }

            base.Update(gameTime);
        }
예제 #21
0
        /// <summary>
        /// 5% of the percentage to hit the target, to kill the target instantly.
        /// </summary>
        /// <param name="command">Skill casted.</param>
        /// <param name="caster">The caster of the skill.</param>
        /// <param name="target">The target of the skill.</param>
        /// <param name="position">The position of the target.</param>
        private void Curse(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Effects on caster.
            caster.Mana -= command.Attribute;
            caster.Time  = 0;

            // Show the mp cost.
            if (caster != target)
            {
                game.DamageManager.Queue(new Damage(command.Attribute, "MP", caster.Position, Damage.DamageType.Harmful));
            }

            // Effects on target.
            if (target != null)
            {
                // Apply the percentage.
                int percent = Convert.ToInt32(Math.Ceiling(0.05f * (caster.Attributes.Hit / 2 - target.Attributes.Flee)));

                // Limits of flee and hit.
                if (percent > 100)
                {
                    percent = 100;
                }
                if (percent < 0)
                {
                    percent = 0;
                }

                // Hit
                if (this.Random.Next(0, 100) <= percent)
                {
                    target.Life = 0;

                    Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);
                    AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Curse, animationPosition);

                    game.DamageManager.Queue(new Damage("OWNED", target.Position, Damage.DamageType.Harmful));
                }

                // Miss
                else
                {
                    game.DamageManager.Queue(new Damage("MISS", target.Position, Damage.DamageType.Harmful));
                }
            }
        }
예제 #22
0
        /// <summary>
        /// Cast the attack.
        /// (1.5 * HIT - 0.3 * DEF) + (0.1 * (1.5 * HIT - 0.3 * DEF))
        /// </summary>
        /// <param name="command">attack casted.</param>
        /// <param name="caster">The caster of the attack.</param>
        /// <param name="target">The target of the attack.</param>
        /// <param name="position">The position of the target.</param>
        private void Long(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Effects on caster.
            caster.Time = 0;

            // Effects on target.
            if (target != null)
            {
                // Calcule the attack.
                double attack;

                attack  = (1.5f * caster.Attributes.Hit - 0.3f * target.Attributes.Defense);
                attack += this.Random.NextDouble() * 0.1f * attack;
                attack  = attack < 1 ? 1 : attack;

                // Apply the hit and flee %.
                int percent = caster.Attributes.Hit - target.Attributes.Flee;

                // Limits of flee and hit.
                if (percent > 100)
                {
                    percent = 100;
                }
                if (percent < 0)
                {
                    percent = 0;
                }

                // Hit
                if (this.Random.Next(0, 100) <= percent)
                {
                    target.Life -= (int)attack;

                    Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);
                    AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Long, animationPosition);

                    game.DamageManager.Queue(new Damage((int)attack, null, target.Position, Damage.DamageType.Harmful));
                }

                // Miss
                else
                {
                    game.DamageManager.Queue(new Damage("MISS", caster.Position, Damage.DamageType.Harmful));
                }
            }
        }
예제 #23
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        /// with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            // Draw the background
            game.SpriteManager.Draw(this.Texture, this.Position, Color.White, 25);

            // Draw the display text
            Vector2 textSize     = FontManager.Instance.Chilopod20.MeasureString(this.DisplayText.ToString());
            Vector2 textPosition = new Vector2(this.Position.X + ((44 + 596) / 2) - (textSize.X / 2), this.Position.Y + ((71 + 114) / 2) - (textSize.Y / 2));

            game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, this.DisplayText.ToString(), textPosition, Color.White, 30);

            // Draw the selected indicator.
            if (this.Selected)
            {
                game.SpriteManager.Draw(TextureManager.Instance.Sprites.Config.PlayerSelected, new Vector2(this.Position.X, this.Position.Y), Color.White, 30);
            }

            base.Draw(gameTime);
        }
예제 #24
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // Update all child components of the screen.
            foreach (GameComponent component in this.Components)
            {
                // Check if the component can be updated.
                if (component.Enabled)
                {
                    component.Update(gameTime);
                }
            }

            // Instance of the game.
            IRTGame game = this.Game as IRTGame;

            // Updates all the 3d effects.
            game.ParticleManager.Update(gameTime);
            game.DamageManager.Update(gameTime);

            base.Update(gameTime);
        }
예제 #25
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        //  with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            // Draws the unit character.
            game.SpriteManager.Draw(this.Texture, this.Position, new Rectangle(0, 48 * (int)this.Orientation, 32, 48), Color.White, 30);

            // Draws the quick status.
            Vector2 statusPosition = new Vector2(this.Position.X + (this.Texture.Width / 2) - (TextureManager.Instance.Sprites.Unit.QuickStatus.Width / 2), this.Position.Y + 50);

            game.SpriteManager.Draw(TextureManager.Instance.Sprites.Unit.QuickStatus, statusPosition, Color.White, 31);

            // Measure the maximum width and height for the bars.
            int barMaxWidth  = TextureManager.Instance.Sprites.Unit.QuickStatus.Width - 2;
            int barMaxHeight = (TextureManager.Instance.Sprites.Unit.QuickStatus.Height - 2) / 3;

            // Calculates the position of the life, mana and time bars
            Vector2 lifePosition = new Vector2(statusPosition.X + 1, statusPosition.Y + 1);
            Vector2 manaPosition = new Vector2(statusPosition.X + 1, statusPosition.Y + 2 + (1 * barMaxHeight));
            Vector2 timePosition = new Vector2(statusPosition.X + 1, statusPosition.Y + 3 + (2 * barMaxHeight));

            // Calculates the area of the life, mana and time bars, based in unit's values.
            Rectangle lifeBar = new Rectangle((int)lifePosition.X, (int)lifePosition.Y, (int)((barMaxWidth * this.Life) / this.Attributes.MaximumLife), barMaxHeight);
            Rectangle manaBar = new Rectangle((int)manaPosition.X, (int)manaPosition.Y, (int)((barMaxWidth * this.Mana) / this.Attributes.MaximumMana), barMaxHeight);
            Rectangle timeBar = new Rectangle((int)timePosition.X, (int)timePosition.Y, (int)(barMaxWidth * this.Time), barMaxHeight);

            // Draws the life, mana and time bars.
            game.SpriteManager.Draw(TextureManager.Instance.Sprites.Unit.LifeBar, lifeBar, Color.White, 32);
            game.SpriteManager.Draw(TextureManager.Instance.Sprites.Unit.ManaBar, manaBar, Color.White, 32);
            game.SpriteManager.Draw(TextureManager.Instance.Sprites.Unit.TimeBar, timeBar, Color.White, 32);

            // Draws the arrow, if the unit is selected.
            if (this.IsSelected)
            {
                Vector2 arrowPosition = new Vector2(this.Position.X + (this.Texture.Width / 2) - (TextureManager.Instance.Sprites.Unit.Arrow.Width / 2), this.Position.Y - TextureManager.Instance.Sprites.Unit.Arrow.Height);
                game.SpriteManager.Draw(TextureManager.Instance.Sprites.Unit.Arrow, arrowPosition, Color.White, 31);
            }

            base.Draw(gameTime);
        }
예제 #26
0
        /// <summary>
        /// Restore 350 mana points.
        /// </summary>
        /// <param name="command">Item used.</param>
        /// <param name="caster">The caster of the item.</param>
        /// <param name="target">The target of the item.</param>
        /// <param name="position">The position of the target.</param>
        private void Ether(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Show the animation.
            Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);

            AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Item, animationPosition);

            // Effects on caster.
            caster.Time = 0;

            // Effects on target.
            if (target != null)
            {
                target.Mana += 350;

                // Show the damage.
                game.DamageManager.Queue(new Damage(350, "MP", target.Position, Damage.DamageType.Benefit));
            }
        }
예제 #27
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run. This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            IRTGame game = this.Game as IRTGame;

            game.MapManager.Visible = true;

            // Player one win !!!
            if (game.PlayerOne.Won)
            {
                this.PlayerOneTextureField = TextureManager.Instance.Sprites.Menu.Win;
                this.PlayerTwoTextureField = TextureManager.Instance.Sprites.Menu.Lose;
            }

            // Player two win !!!
            if (game.PlayerTwo.Won)
            {
                this.PlayerOneTextureField = TextureManager.Instance.Sprites.Menu.Lose;
                this.PlayerTwoTextureField = TextureManager.Instance.Sprites.Menu.Win;
            }

            base.Initialize();
        }
예제 #28
0
        /// <summary>
        /// Restore all life points and mana poins.
        /// </summary>
        /// <param name="command">Item used.</param>
        /// <param name="caster">The caster of the item.</param>
        /// <param name="target">The target of the item.</param>
        /// <param name="position">The position of the target.</param>
        private void Elixir(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Show the animation.
            Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);

            AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Elixir, animationPosition);

            // Effects on caster.
            caster.Time = 0;

            // Effects on target.
            if (target != null)
            {
                target.Life = target.Attributes.MaximumLife;
                target.Mana = target.Attributes.MaximumMana;

                // Show the damage.
                game.DamageManager.Queue(new Damage("WOHOO", target.Position, Damage.DamageType.Benefit));
            }
        }
예제 #29
0
        /// <summary>
        /// Increases the DEF and MDEF of the target for 60 seconds.
        /// </summary>
        /// <param name="command">Skill casted.</param>
        /// <param name="caster">The caster of the skill.</param>
        /// <param name="target">The target of the skill.</param>
        /// <param name="position">The position of the target.</param>
        private void Barrier(Command command, Unit caster, Unit target, Vector2 position)
        {
            // Obtain the game instance.
            IRTGame game = caster.Game as IRTGame;

            // Show the animation.
            Vector2 animationPosition = target == null ? position : new Vector2(target.Position.X + target.Texture.Width / 2, target.Position.Y + target.Texture.Height / 8);

            AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Barrier, animationPosition);

            // Effects on caster.
            caster.Mana -= command.Attribute;
            caster.Time  = 0;

            // Show the bonus.
            game.DamageManager.Queue(new Damage("DEF++\nMDEF++", caster.Position, Damage.DamageType.Benefit));

            // Effects on target.
            if (target != null)
            {
                ThreadPool.QueueUserWorkItem(delegate(object data)
                {
                    Unit unit = data as Unit;

                    float oldDefenseFactor      = unit.Attributes.DefenseFactor;
                    float oldMagicDefenseFactor = unit.Attributes.MagicDefenseFactor;

                    unit.Attributes.DefenseFactor      *= 1.5f;
                    unit.Attributes.MagicDefenseFactor *= 1.5f;

                    Thread.Sleep(60000);

                    unit.Attributes.DefenseFactor      = oldDefenseFactor;
                    unit.Attributes.MagicDefenseFactor = oldMagicDefenseFactor;
                }, target);
            }
        }
예제 #30
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn. Override this method
        /// with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            IRTGame game = this.Game as IRTGame;

            // Draw the background
            game.SpriteManager.Draw(this.Texture, this.Position, Color.White, 25);

            // Draw the display text
            Vector2 textSize     = FontManager.Instance.Chilopod20.MeasureString(this.DisplayText.ToString());
            Vector2 textPosition = new Vector2(this.Position.X + (TextureManager.Instance.Sprites.Config.UnitGreen.Width / 2) - (textSize.X / 2), this.Position.Y + (TextureManager.Instance.Sprites.Config.UnitGreen.Height / 2) - (textSize.Y / 2));

            game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, this.DisplayText.ToString(), textPosition, Color.White, 30);

            // Draw the indicator.
            if (this.Selected)
            {
                Vector2 attributePosition = new Vector2((640 * ((int)this.Position.X / 640)) + 38, 379);

                game.SpriteManager.Draw(TextureManager.Instance.Sprites.Config.UnitSelected, new Vector2(this.Position.X, this.Position.Y), Color.White, 30);
                game.SpriteManager.Draw(this.AttributeTexture, attributePosition, Color.White, 30);

                // Draw the character
                Texture2D characterTexture  = Character.Instance[this.CharacterIndex].Texture;
                Vector2   characterPosition = new Vector2(attributePosition.X + ((23 + 184) / 2) - (characterTexture.Width / 2), attributePosition.Y + ((49 + 214) / 2) - (characterTexture.Height / 8));
                int       index             = gameTime.TotalGameTime.Seconds % 4; index = index == 0 ? 0 : index == 1 ? 2 : index == 2 ? 3 : 1;
                game.SpriteManager.Draw(characterTexture, characterPosition, new Rectangle(0, 48 * index, 32, 48), Color.White, 35);

                // Draw the job name
                string  jobName     = Enum.GetName(typeof(Job), Character.Instance[this.CharacterIndex].Job);
                Vector2 jobSize     = FontManager.Instance.Chilopod20.MeasureString(jobName);
                Vector2 jobPosition = new Vector2(attributePosition.X + ((23 + 184) / 2) - (jobSize.X / 2), attributePosition.Y + ((214 + 247) / 2) - (jobSize.Y / 2));
                game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, jobName, jobPosition, Color.White, 35);

                // Draw the points left
                string  pointsText     = String.Format("{0} points left", this.AttributePoints);
                Vector2 pointsSize     = FontManager.Instance.Chilopod20.MeasureString(pointsText);
                Vector2 pointsPosition = new Vector2(attributePosition.X + ((184 + 541) / 2) - (pointsSize.X / 2), attributePosition.Y + ((49 + 82) / 2) - (pointsSize.Y / 2));
                game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, pointsText, pointsPosition, Color.White, 35);

                // Draw the strength
                Vector2 strengthSize     = FontManager.Instance.Chilopod20.MeasureString(this.Strength.ToString());
                Vector2 strengthPosition = new Vector2(attributePosition.X + ((411 + 475) / 2) - (strengthSize.X / 2), attributePosition.Y + ((82 + 115) / 2) - (strengthSize.Y / 2));
                game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, this.Strength.ToString(), strengthPosition, Color.White, 35);

                // Draw the agility
                Vector2 agilitySize     = FontManager.Instance.Chilopod20.MeasureString(this.Agility.ToString());
                Vector2 agilityPosition = new Vector2(attributePosition.X + ((411 + 475) / 2) - (agilitySize.X / 2), attributePosition.Y + ((115 + 148) / 2) - (agilitySize.Y / 2));
                game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, this.Agility.ToString(), agilityPosition, Color.White, 35);

                // Draw the vitality
                Vector2 vitalitySize     = FontManager.Instance.Chilopod20.MeasureString(this.Vitality.ToString());
                Vector2 vitalityPosition = new Vector2(attributePosition.X + ((411 + 475) / 2) - (vitalitySize.X / 2), attributePosition.Y + ((148 + 181) / 2) - (vitalitySize.Y / 2));
                game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, this.Vitality.ToString(), vitalityPosition, Color.White, 35);

                // Draw the inteligence
                Vector2 inteligenceSize     = FontManager.Instance.Chilopod20.MeasureString(this.Inteligence.ToString());
                Vector2 inteligencePosition = new Vector2(attributePosition.X + ((411 + 475) / 2) - (inteligenceSize.X / 2), attributePosition.Y + ((181 + 214) / 2) - (inteligenceSize.Y / 2));
                game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, this.Inteligence.ToString(), inteligencePosition, Color.White, 35);

                // Draw the dexterity
                Vector2 dexteritySize     = FontManager.Instance.Chilopod20.MeasureString(this.Dexterity.ToString());
                Vector2 dexterityPosition = new Vector2(attributePosition.X + ((411 + 475) / 2) - (dexteritySize.X / 2), attributePosition.Y + ((214 + 247) / 2) - (dexteritySize.Y / 2));
                game.SpriteManager.DrawString(FontManager.Instance.Chilopod20, this.Dexterity.ToString(), dexterityPosition, Color.White, 35);
            }

            base.Draw(gameTime);
        }