private IEnumerator CreateSpellButtons()
    {
        yield return(StartCoroutine(Clean()));

        yield return(null);

        int           rank   = storage.selectedRank;
        CharClassEnum cclass = storage.selectedChar.cclass;
        List <Spell>  spells = new List <Spell>();

        if (storage.selectedRankMain)
        {
            // main class spells
            spells.AddRange(storage.spellList.GetSpellsOfClassAndRank(cclass, rank));
        }
        else
        {
            // extra spells (domains / school-spec)
            if (cclass == CharClassEnum.Cleric)
            {
                ClericDomain dom_1 = (ClericDomain)storage.selectedChar.attributes[0];
                ClericDomain dom_2 = (ClericDomain)storage.selectedChar.attributes[1];
                spells.AddRange(storage.spellList.Get2DomainSpellsWithRank(dom_1, dom_2, rank));
            }
            else if (cclass == CharClassEnum.Wizard)
            {
                MagicSchool school = (MagicSchool)storage.selectedChar.attributes[0];
                spells.AddRange(storage.spellList.GetWizardSchoolSpecializationSpells(school, rank));
            }
        }
        CreateSpellButtons(spells);
    }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = MagicEffectFlags.ToString();

            ele.TryPathTo("BaseCost", true, out subEle);
            subEle.Value = BaseCost.ToString("G15");

            ele.TryPathTo("AssociatedItem", true, out subEle);
            AssociatedItem.WriteXML(subEle, master);

            ele.TryPathTo("MagicSchool", true, out subEle);
            subEle.Value = MagicSchool.ToString();

            ele.TryPathTo("ResistanceType", true, out subEle);
            subEle.Value = ResistanceType.ToString();

            ele.TryPathTo("Unknown", true, out subEle);
            subEle.Value = Unknown.ToString();

            WriteUnusedXML(ele, master);

            ele.TryPathTo("Light", true, out subEle);
            Light.WriteXML(subEle, master);

            ele.TryPathTo("ProjectileSpeed", true, out subEle);
            subEle.Value = ProjectileSpeed.ToString("G15");

            ele.TryPathTo("EffectShader", true, out subEle);
            EffectShader.WriteXML(subEle, master);

            ele.TryPathTo("ObjectDisplayShader", true, out subEle);
            ObjectDisplayShader.WriteXML(subEle, master);

            ele.TryPathTo("EffectSound", true, out subEle);
            EffectSound.WriteXML(subEle, master);

            ele.TryPathTo("BoltSound", true, out subEle);
            BoltSound.WriteXML(subEle, master);

            ele.TryPathTo("HitSound", true, out subEle);
            HitSound.WriteXML(subEle, master);

            ele.TryPathTo("AreaSound", true, out subEle);
            AreaSound.WriteXML(subEle, master);

            ele.TryPathTo("ConstantEffectEnchantmentFactor", true, out subEle);
            subEle.Value = ConstantEffectEnchantmentFactor.ToString("G15");

            ele.TryPathTo("ConstantEffectBarterFactor", true, out subEle);
            subEle.Value = ConstantEffectBarterFactor.ToString("G15");

            ele.TryPathTo("Archetype", true, out subEle);
            subEle.Value = Archetype.ToString();

            ele.TryPathTo("ActorValue", true, out subEle);
            subEle.Value = ActorValue.ToString();
        }
        protected Ability(String name, int rank, int level, float baseMinDamage, float baseMaxDamage, float baseCost,
                          Stats stats, Character character, CalculationOptionsWarlock options, Color color, MagicSchool magicSchool, SpellTree spellTree)
        {
            Name          = name;
            Rank          = rank;
            Level         = level;
            BaseMinDamage = baseMinDamage;
            BaseMaxDamage = baseMaxDamage;
            BaseCost      = baseCost;

            Stats       = stats;
            Character   = character;
            Options     = options;
            GraphColor  = color;
            MagicSchool = magicSchool;
            SpellTree   = spellTree;

            //all properties default to zero, except for the following:
            BaseExecuteTime            = 3;
            BaseGlobalCooldown         = 1.5f;
            BaseDirectDamageMultiplier = 1;
            BaseCritMultiplier         = 1.5f;
            BaseRange = 30;
            Harmful   = true;

            Statistics = new Statistics();
        }
Exemple #4
0
    public void InitiateSpell(JSONObject spellObject)
    {
        mName   = spellObject.GetString("name");
        mSchool = (MagicSchool)spellObject.GetNumber("school");
        JSONArray classes = spellObject.GetArray("classes");

        foreach (var val in classes)
        {
            SpellAttribute attribute = new SpellAttribute();
            attribute.attribute      = Attribute.Class;
            attribute.attributeValue = (int)val.Obj.GetNumber("class");
            attribute.rank           = (int)val.Obj.GetNumber("rank");
            mClasses.Add(attribute);
        }
        JSONArray domains = spellObject.GetArray("domains");

        foreach (var val in domains)
        {
            SpellAttribute attribute = new SpellAttribute();
            attribute.attribute      = Attribute.Domain;
            attribute.attributeValue = (int)val.Obj.GetNumber("domain");
            attribute.rank           = (int)val.Obj.GetNumber("rank");
            mDomains.Add(attribute);
        }
    }
Exemple #5
0
        /// <summary>
        ///  Learns spells in bulk, without notification, filtered by school and level
        /// </summary>
        public void LearnSpellsInBulk(MagicSchool school, uint spellLevel, bool withNetworking = true)
        {
            var spellTable = DatManager.PortalDat.SpellTable;

            foreach (var spellID in PlayerSpellTable)
            {
                if (!spellTable.Spells.ContainsKey(spellID))
                {
                    Console.WriteLine($"Unknown spell ID in PlayerSpellID table: {spellID}");
                    continue;
                }
                var spell = new Spell(spellID, false);
                if (spell.School == school && spell.Formula.Level == spellLevel)
                {
                    if (withNetworking)
                    {
                        LearnSpellWithNetworking(spell.Id, false);
                    }
                    else
                    {
                        AddKnownSpell(spell.Id);
                    }
                }
            }
        }
Exemple #6
0
    public List <Spell> GetWizardSchoolSpecializationSpells(MagicSchool school, int rank)
    {
        List <Spell> result = mSpellList.FindAll(
            delegate(Spell temp)
        {
            return(temp.Contains(school, CharClassEnum.Wizard, rank));
        });

        return(result);
    }
Exemple #7
0
 public bool Contains(MagicSchool school, CharClassEnum cclass, int rank)
 {
     foreach (SpellAttribute attribute in mClasses)
     {
         if (attribute.attributeValue == (int)cclass && attribute.rank == rank)
         {
             return(mSchool == school);
         }
     }
     return(false);
 }
Exemple #8
0
        /// <summary>
        /// Returns a list of all the active enchantments for a magic school
        /// </summary>
        public List <BiotaPropertiesEnchantmentRegistry> GetEnchantments(MagicSchool magicSchool)
        {
            var spells = new List <BiotaPropertiesEnchantmentRegistry>();

            foreach (var enchantment in Enchantments)
            {
                var spellBase = DatManager.PortalDat.SpellTable.Spells[(uint)enchantment.SpellId];
                if (spellBase.School == MagicSchool.ItemEnchantment)
                {
                    spells.Add(enchantment);
                }
            }
            return(spells);
        }
Exemple #9
0
        // GET: MagicSchool/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            MagicSchool magicSchool = DAL.GetMagicSchool((int)id);

            if (magicSchool == null)
            {
                return(NotFound());
            }
            return(View(magicSchool));
        }
Exemple #10
0
 public Spell(string name, MagicSchool magicSchool, SpellTree spellTree, float minDamage, float maxDamage, float periodicDamage, float dotDuration, float castTime, float manaCost)
 {
     Name                    = name;
     MagicSchool             = magicSchool;
     SpellTree               = spellTree;
     BaseMinDamage           = minDamage;
     BaseMaxDamage           = maxDamage;
     BasePeriodicDamage      = periodicDamage;
     BaseDotDuration         = dotDuration;
     BaseCastTime            = castTime;
     BaseManaCost            = manaCost;
     DirectDamageCoefficient = BaseCastTime / 3.5f;
     DotDamageCoefficient    = BaseDotDuration / 15;
     CritBonus               = 1;
     BonusMultiplier         = 1;
 }
Exemple #11
0
 public bool HasExtraSpell()
 {
     if (mCClass == CharClassEnum.Wizard)
     {
         MagicSchool spec = ((MagicSchool)(mAttributes[0]));
         if (spec != MagicSchool.none)
         {
             return(true);
         }
     }
     else if (mCClass == CharClassEnum.Cleric)
     {
         return(true);
     }
     return(false);
 }
Exemple #12
0
 public ActionResult Create([Bind("Description,Name,ID")] MagicSchool magicSchool)
 {
     if (ModelState.IsValid)
     {
         if (DAL.CreateMagicSchool(magicSchool) > 0)
         {
             //success
         }
         else
         {
             //error
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(magicSchool));
 }
Exemple #13
0
 public SpellBase(string spellId,
                  string spellName,
                  List <ISpellEffect> effects,
                  MagicSchool spellSchool,
                  int spellRange,
                  int spellLevel  = 1,
                  double manaCost = 0.1f)
 {
     SpellId              = spellId;
     SpellName            = spellName;
     SpellSchool          = spellSchool;
     SpellRange           = spellRange;
     SpellLevel           = spellLevel;
     ManaCost             = manaCost;
     Effects              = effects;
     requiredShapingSkill = (int)((spellLevel * manaCost) * 0.5);
 }
Exemple #14
0
 private void WizardSpecHandler(string text)
 {
     if (mCharacter.attributes.Count != 1)
     {
         mCharacter.attributes.Clear();
         mCharacter.attributes.Add(0);
     }
     foreach (MagicSchool school in MagicSchool.GetValues(typeof(MagicSchool)))
     {
         if (school.ToString() == text)
         {
             mCharacter.attributes[0] = (int)school;
             break;
         }
         mCharacter.attributes[0] = (int)MagicSchool.none;
     }
 }
Exemple #15
0
        /// <summary>
        /// Returns a list of all the active enchantments for a magic school
        /// </summary>
        public List <BiotaPropertiesEnchantmentRegistry> GetEnchantments(MagicSchool magicSchool)
        {
            var spells       = new List <BiotaPropertiesEnchantmentRegistry>();
            var enchantments = WorldObject.Biota.GetEnchantments(WorldObject.BiotaDatabaseLock);

            foreach (var enchantment in enchantments)
            {
                var spellBase = DatManager.PortalDat.SpellTable.Spells[(uint)enchantment.SpellId];

                if (spellBase.School == magicSchool)
                {
                    spells.Add(enchantment);
                }
            }

            return(spells);
        }
Exemple #16
0
        public bool HasFoci(MagicSchool school)
        {
            switch (school)
            {
            case MagicSchool.CreatureEnchantment:
                if (AugmentationInfusedCreatureMagic > 0)
                {
                    return(true);
                }
                break;

            case MagicSchool.ItemEnchantment:
                if (AugmentationInfusedItemMagic > 0)
                {
                    return(true);
                }
                break;

            case MagicSchool.LifeMagic:
                if (AugmentationInfusedLifeMagic > 0)
                {
                    return(true);
                }
                break;

            case MagicSchool.VoidMagic:
                if (AugmentationInfusedVoidMagic > 0)
                {
                    return(true);
                }
                break;

            case MagicSchool.WarMagic:
                if (AugmentationInfusedWarMagic > 0)
                {
                    return(true);
                }
                break;
            }

            var wcid = FociWCIDs[school];

            return(Inventory.Values.FirstOrDefault(i => i.WeenieClassId == wcid) != null);
        }
Exemple #17
0
 public Spell(Stats stats, string name, float minDamage, float maxDamage, int manaCost, float castTime, float critCoef, float dotDuration, float damageCoef, int range, float cooldown, Color col, MagicSchool magicSchool)
 {
     Name            = name;
     DamageCoef      = damageCoef;
     DebuffDuration  = dotDuration;
     GraphColor      = col;
     MinDamage       = minDamage;
     MaxDamage       = maxDamage;
     ManaCost        = manaCost;
     CastTime        = castTime;
     DebuffDuration  = dotDuration;
     DamageCoef      = damageCoef;
     Range           = range;
     CritCoef        = critCoef;
     GlobalCooldown  = 1.5f * (1 - stats.SpellHasteRating / 15.7f / 100f);
     Cooldown        = cooldown;
     SpellStatistics = new SpellStatistics();
     MagicSchool     = magicSchool;
 }
Exemple #18
0
    //显示魔法,根据派系、是否战斗型、页数
    public void ShowMagics(MagicSchool _school, MagicType _type, int _page = 0)
    {
        currentPage      = _page;
        currentSchool    = _school;
        currentMagicType = _type;

        //隐藏所有魔法
        HideMagicItems();

        List <Magic> magics = new List <Magic>();

        //根据派系和类型过滤
        foreach (Magic item in magicList)
        {
            if ((_school == MagicSchool.All || item.school == _school || item.school == MagicSchool.All) &&
                (item.type == _type || _type == MagicType.All))
            {
                magics.Add(item);
            }
        }
        //开始的位置
        int startMagicIndex = _page * magicsPerPage;

        //如果还有下页,显示下一页按钮
        if (magics.Count - startMagicIndex > magicsPerPage)
        {
            button_nextPage.gameObject.SetActive(true);
        }
        else
        {
            button_nextPage.gameObject.SetActive(false);
        }

        //显示魔法
        int showItemCount = Mathf.Min(magicsPerPage, magics.Count - startMagicIndex);

        for (int i = 0; i < showItemCount; i++)
        {
            ShowMagicItem(i);
            items[i].Init(magics[startMagicIndex + i]);
        }
    }
Exemple #19
0
        /// <summary>
        /// Returns a list of all the active enchantments for a magic school
        /// </summary>
        public List <BiotaPropertiesEnchantmentRegistry> GetEnchantments(MagicSchool magicSchool)
        {
            var spells = new List <BiotaPropertiesEnchantmentRegistry>();

            var enchantments = from e in WorldObject.Biota.GetEnchantments(WorldObject.BiotaDatabaseLock)
                               group e by e.SpellCategory
                               into categories
                               select categories.OrderByDescending(c => c.LayerId).First();

            foreach (var enchantment in enchantments)
            {
                var spell = new Entity.Spell(enchantment.SpellId);

                if (spell.School == magicSchool)
                {
                    spells.Add(enchantment);
                }
            }

            return(spells);
        }
Exemple #20
0
        public ActionResult Edit(int id, [Bind("Description,Name,ID")] MagicSchool magicSchool)
        {
            if (id != magicSchool.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                if (DAL.UpdateMagicSchool(magicSchool, id) > 0)
                {
                    //success
                }
                else
                {
                    //error
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(magicSchool));
        }
        public CreatureSkill GetCreatureSkill(MagicSchool skill)
        {
            switch (skill)
            {
            case MagicSchool.CreatureEnchantment:
                return(GetCreatureSkill(Skill.CreatureEnchantment));

            case MagicSchool.ItemEnchantment:
                return(GetCreatureSkill(Skill.ItemEnchantment));

            case MagicSchool.LifeMagic:
                return(GetCreatureSkill(Skill.LifeMagic));

            case MagicSchool.VoidMagic:
                return(GetCreatureSkill(Skill.VoidMagic));

            case MagicSchool.WarMagic:
                return(GetCreatureSkill(Skill.WarMagic));
            }
            return(null);
        }
Exemple #22
0
        public bool CanReadScroll(MagicSchool school, uint power)
        {
            bool          ret = false;
            CreatureSkill creatureSkill;

            switch (school)
            {
            case MagicSchool.CreatureEnchantment:
                creatureSkill = GetCreatureSkill(Skill.CreatureEnchantment);
                break;

            case MagicSchool.WarMagic:
                creatureSkill = GetCreatureSkill(Skill.WarMagic);
                break;

            case MagicSchool.ItemEnchantment:
                creatureSkill = GetCreatureSkill(Skill.ItemEnchantment);
                break;

            case MagicSchool.LifeMagic:
                creatureSkill = GetCreatureSkill(Skill.LifeMagic);
                break;

            case MagicSchool.VoidMagic:
                creatureSkill = GetCreatureSkill(Skill.VoidMagic);
                break;

            default:
                // Undefined magic school, something bad happened.
                Debug.Assert((int)school > 5 || school <= 0, "Undefined magic school?");
                return(false);
            }

            if (creatureSkill.AdvancementClass >= SkillAdvancementClass.Trained && creatureSkill.Current >= (power - magicSkillCheckMargin))
            {
                ret = true;
            }

            return(ret);
        }
Exemple #23
0
    //释放魔法
    public void CastMagic(Hero _hero, Magic _magic)
    {
        //判定魔法学派,根据英雄的相应学派等级释放不同效果
        MagicSchool school     = _magic.school;
        int         magicLevel = SkillManager.LevelOfSkill(_hero, SchoolToSkill(school));

        MagicType type = _magic.type;

        if (type == MagicType.Battle)
        {
        }

        //print(SchoolToSkill(school));

        //魔法消耗
        int manaLevel = Mathf.Min(_magic.mana.Length - 1, magicLevel);
        int mana      = _magic.mana[manaLevel];

        if (_hero.mana < mana)
        {
            print("魔法值不足!");
            return;
        }

        _hero.mana -= mana;
        print("当前法力:" + _hero.mana);

        //目标类型:无目标直接释放
        //有目标,则选择目标
        int targetType = Mathf.Min(_magic.targetType.Length - 1, magicLevel);
        int effect     = Mathf.Min(_magic.effects.Length - 1, magicLevel);

        if (_magic.targetType[targetType] == MagicTargetType.Null)
        {
            _magic.effects[effect].originPlayer = _hero.player;
            _magic.effects[effect].Invoke();
        }
    }
Exemple #24
0
 public void Deserialize(JSONObject obj)
 {
     mName    = obj.GetString("name");
     mSchool  = (MagicSchool)obj.GetNumber("school");
     mClasses = new List <SpellAttribute>();
     foreach (var value in obj.GetArray("classes"))
     {
         SpellAttribute tempAttribute = new SpellAttribute();
         tempAttribute.attribute      = Attribute.Class;
         tempAttribute.attributeValue = (int)value.Obj.GetNumber("class");
         tempAttribute.rank           = (int)value.Obj.GetNumber("rank");
         mClasses.Add(tempAttribute);
     }
     mDomains = new List <SpellAttribute>();
     foreach (var value in obj.GetArray("domains"))
     {
         SpellAttribute tempAttribute = new SpellAttribute();
         tempAttribute.attribute      = Attribute.Domain;
         tempAttribute.attributeValue = (int)value.Obj.GetNumber("domain");
         tempAttribute.rank           = (int)value.Obj.GetNumber("rank");
         mClasses.Add(tempAttribute);
     }
 }
 public MagicEffectData(string Tag = null)
     : base(Tag)
 {
     MagicEffectFlags                = new MagicEffectFlags();
     BaseCost                        = new Single();
     AssociatedItem                  = new FormID();
     MagicSchool                     = new MagicSchool();
     ResistanceType                  = new ActorValues();
     Unknown                         = new UInt16();
     Unused                          = new byte[2];
     Light                           = new FormID();
     ProjectileSpeed                 = new Single();
     EffectShader                    = new FormID();
     ObjectDisplayShader             = new FormID();
     EffectSound                     = new FormID();
     BoltSound                       = new FormID();
     HitSound                        = new FormID();
     AreaSound                       = new FormID();
     ConstantEffectEnchantmentFactor = new Single();
     ConstantEffectBarterFactor      = new Single();
     Archetype                       = new MagicEffectArchetype();
     ActorValue                      = new ActorValues();
 }
Exemple #26
0
    //点击魔法学派按钮
    public void Button_School(string _school)
    {
        MagicSchool school = (MagicSchool)System.Enum.Parse(typeof(MagicSchool), _school);

        //高亮所选学派
        foreach (MagicSchool item in dic_school_button.Keys)
        {
            Vector3 pos = dic_school_button[item].transform.localPosition;
            if (item == school)
            {
                pos.x = buttons_school_x.x;
                dic_school_button[item].enabled = false;
            }
            else
            {
                pos.x = buttons_school_x.y;
                dic_school_button[item].enabled = true;
            }

            dic_school_button[item].transform.localPosition = pos;
        }

        ShowMagics(school, currentMagicType);
    }
Exemple #27
0
        public void InitializeEffectDamage(Solver solver, MagicSchool magicSchool, float minDamage, float maxDamage)
        {
            Stats baseStats = solver.BaseStats;
            MageTalents mageTalents = solver.MageTalents;
            CalculationOptionsMage calculationOptions = solver.CalculationOptions;

            //AreaEffect = areaEffect;
            //BaseCost = cost - (int)baseStats.SpellsManaReduction;
            MagicSchool = magicSchool;
            BaseMinDamage = minDamage;
            BaseMaxDamage = maxDamage;
            //BasePeriodicDamage = periodicDamage;
            //SpellDamageCoefficient = spellDamageCoefficient;
            //Ticks = 1;
            //CastProcs = 0;
            //CastProcs2 = 0;
            //DotDamageCoefficient = dotDamageCoefficient;
            //DotDuration = dotDuration;

            BaseDirectDamageModifier = 1.0f;
            BaseDotDamageModifier = 1.0f;
            BaseCostModifier = 1.0f;

            //Range = range;
            
            /*float baseCostAmplifier = calculationOptions.EffectCostMultiplier;
            baseCostAmplifier *= (1.0f - 0.01f * mageTalents.Precision);
            if (mageTalents.FrostChanneling > 0) baseCostAmplifier *= (1.0f - 0.01f - 0.03f * mageTalents.FrostChanneling);
            if (MagicSchool == MagicSchool.Arcane) baseCostAmplifier *= (1.0f - 0.01f * mageTalents.ArcaneFocus);
            BaseCostAmplifier = baseCostAmplifier;*/

            /*float baseInterruptProtection = baseStats.InterruptProtection;
            if (MagicSchool == MagicSchool.Fire || MagicSchool == MagicSchool.FrostFire)
            {
                baseInterruptProtection += 0.35f * mageTalents.BurningSoul;
                AffectedByFlameCap = true;
            }
            BaseInterruptProtection = baseInterruptProtection;*/

            float realResistance;
            switch (MagicSchool)
            {
                case MagicSchool.Arcane:
                    BaseSpellModifier = solver.BaseArcaneSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseArcaneAdditiveSpellModifier;
                    BaseCritRate = solver.BaseArcaneCritRate;
                    CritBonus = solver.BaseArcaneCritBonus;
                    HitRate = solver.BaseArcaneHitRate;
                    ThreatMultiplier = solver.ArcaneThreatMultiplier;
                    realResistance = calculationOptions.ArcaneResist;
                    break;
                case MagicSchool.Fire:
                    BaseSpellModifier = solver.BaseFireSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseFireAdditiveSpellModifier;
                    BaseCritRate = solver.BaseFireCritRate;
                    CritBonus = solver.BaseFireCritBonus;
                    HitRate = solver.BaseFireHitRate;
                    ThreatMultiplier = solver.FireThreatMultiplier;
                    realResistance = calculationOptions.FireResist;
                    BaseDotDamageModifier = 1.0f + solver.FlashburnBonus;
                    break;
                case MagicSchool.FrostFire:
                    BaseSpellModifier = solver.BaseFrostFireSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseFrostFireAdditiveSpellModifier;
                    BaseCritRate = solver.BaseFrostFireCritRate;
                    CritBonus = solver.BaseFrostFireCritBonus;
                    HitRate = solver.BaseFrostFireHitRate;
                    ThreatMultiplier = solver.FrostFireThreatMultiplier;
                    if (calculationOptions.FireResist == -1)
                    {
                        realResistance = calculationOptions.FrostResist;
                    }
                    else if (calculationOptions.FrostResist == -1)
                    {
                        realResistance = calculationOptions.FireResist;
                    }
                    else
                    {
                        realResistance = Math.Min(calculationOptions.FireResist, calculationOptions.FrostResist);
                    }
                    BaseDotDamageModifier = 1.0f + solver.FlashburnBonus;
                    break;
                case MagicSchool.Frost:
                    BaseSpellModifier = solver.BaseFrostSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseFrostAdditiveSpellModifier;
                    BaseCritRate = solver.BaseFrostCritRate;
                    CritBonus = solver.BaseFrostCritBonus;
                    HitRate = solver.BaseFrostHitRate;
                    ThreatMultiplier = solver.FrostThreatMultiplier;
                    realResistance = calculationOptions.FrostResist;
                    break;
                case MagicSchool.Nature:
                    BaseSpellModifier = solver.BaseNatureSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseNatureAdditiveSpellModifier;
                    BaseCritRate = solver.BaseNatureCritRate;
                    CritBonus = solver.BaseNatureCritBonus;
                    HitRate = solver.BaseNatureHitRate;
                    ThreatMultiplier = solver.NatureThreatMultiplier;
                    realResistance = calculationOptions.NatureResist;
                    break;
                case MagicSchool.Shadow:
                    BaseSpellModifier = solver.BaseShadowSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseShadowAdditiveSpellModifier;
                    BaseCritRate = solver.BaseShadowCritRate;
                    CritBonus = solver.BaseShadowCritBonus;
                    HitRate = solver.BaseShadowHitRate;
                    ThreatMultiplier = solver.ShadowThreatMultiplier;
                    realResistance = calculationOptions.ShadowResist;
                    break;
                case MagicSchool.Holy:
                default:
                    BaseSpellModifier = solver.BaseHolySpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseHolyAdditiveSpellModifier;
                    BaseCritRate = solver.BaseHolyCritRate;
                    CritBonus = solver.BaseHolyCritBonus;
                    HitRate = solver.BaseHolyHitRate;
                    ThreatMultiplier = solver.HolyThreatMultiplier;
                    realResistance = calculationOptions.HolyResist;
                    break;
            }

            NonHSCritRate = baseStats.SpellCritOnTarget;
            IgniteFactor = 0;

            int playerLevel = calculationOptions.PlayerLevel;
            int targetLevel = calculationOptions.TargetLevel;

            /*if (areaEffect)
            {
                targetLevel = calculationOptions.AoeTargetLevel;
                float hitRate = ((targetLevel <= playerLevel + 2) ? (0.96f - (targetLevel - playerLevel) * 0.01f) : (0.94f - (targetLevel - playerLevel - 2) * 0.11f)) + calculations.BaseSpellHit;
                if (MagicSchool == MagicSchool.Arcane) hitRate += 0.01f * mageTalents.ArcaneFocus;
                if (hitRate > Spell.MaxHitRate) hitRate = Spell.MaxHitRate;
                HitRate = hitRate;
            }
            else
            {
                targetLevel = calculationOptions.TargetLevel;
            }*/

            RealResistance = realResistance;
            PartialResistFactor = (realResistance == -1) ? 0 : (1 - StatConversion.GetAverageResistance(playerLevel, targetLevel, realResistance, baseStats.SpellPenetration));
        }
Exemple #28
0
        public void InitializeDamage(Solver solver, bool areaEffect, int range, MagicSchool magicSchool, int cost, float minDamage, float maxDamage, float spellDamageCoefficient, float periodicDamage, float dotDamageCoefficient, float hitProcs, float castProcs, float dotDuration)
        {
            Stats baseStats = solver.BaseStats;
            MageTalents mageTalents = solver.MageTalents;
            CalculationOptionsMage calculationOptions = solver.CalculationOptions;

            AreaEffect = areaEffect;
            AreaEffectDot = areaEffect;
            MaximumAOETargets = 10;
            int manaReduction = (int)baseStats.SpellsManaCostReduction;
            if (manaReduction == 405)
            {
                // Shard of Woe hax
                manaReduction = 205;
            }
            BaseCost = Math.Max(cost - manaReduction, 0);
            MagicSchool = magicSchool;
            Ticks = hitProcs;
            CastProcs = castProcs;
            CastProcs2 = castProcs;
            BaseMinDamage = minDamage;
            BaseMaxDamage = maxDamage;
            SpellDamageCoefficient = spellDamageCoefficient;
            BasePeriodicDamage = periodicDamage;
            DotDamageCoefficient = dotDamageCoefficient;
            DotDuration = dotDuration;

            BaseDirectDamageModifier = 1.0f;
            BaseDotDamageModifier = 1.0f;
            BaseCostModifier = 1.0f;

            float baseCostAmplifier = calculationOptions.EffectCostMultiplier;
            if (mageTalents.EnduringWinter > 0)
            {
                BaseCostModifier -= 0.03f * mageTalents.EnduringWinter + (mageTalents.EnduringWinter == 3 ? 0.01f : 0.00f);
            }
            BaseCostAmplifier = baseCostAmplifier;

            float baseInterruptProtection = baseStats.InterruptProtection;
            baseInterruptProtection += 0.23f * mageTalents.BurningSoul + (mageTalents.BurningSoul == 3 ? 0.01f : 0.0f);
            BaseInterruptProtection = baseInterruptProtection;

            float realResistance;
            switch (MagicSchool)
            {
                case MagicSchool.Arcane:
                    BaseSpellModifier = solver.BaseArcaneSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseArcaneAdditiveSpellModifier;
                    BaseCritRate = solver.BaseArcaneCritRate;
                    CritBonus = solver.BaseArcaneCritBonus;
                    HitRate = solver.BaseArcaneHitRate;
                    ThreatMultiplier = solver.ArcaneThreatMultiplier;
                    realResistance = calculationOptions.ArcaneResist;
                    IgniteFactor = 0;
                    break;
                case MagicSchool.Fire:
                    BaseSpellModifier = solver.BaseFireSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseFireAdditiveSpellModifier;
                    BaseCritRate = solver.BaseFireCritRate;
                    CritBonus = solver.BaseFireCritBonus;
                    HitRate = solver.BaseFireHitRate;
                    ThreatMultiplier = solver.FireThreatMultiplier;
                    realResistance = calculationOptions.FireResist;
                    IgniteFactor = solver.IgniteFactor;
                    break;
                case MagicSchool.FrostFire:
                    BaseSpellModifier = solver.BaseFrostFireSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseFrostFireAdditiveSpellModifier;
                    BaseCritRate = solver.BaseFrostFireCritRate;
                    CritBonus = solver.BaseFrostFireCritBonus;
                    HitRate = solver.BaseFrostFireHitRate;
                    ThreatMultiplier = solver.FrostFireThreatMultiplier;
                    if (calculationOptions.FireResist == -1)
                    {
                        realResistance = calculationOptions.FrostResist;
                    }
                    else if (calculationOptions.FrostResist == -1)
                    {
                        realResistance = calculationOptions.FireResist;
                    }
                    else
                    {
                        realResistance = Math.Min(calculationOptions.FireResist, calculationOptions.FrostResist);
                    }
                    Range = range;
                    IgniteFactor = solver.IgniteFactor;
                    break;
                case MagicSchool.Frost:
                    BaseSpellModifier = solver.BaseFrostSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseFrostAdditiveSpellModifier;
                    BaseCritRate = solver.BaseFrostCritRate;
                    CritBonus = solver.BaseFrostCritBonus;
                    HitRate = solver.BaseFrostHitRate;
                    ThreatMultiplier = solver.FrostThreatMultiplier;
                    realResistance = calculationOptions.FrostResist;
                    IgniteFactor = 0;
                    break;
                case MagicSchool.Nature:
                    BaseSpellModifier = solver.BaseNatureSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseNatureAdditiveSpellModifier;
                    BaseCritRate = solver.BaseNatureCritRate;
                    CritBonus = solver.BaseNatureCritBonus;
                    HitRate = solver.BaseNatureHitRate;
                    ThreatMultiplier = solver.NatureThreatMultiplier;
                    realResistance = calculationOptions.NatureResist;
                    Range = range;
                    IgniteFactor = 0;
                    break;
                case MagicSchool.Shadow:
                    BaseSpellModifier = solver.BaseShadowSpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseShadowAdditiveSpellModifier;
                    BaseCritRate = solver.BaseShadowCritRate;
                    CritBonus = solver.BaseShadowCritBonus;
                    HitRate = solver.BaseShadowHitRate;
                    ThreatMultiplier = solver.ShadowThreatMultiplier;
                    realResistance = calculationOptions.ShadowResist;
                    Range = range;
                    IgniteFactor = 0;
                    break;
                case MagicSchool.Holy:
                default:
                    BaseSpellModifier = solver.BaseHolySpellModifier;
                    BaseAdditiveSpellModifier = solver.BaseHolyAdditiveSpellModifier;
                    BaseCritRate = solver.BaseHolyCritRate;
                    CritBonus = solver.BaseHolyCritBonus;
                    HitRate = solver.BaseHolyHitRate;
                    ThreatMultiplier = solver.HolyThreatMultiplier;
                    realResistance = calculationOptions.HolyResist;
                    Range = range;
                    IgniteFactor = 0;
                    break;
            }

            NonHSCritRate = baseStats.SpellCritOnTarget;

            int playerLevel = calculationOptions.PlayerLevel;
            int targetLevel;

            if (areaEffect)
            {
                targetLevel = calculationOptions.AoeTargetLevel;
                float hitRate = ((targetLevel <= playerLevel + 2) ? (0.96f - (targetLevel - playerLevel) * 0.01f) : (0.94f - (targetLevel - playerLevel - 2) * 0.11f)) + solver.BaseSpellHit;
                if (hitRate > Spell.MaxHitRate) hitRate = Spell.MaxHitRate;
                HitRate = hitRate;
            }
            else
            {
                targetLevel = calculationOptions.TargetLevel;
            }

            RealResistance = realResistance;
            PartialResistFactor = (realResistance == -1) ? 0 : (1 - StatConversion.GetAverageResistance(playerLevel, targetLevel, realResistance, baseStats.SpellPenetration));
        }
Exemple #29
0
 public void InitializeDamage(Solver solver, bool areaEffect, int range, MagicSchool magicSchool, SpellData spellData, float hitProcs, float castProcs, float dotDuration)
 {
     InitializeDamage(solver, areaEffect, range, magicSchool, spellData.Cost, spellData.MinDamage, spellData.MaxDamage, spellData.SpellDamageCoefficient, spellData.PeriodicDamage, spellData.DotDamageCoefficient, hitProcs, castProcs, dotDuration);
 }
Exemple #30
0
 public void InitializeScaledDamage(Solver solver, bool areaEffect, int range, MagicSchool magicSchool, float baseCost, float baseAverage, float spread, float basePeriodic, float spellDamageCoefficient, float dotDamageCoefficient, float hitProcs, float castProcs, float dotDuration)
 {
     var options = solver.CalculationOptions;
     var average = options.GetSpellValue(baseAverage);
     //var halfSpread = average * spread / 2f;
     var halfSpread = (float)Math.Floor(average * spread / 2f);
     average = (float)Math.Round(average);
     InitializeDamage(solver, areaEffect, range, magicSchool, (int)(baseCost * BaseMana[options.PlayerLevel]), average - halfSpread, average + halfSpread, spellDamageCoefficient, options.GetSpellValue(basePeriodic), dotDamageCoefficient, hitProcs, castProcs, dotDuration);
 }
Exemple #31
0
 public void Initialize(Solver solver, MagicSchool school, int minDamage, int maxDamage, float speed)
 {
     Name = "Wand";
     // Tested: affected by Arcane Instability, affected by Chaotic meta, not affected by Arcane Power
     InitializeEffectDamage(solver, school, minDamage, maxDamage);
     Range = 30;
     this.speed = speed;
     CritBonus = 1.5f * 1.33f * (1 + solver.BaseStats.BonusSpellCritDamageMultiplier);
     BaseSpellModifier = (1 + solver.BaseStats.BonusDamageMultiplier);
     switch (school)
     {
         case MagicSchool.Arcane:
             BaseSpellModifier *= (1 + solver.BaseStats.BonusArcaneDamageMultiplier);
             break;
         case MagicSchool.Fire:
             BaseSpellModifier *= (1 + solver.BaseStats.BonusFireDamageMultiplier);
             break;
         case MagicSchool.Frost:
             BaseSpellModifier *= (1 + solver.BaseStats.BonusFrostDamageMultiplier);
             break;
         case MagicSchool.Nature:
             BaseSpellModifier *= (1 + solver.BaseStats.BonusNatureDamageMultiplier);
             break;
         case MagicSchool.Shadow:
             BaseSpellModifier *= (1 + solver.BaseStats.BonusShadowDamageMultiplier);
             break;
     }
 }
 public MagicEffectData(MagicEffectFlags MagicEffectFlags, Single BaseCost, FormID AssociatedItem, MagicSchool MagicSchool, ActorValues ResistanceType, UInt16 Unknown, Byte[] Unused, FormID Light, Single ProjectileSpeed, FormID EffectShader, FormID ObjectDisplayShader, FormID EffectSound, FormID BoltSound, FormID HitSound, FormID AreaSound, Single ConstantEffectEnchantmentFactor, Single ConstantEffectBarterFactor, MagicEffectArchetype Archetype, ActorValues ActorValue)
 {
     this.MagicEffectFlags                = MagicEffectFlags;
     this.BaseCost                        = BaseCost;
     this.AssociatedItem                  = AssociatedItem;
     this.MagicSchool                     = MagicSchool;
     this.ResistanceType                  = ResistanceType;
     this.Unknown                         = Unknown;
     this.Unused                          = Unused;
     this.Light                           = Light;
     this.ProjectileSpeed                 = ProjectileSpeed;
     this.EffectShader                    = EffectShader;
     this.ObjectDisplayShader             = ObjectDisplayShader;
     this.EffectSound                     = EffectSound;
     this.BoltSound                       = BoltSound;
     this.HitSound                        = HitSound;
     this.AreaSound                       = AreaSound;
     this.ConstantEffectEnchantmentFactor = ConstantEffectEnchantmentFactor;
     this.ConstantEffectBarterFactor      = ConstantEffectBarterFactor;
     this.Archetype                       = Archetype;
     this.ActorValue                      = ActorValue;
 }
Exemple #33
0
        public MagicTab(MagicSchool school)
        {
            TabButton.LibraryFile = LibraryFile.Interface;
            TabButton.Hint        = school.ToString();
            Border = true;

            switch (school)
            {
            case MagicSchool.Passive:
                TabButton.Index = 54;
                break;

            case MagicSchool.WeaponSkills:
                TabButton.Index = 65;
                break;

            case MagicSchool.Neutral:
                TabButton.Index = 64;
                break;

            case MagicSchool.Fire:
                TabButton.Index = 56;
                break;

            case MagicSchool.Ice:
                TabButton.Index = 57;
                break;

            case MagicSchool.Lightning:
                TabButton.Index = 58;
                break;

            case MagicSchool.Wind:
                TabButton.Index = 59;
                break;

            case MagicSchool.Holy:
                TabButton.Index = 61;
                break;

            case MagicSchool.Dark:
                TabButton.Index = 62;
                break;

            case MagicSchool.Phantom:
                TabButton.Index = 60;
                break;

            case MagicSchool.Combat:
                TabButton.Index = 66;
                break;

            case MagicSchool.Assassination:
                TabButton.Index = 67;
                break;

            case MagicSchool.None:
                TabButton.Index = 55;
                break;
            }

            ScrollBar = new DXVScrollBar
            {
                Parent = this,
            };
            ScrollBar.ValueChanged += (o, e) => UpdateLocations();
        }
Exemple #34
0
 protected MinionSpell(String name, int rank, int level, float baseMinDamage, float baseMaxDamage, float baseTickDamage, float baseCost, Stats stats, Character character, CalculationOptionsWarlock options, Color color, MagicSchool magicSchool, SpellTree spellTree)
     : base(name, rank, level, baseMinDamage, baseMaxDamage, baseTickDamage, baseCost, stats, character, options, color, magicSchool, spellTree)
 {
     
 }
Exemple #35
0
 //魔法学派对应技能
 Skill SchoolToSkill(MagicSchool _school)
 {
     //如果是全派系通用魔法,则遍历所有派系选出等级最高的
     //if(_school == MagicSchool.All)
     return(SkillManager.GetSkill("Magic_" + _school.ToString()));
 }
        private void MoveToNextSchool()
        {
            var index = Array.IndexOf(AvailableSchools, _currentSchool) + 1;
            if (index >= AvailableSchools.Length)
                index = 0;

            _currentSchool = AvailableSchools[index];
            if (_favouriteSchools.Contains(_currentSchool) && _player != null && IsSoundOn)
                _player.Play();

            RaisePropertyChanged("MainTimerColor");
        }
Exemple #37
0
 protected MinionSpell(String name, Stats stats, Character character, IEnumerable<SpellRank> spellRanks, Color color, MagicSchool magicSchool, SpellTree spellTree)
     : base(name, stats, character, spellRanks, color, magicSchool, spellTree)
 {
     
 }
 public void btnReset_Click()
 {
     //_stopwatch.Reset();
     //_stopwatch.Start();
     _lastTime = _stopwatch.Elapsed;
     _time = TimeSpan.FromSeconds(COE_DURATION);
     _currentSchool = MagicSchool.Fire;
     _timer.Stop();
     _timer.Start();
     RaisePropertyChanged("MainTimer");
     RaisePropertyChanged("MainTimerColor");
 }
Exemple #39
0
 // Kitchen Sink Constructor
 public Spell(
     CharacterCalculationsWarlock mommy,
     MagicSchool magicSchool,
     SpellTree spellTree,
     float percentBaseMana,
     float baseCastTime,
     float cooldown,
     float recastPeriod,
     bool canMiss,
     float avgDirectDamage,
     float directCoefficient,
     float addedDirectMultiplier,
     float baseTickDamage,
     float numTicks,
     float tickCoefficient,
     float addedTickMultiplier,
     bool canTickCrit,
     float bonusCritChance,
     float bonusCritMultiplier)
 {
     Mommy = mommy;
     MagicSchool = magicSchool;
     MySpellTree = spellTree;
     ManaCost = mommy.BaseMana * percentBaseMana;
     BaseCastTime = baseCastTime;
     BaseDamage = avgDirectDamage;
     Cooldown = cooldown;
     RecastPeriod = recastPeriod;
     CanMiss = canMiss;
     DirectCoefficient = directCoefficient;
     BaseTickDamage = baseTickDamage;
     NumTicks = numTicks;
     TickCoefficient = tickCoefficient;
     CanTickCrit = canTickCrit;
     SimulatedStats = new Dictionary<string, SimulatedStat>();
     WarlockTalents talents = mommy.Talents;
     SpellModifiers = new SpellModifiers();
     SpellModifiers.AddMultiplicativeDirectMultiplier(addedDirectMultiplier);
     SpellModifiers.AddMultiplicativeTickMultiplier(addedTickMultiplier);
     SpellModifiers.AddCritChance(bonusCritChance);
     SpellModifiers.AddCritBonusMultiplier(bonusCritMultiplier);
 }
Exemple #40
0
 //DoT Constructor
 public Spell(
     CharacterCalculationsWarlock mommy,
     MagicSchool magicSchool,
     SpellTree spellTree,
     float percentBaseMana,
     float baseCastTime,
     float cooldown,
     float recastPeriod,
     float baseTickDamage,
     float numTicks,
     float tickCoefficient,
     float addedTickMultiplier,
     bool canTickCrit,
     float bonusCritChance,
     float bonusCritMultiplier)
     : this(
         mommy,
         magicSchool,
         spellTree,
         percentBaseMana,
         baseCastTime,
         cooldown,
         recastPeriod,
         true,
         0f, // direct avg damage
         0f, // direct coefficient
         0f, // addedDirectMultiplier
         baseTickDamage,
         numTicks,
         tickCoefficient,
         addedTickMultiplier,
         canTickCrit,
         bonusCritChance,
         bonusCritMultiplier) { }
Exemple #41
0
 public void InitializeDamage(Solver solver, bool areaEffect, int range, MagicSchool magicSchool, SpellData spellData) 
 {
     InitializeDamage(solver, areaEffect, range, magicSchool, spellData, 1, 1, 0);
 }
Exemple #42
0
 public WandTemplate(Solver solver, MagicSchool school, int minDamage, int maxDamage, float speed)
 {
     Initialize(solver, school, minDamage, maxDamage, speed);
 }
Exemple #43
0
 protected MinionSpell(String name, int rank, int level, float baseMinDamage, float baseMaxDamage, float baseTickDamage, float baseCost, Stats stats, Character character, CalculationOptionsWarlock options, Color color, MagicSchool magicSchool, SpellTree spellTree)
     : base(name, rank, level, baseMinDamage, baseMaxDamage, baseTickDamage, baseCost, stats, character, options, color, magicSchool, spellTree)
 {
 }
Exemple #44
0
 //Non-Damage Constructor
 public Spell(
     CharacterCalculationsWarlock mommy,
     MagicSchool magicSchool,
     SpellTree spellTree,
     float percentBaseMana,
     float baseCastTime,
     float cooldown,
     float recastPeriod,
     bool canMiss)
     : this(
         mommy,
         magicSchool,
         spellTree,
         percentBaseMana,
         baseCastTime,
         cooldown,
         recastPeriod,
         canMiss,
         0f, // avgDirectDamage,
         0f, // directCoefficient,
         0f, // addedDirectMultiplier,
         0f, // baseTickDamage,
         0f, // numTicks,
         0f, // tickCoefficient,
         0f, // addedTickMultiplier,
         false, // canTickCrit,
         0f, // bonusCritChance,
         0f) { } // bonusCritMultiplier,