Beispiel #1
0
        public static SavedSpell ToSavedSpell(Spell spell)
        {
            var result = new SavedSpell
            {
                spellName    = spell.spellName,
                spellEffects = spell.spellEffects
                               .Select(x => new SavedSpellEffectContainer(x.spellEffect.effectName, x.position))
                               .ToList(),
                spellTarget         = spell.spellTarget,
                spellTargetPosition = spell.spellTargetPosition,
                createCost          = spell.createCost,
                manaCost            = spell.manaCost,
                travelCost          = spell.travelCost,
                maxRadius           = spell.maxRadius,
                maxTargets          = spell.maxTargets
            };

            return(result);
        }
Beispiel #2
0
        public static Spell FromSavedSpell(SavedSpell spell, IEnumerable <SpellEffect> spellEffects)
        {
            var effects = spellEffects.ToDictionary(x => x.effectName);

            return(new Spell
            {
                spellName = spell.spellName,
                spellEffects = spell.spellEffects.Select(x => new SpellEffectContainer
                {
                    spellEffect = effects[x.item1],
                    position = x.item2
                }).ToList(),
                spellTarget = spell.spellTarget,
                spellTargetPosition = spell.spellTargetPosition,
                createCost = spell.createCost,
                manaCost = spell.manaCost,
                travelCost = 10, //spell.travelCost,
                maxRadius = spell.maxRadius,
                maxTargets = 10  //spell.maxTargets
            });
        }