コード例 #1
0
 public void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
 {
     foreach (SecondarySkill skill in SecondarySkills)
     {
         skill.ApplySpell(data, damageModifier);
     }
 }
コード例 #2
0
        public void CalculateDamage(SpellDamageCalculatorData data, out int damage)
        {
            int baseDamage = data.Spell.BaseDamage(data.Target);

            SpellDamageModifier damageModifier = data.Spell.BaseModifier(data.Target);

            UnitUniqueTraitManager.Instance.ApplySpell(data, damageModifier);
            data.CasterHeroStats.ApplySpell(data, damageModifier);

            if (data.TargetProtectionSpells != null)
            {
                foreach (ProtectionSpell protectionSpell in data.TargetProtectionSpells)
                {
                    protectionSpell.ApplySpell(data, damageModifier);
                }
            }

            if (data.CasterMagicOrbs != null)
            {
                foreach (MagicOrb magicOrb in data.CasterMagicOrbs)
                {
                    magicOrb.ApplySpell(data, damageModifier);
                }
            }

            // TODO: orb of vulnerability

            damage = PerformCalculation(baseDamage, damageModifier);
        }
コード例 #3
0
ファイル: MagicOrb.cs プロジェクト: nickynick/H3Calc
 public void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
 {
     if (data.Spell.IsAffectedBySecondarySkillType(MagicType))
     {
         damageModifier.DamageMultipliers.Add(1.5);
     }
 }
コード例 #4
0
 public void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
 {
     if (data.Spell.IsAffectedBySecondarySkillType(MagicType))
     {
         damageModifier.DamageMultipliers.Add(1.5);
     }
 }
コード例 #5
0
        public void CalculateDamage(SpellDamageCalculatorData data, out int damage)
        {
            int baseDamage = data.Spell.BaseDamage(data.Target);

            SpellDamageModifier damageModifier = data.Spell.BaseModifier(data.Target);

            UnitUniqueTraitManager.Instance.ApplySpell(data, damageModifier);
            data.CasterHeroStats.ApplySpell(data, damageModifier);

            if (data.TargetProtectionSpells != null)
            {
                foreach (ProtectionSpell protectionSpell in data.TargetProtectionSpells)
                {
                    protectionSpell.ApplySpell(data, damageModifier);
                }
            }

            if (data.CasterMagicOrbs != null)
            {
                foreach (MagicOrb magicOrb in data.CasterMagicOrbs)
                {
                    magicOrb.ApplySpell(data, damageModifier);
                }
            }

            // TODO: orb of vulnerability

            damage = PerformCalculation(baseDamage, damageModifier);
        }
コード例 #6
0
        public override void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
        {
            if (SkillLevel == SecondarySkillLevel.None)
            {
                return;
            }

            double multiplier;

            if (SkillLevel == SecondarySkillLevel.Basic)
            {
                multiplier = 1.05;
            }
            else if (SkillLevel == SecondarySkillLevel.Advanced)
            {
                multiplier = 1.1;
            }
            else
            {
                multiplier = 1.15;
            }

            if (IsSpecialized)
            {
                multiplier *= (1.0 + 0.05 * HeroStats.Level);
            }

            damageModifier.DamageMultipliers.Add(multiplier);
        }
コード例 #7
0
ファイル: ProtectionSpells.cs プロジェクト: nickynick/H3Calc
 public void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
 {
     if (data.Spell.IsAffectedBySecondarySkillType(SecondarySkillType))
     {
         if (CasterStats.SkillLevel <= SecondarySkillLevel.Basic)
         {
             damageModifier.DamageMultipliers.Add(0.7);
         }
         else
         {
             damageModifier.DamageMultipliers.Add(0.5);
         }
     }
 }
コード例 #8
0
 public void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
 {
     if (data.Spell.IsAffectedBySecondarySkillType(SecondarySkillType))
     {
         if (CasterStats.SkillLevel <= SecondarySkillLevel.Basic)
         {
             damageModifier.DamageMultipliers.Add(0.7);
         }
         else
         {
             damageModifier.DamageMultipliers.Add(0.5);
         }
     }
 }
コード例 #9
0
        public void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
        {
            Unit  unit  = data.Target;
            Spell spell = data.Spell;

            // TODO: orb of vulnerability
            bool isImmune = false;

            isImmune |= (spell.IsAffectedBySecondarySkillType(unit.ImmuneMagic));
            isImmune |= (unit.ImmuneSpells != null && unit.ImmuneSpells.Contains(spell.GetType()));
            isImmune |= (unit.ImmuneSpellLevel >= spell.Level);

            if (isImmune)
            {
                damageModifier.DamageMultipliers.Add(0);
                return;
            }

            if (unit.VulnerableSpells != null && unit.VulnerableSpells.Contains(spell.GetType()))
            {
                damageModifier.DamageMultipliers.Add(2);
            }

            if (unit.Id == 32) // Stone Golem
            {
                damageModifier.DamageMultipliers.Add(0.5);
            }
            else if (unit.Id == 33) // Iron Golem
            {
                damageModifier.DamageMultipliers.Add(0.25);
            }
            else if (unit.Id == 134) // Gold Golem
            {
                damageModifier.DamageMultipliers.Add(0.15);
            }
            else if (unit.Id == 135) // Diamond Golem
            {
                damageModifier.DamageMultipliers.Add(0.05);
            }
        }
コード例 #10
0
ファイル: SecondarySkills.cs プロジェクト: nickynick/H3Calc
        public override void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
        {
            if (SkillLevel == SecondarySkillLevel.None)
            {
                return;
            }

            double multiplier;

            if (SkillLevel == SecondarySkillLevel.Basic)
            {
                multiplier = 1.05;
            }
            else if (SkillLevel == SecondarySkillLevel.Advanced)
            {
                multiplier = 1.1;
            }
            else
            {
                multiplier = 1.15;
            }

            if (IsSpecialized)
            {
                multiplier *= (1.0 + 0.05 * HeroStats.Level);
            }

            damageModifier.DamageMultipliers.Add(multiplier);
        }
コード例 #11
0
ファイル: SecondarySkills.cs プロジェクト: nickynick/H3Calc
 public virtual void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
 {
 }
コード例 #12
0
 public virtual void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
 {
 }
コード例 #13
0
ファイル: SpellDamagePanel.cs プロジェクト: nickynick/H3Calc
        void UpdateDataFromControls(SpellDamageCalculatorData data)
        {
            data.Spell = (DamageSpell)spellComboBox.SelectedValue;

            if (data.CasterHeroStats == null)
            {
                data.CasterHeroStats = new HeroStats();
            }

            data.CasterHeroStats.Hero = (Hero)heroComboBox.SelectedValue;
            data.CasterHeroStats.Level = (int)heroLevelUpDn.Value;
            data.CasterHeroStats.SpellPower = (int)heroSpellPowerUpDn.Value;

            data.CasterHeroStats.SetLevelForSecondarySkillType(typeof(AirMagic), (SecondarySkillLevel)heroAirComboBox.SelectedValue);
            data.CasterHeroStats.SetLevelForSecondarySkillType(typeof(FireMagic), (SecondarySkillLevel)heroFireComboBox.SelectedValue);
            data.CasterHeroStats.SetLevelForSecondarySkillType(typeof(EarthMagic), (SecondarySkillLevel)heroEarthComboBox.SelectedValue);
            data.CasterHeroStats.SetLevelForSecondarySkillType(typeof(WaterMagic), (SecondarySkillLevel)heroWaterComboBox.SelectedValue);
            data.CasterHeroStats.SetLevelForSecondarySkillType(typeof(Sorcery), (SecondarySkillLevel)heroSorceryComboBox.SelectedValue);

            data.TargetProtectionSpells = new List<ProtectionSpell>();
            CheckProtectionSpellComboBox(protFromAirComboBox, new ProtectionFromAir(), data.TargetProtectionSpells);
            CheckProtectionSpellComboBox(protFromFireComboBox, new ProtectionFromFire(), data.TargetProtectionSpells);
            CheckProtectionSpellComboBox(protFromEarthComboBox, new ProtectionFromEarth(), data.TargetProtectionSpells);
            CheckProtectionSpellComboBox(protFromWaterComboBox, new ProtectionFromWater(), data.TargetProtectionSpells);

            data.CasterMagicOrbs = new List<MagicOrb>();
            CheckMagicOrbCheckBox(airOrbChbx, typeof(AirMagic), data.CasterMagicOrbs);
            CheckMagicOrbCheckBox(fireOrbChbx, typeof(FireMagic), data.CasterMagicOrbs);
            CheckMagicOrbCheckBox(earthOrbChbx, typeof(EarthMagic), data.CasterMagicOrbs);
            CheckMagicOrbCheckBox(waterOrbChbx, typeof(WaterMagic), data.CasterMagicOrbs);

            data.Spell.CasterStats = data.CasterHeroStats.SpellCasterStatsForSpell(data.Spell);

            data.Target = PickedUnit;
        }
コード例 #14
0
ファイル: SpellDamagePanel.cs プロジェクト: nickynick/H3Calc
        void SetControlsWithData(SpellDamageCalculatorData data)
        {
            dataUpdateSuspended = true;

            spellComboBox.SelectedItem = data.Spell ?? spellComboBox.Items[0];

            if (data.CasterHeroStats != null && data.CasterHeroStats.Hero != null)
            {
                heroComboBox.SelectedItem = data.CasterHeroStats.Hero;
                heroLevelUpDn.Value = data.CasterHeroStats.Level;
                heroSpellPowerUpDn.Value = data.CasterHeroStats.SpellPower;

                heroAirComboBox.SelectedItem = data.CasterHeroStats.LevelForSecondarySkillType(typeof(AirMagic));
                heroFireComboBox.SelectedItem = data.CasterHeroStats.LevelForSecondarySkillType(typeof(FireMagic));
                heroEarthComboBox.SelectedItem = data.CasterHeroStats.LevelForSecondarySkillType(typeof(EarthMagic));
                heroWaterComboBox.SelectedItem = data.CasterHeroStats.LevelForSecondarySkillType(typeof(WaterMagic));
                heroSorceryComboBox.SelectedItem = data.CasterHeroStats.LevelForSecondarySkillType(typeof(Sorcery));
            }
            else
            {
                heroComboBox.SelectedIndex = 0;
                heroLevelUpDn.Value = 1;
                heroSpellPowerUpDn.Value = 0;

                heroAirComboBox.SelectedItem = SecondarySkillLevel.None;
                heroFireComboBox.SelectedItem = SecondarySkillLevel.None;
                heroEarthComboBox.SelectedItem = SecondarySkillLevel.None;
                heroWaterComboBox.SelectedItem = SecondarySkillLevel.None;
                heroSorceryComboBox.SelectedItem = SecondarySkillLevel.None;
            }

            PickedUnit = data.Target;

            dataUpdateSuspended = false;
        }
コード例 #15
0
ファイル: Unit.cs プロジェクト: nickynick/H3Calc
        public void ApplySpell(SpellDamageCalculatorData data, SpellDamageModifier damageModifier)
        {
            Unit unit = data.Target;
            Spell spell = data.Spell;

            // TODO: orb of vulnerability
            bool isImmune = false;
            isImmune |= (spell.IsAffectedBySecondarySkillType(unit.ImmuneMagic));
            isImmune |= (unit.ImmuneSpells != null && unit.ImmuneSpells.Contains(spell.GetType()));
            isImmune |= (unit.ImmuneSpellLevel >= spell.Level);

            if (isImmune)
            {
                damageModifier.DamageMultipliers.Add(0);
                return;
            }

            if (unit.VulnerableSpells != null && unit.VulnerableSpells.Contains(spell.GetType()))
            {
                damageModifier.DamageMultipliers.Add(2);
            }

            if (unit.Id == 32) // Stone Golem
            {
                damageModifier.DamageMultipliers.Add(0.5);
            }
            else if (unit.Id == 33) // Iron Golem
            {
                damageModifier.DamageMultipliers.Add(0.25);
            }
            else if (unit.Id == 134) // Gold Golem
            {
                damageModifier.DamageMultipliers.Add(0.15);
            }
            else if (unit.Id == 135) // Diamond Golem
            {
                damageModifier.DamageMultipliers.Add(0.05);
            }
        }