private void SpecialAttack(object sender, MouseButtonEventArgs e)
        {
            SpellBookWindow spellbook = new SpellBookWindow(gameSession, true);

            spellbook.ShowDialog();
            if (spellbook.IsSkillUsed)
            {
                gameSession.Hero.CurrentMP -= gameSession.Hero.CurrentSkill.ManaCost;
                gameSession.Hero.SkillDamageCalculation();

                if (gameSession.Hero.CurrentSkill.AffectedTarger.Equals(Game.SpecialAttack.Skills.Target.Self))
                {
                    gameSession.Hero.CurrentHP += (int)gameSession.Hero.Damage;
                    if (gameSession.Hero.CurrentHP > gameSession.Hero.MaxHP)
                    {
                        gameSession.Hero.CurrentHP = gameSession.Hero.MaxHP;
                    }
                }
                else
                {
                    gameSession.CurrentEnemy.CurrentHP -= (int)(gameSession.Hero.Damage - gameSession.CurrentEnemy.Defence);
                }

                // Apply Status Effect
                if (gameSession.Hero.CurrentSkill.Effect != null)
                {
                    gameSession.CurrentEnemy.ApplyStatusEffect(gameSession.Hero.CurrentSkill.Effect.Name, gameSession.Hero.CurrentSkill.Effect.ID, gameSession.Hero.CurrentSkill.Effect.Description, gameSession.Hero.CurrentSkill.Effect.AffectHP, gameSession.Hero.CurrentSkill.Effect.AffectMP, gameSession.Hero.CurrentSkill.Effect.Duration, gameSession.Hero.CurrentSkill.Effect.Type);
                }
                EnemyAttack();
            }
        }
Exemple #2
0
        private void SpecialAttack(object sender, MouseButtonEventArgs e)
        {
            SpellBookWindow spellbook = new SpellBookWindow(gameSession, false);

            spellbook.ShowDialog();
            if (spellbook.IsSkillUsed && gameSession.Hero.CurrentHP != gameSession.Hero.MaxHP)
            {
                gameSession.Hero.CurrentMP -= gameSession.Hero.CurrentSkill.ManaCost;
                gameSession.Hero.SkillDamageCalculation();
                gameSession.Hero.CurrentHP += (int)gameSession.Hero.Damage;
                if (gameSession.Hero.CurrentHP > gameSession.Hero.MaxHP)
                {
                    gameSession.Hero.CurrentHP = gameSession.Hero.MaxHP;
                }
                tbLog.Document.Blocks.Add(new Paragraph(new Run($"{gameSession.Hero.Name} casting {gameSession.Hero.CurrentSkill.Name} and heal for {(int)gameSession.Hero.Damage} HP." + Environment.NewLine)));
            }
        }