Esempio n. 1
0
        public static Spell FromSpellData(SpellData data)
        {
            Spell spell = new Spell();

            spell.name = data.Name;

            foreach (string s in data.AllowedClasses)
                spell.allowedClasses.Add(s.ToLower());

            foreach (string s in data.AttributeRequirements.Keys)
                spell.attributeRequirements.Add(
                    s.ToLower(), 
                    data.AttributeRequirements[s]);

            foreach (string s in data.SpellPrerequisites)
                spell.SpellPrerequisites.Add(s);

            spell.levelRequirement = data.LevelRequirement;
            spell.spellType = data.SpellType;
            spell.activationCost = data.ActivationCost;

            foreach (string s in data.Effects)
                spell.Effects.Add(s);

            return spell;
        }
        public void FillSpellData()
        {
            SpellData data = new SpellData()
            {
                Name = "Spark Jolt",
                SpellPrerequisites    = new string[0],
                SpellType             = SpellType.Activated,
                LevelRequirement      = 1,
                ActivationCost        = 8,
                AllowedClasses        = new string[] { "Wizard" },
                AttributeRequirements = new Dictionary <string, int>()
                {
                    { "Magic", 10 }
                },
                AreaOfEffect  = 32,
                AngleOfEffect = MathHelper.TwoPi,
                CastTime      = 0,
                Duration      = 0,
                CoolDown      = 2,
                Range         = 128,
            };

            BaseEffectData effect = (new DamageEffectData
            {
                Name = "Spark Jolt",
                TargetType = TargetType.Enemy,
                AttackType = AttackType.Health,
                DamageType = DamageType.Air,
                DieType = DieType.D6,
                NumberOfDice = 3,
                Modifier = 2
            });

            data.Effects.Add(effect);

            spellData.Add("Spark Jolt", data);

            data = new SpellData()
            {
                Name = "Mend",
                SpellPrerequisites    = new string[0],
                SpellType             = SpellType.Activated,
                LevelRequirement      = 1,
                ActivationCost        = 6,
                AllowedClasses        = new string[] { "Priest" },
                AttributeRequirements = new Dictionary <string, int>()
                {
                    { "Magic", 10 }
                },
                Range         = 0,
                AreaOfEffect  = 0,
                AngleOfEffect = 0,
                CastTime      = 0,
                CoolDown      = 2
            };

            BaseEffectData healEffect = (new HealEffectData
            {
                Name = "Mend",
                TargetType = TargetType.Self,
                HealType = HealType.Health,
                DieType = DieType.D8,
                NumberOfDice = 2,
                Modifier = 2
            });

            data.Effects.Add(healEffect);
            spellData.Add("Mend", data);
        }