private static IList<WarMagicData> CreateAbnormalConditionMagic(MagicData magic, bool isChipEffect, IAbnormalCondition cond, TargetType targetType)
        {
            var name = magic.Name;
            var description = magic.Description;
            var cores = magic.Cores;
            var magicDatas = new List<WarMagicData>(cores.Length);
            foreach (var core in cores)
            {
                // 行為の範囲や対象を設定する
                IScope scope;
                if (core.Area != 0)
                    scope = new DefaultScope(core.Range, core.Area, targetType);
                else
                    scope = new WholeScope(targetType);

                // 画面効果を設定する
                var screenEffect = CreateScreenEffect(magic, isChipEffect);

                // 消費MPの設定
                var consumption = new MPCost(core.MPCost);

                // 行為の設定
                var action = new GiveAbnormalConditionAction(scope, consumption, screenEffect, cond);

                // 魔法データを作成する
                var magicData = new WarMagicData(name, description, action, core.MPCost, core.Area, core.Range);
                magicDatas.Add(magicData);
            }
            return magicDatas;
        }
        private static IList<WarMagicData> CreateSummonMagic(MagicData magic, IList<UnitData> unitDatas, string id)
        {
            var name = magic.Name;
            var description = magic.Description;

            var cores = magic.Cores;
            var magicDatas = new List<WarMagicData>(cores.Length);
            cores.ForEach((core, i) => {
                // 行為の範囲や対象を設定する
                var scope = new DefaultScope(core.Range, core.Area, TargetType.NONE);

                // 消費MPの設定
                var consumption = new MPCost(core.MPCost);

                // 画面効果を設定する
                var screenEffect = CreateScreenEffect(magic, true);

                // 行為を設定する
                var unitData = unitDatas.FirstOrDefault(unit_ => unit_.ID == id + (i + 1));
                var action = new SummonAction(scope, consumption, unitData, screenEffect);

                // 魔法データを作成する
                var magicData = new WarMagicData(name, description, action, core.MPCost, core.Area, core.Range);
                magicDatas.Add(magicData);
            });
            return magicDatas;
        }
        private static IScreenEffect CreateScreenEffect(MagicData magic, bool isChipEffect)
        {
            IScreenEffect screenEffect;

            var path = Path.Combine(Path.Combine(Global.ScenarioDir, "Picture"), magic.AnimationFileName);
            if (isChipEffect)
            {
                // TODO: エフェクトローダーの作成
                var surfaces = WarGlobal.BmpManager.GetSurfaces(path, 32, 32,
                    path_ => BitmapUtil.Load(path_, Color.Black));
                screenEffect = new ChipFrameAnimation(surfaces);
            }
            else
            {
                // TODO: エフェクトローダーの作成
                var surfaces = WarGlobal.BmpManager.GetSurfaces(path, 128, 128);
                screenEffect = new ScreenFrameAnimation(surfaces);
            }
            return screenEffect;
        }
        private static IList<WarMagicData> CreateMagic(MagicData magic, AttackType type, bool isChipEffect,
            Func<IScope, MagicCore, AttackType, IScreenEffect, IBattleAction> creator, TargetType targetType)
        {
            var name = magic.Name;
            var description = magic.Description;

            var cores = magic.Cores;
            var magicDatas = new List<WarMagicData>(cores.Length);
            foreach (var core in cores)
            {
                // 行為の範囲や対象を設定する
                IScope scope;
                if (core.Area != 0)
                    scope = new DefaultScope(core.Range, core.Area, targetType);
                else
                    scope = new WholeScope(targetType);

                // 画面効果を設定する
                var screenEffect = CreateScreenEffect(magic, isChipEffect);

                // 行為を設定する
                var action = creator(scope, core, type, screenEffect);

                // 魔法データを作成する
                var magicData = new WarMagicData(name, description, action, core.MPCost, core.Area, core.Range);
                magicDatas.Add(magicData);
            }
            return magicDatas;
        }
 public MagicDictionary(MagicData[,][] magicTable)
 {
     this.table = magicTable;
 }
 public static MagicData[,][] ReadMagicTable(string scenarioDirPath)
 {
     var magics = Load(scenarioDirPath);
     var magicTable = new MagicData[6, 6][];
     for(int i = 0; i < 6; i++)
     {
         int j = 0;
         // ×
         {
             magicTable[i, j++] = new MagicData[0];
         }
         // D
         {
             var list = new List<MagicData>();
             int d = 0;
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             magicTable[i, j++] = list.ToArray();
         }
         // C
         {
             var list = new List<MagicData>();
             int d = 0;
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             magicTable[i, j++] = list.ToArray();
         }
         // B
         {
             var list = new List<MagicData>();
             int d = 0;
             list.Add(magics[i * 8 + d++].Clone(3));
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             magicTable[i, j++] = list.ToArray();
         }
         // A
         {
             var list = new List<MagicData>();
             int d = 0;
             list.Add(magics[i * 8 + d++].Clone(3));
             list.Add(magics[i * 8 + d++].Clone(3));
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             magicTable[i, j++] = list.ToArray();
         }
         // S
         {
             var list = new List<MagicData>();
             int d = 0;
             list.Add(magics[i * 8 + d++].Clone(3));
             list.Add(magics[i * 8 + d++].Clone(3));
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(2));
             list.Add(magics[i * 8 + d++].Clone(1));
             list.Add(magics[i * 8 + d++].Clone(1));
             magicTable[i, j++] = list.ToArray();
         }
     }
     return magicTable;
 }