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;
        }
        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;
        }
        public static List<IBattleCommand> Load(IList<Skill> skills)
        {
            var results = new List<IBattleCommand>(skills.Count) {
                new DisableCommand("特技", "なし", Properties.Resources.w_skill),
            };

            foreach (var skill in skills)
            {
                IScreenEffect screenEffect = null;
                string path = null;
                foreach(var dir in Global.CharDirs)
                {
                    path = Path.Combine(dir, skill.Name + ".bmp");
                    if (File.Exists(path))
                        break;
                }
                var surfaces = WarGlobal.BmpManager.GetSurfaces(path, skill.SideSize, skill.SideSize,
                    fpath => BitmapUtil.Load(fpath, Color.Black),
                    (bmp, w, h) => bmp.SplitToBitmaps(w, h, skill.ImageCount));
                var maxTimes = 1;
                var targetType = TargetType.ENEMY;
                var createFunc = DefaultCreator;

                switch (skill.ScopeType)
                {
                case ScopeType.Arrow:
                    screenEffect = new ArrowAnimation(surfaces);
                    maxTimes = 3;
                    break;
                case ScopeType.Breath:
                    screenEffect = new ChipFrameAnimation(surfaces);
                    maxTimes = 3;
                    break;
                case ScopeType.Heal:
                    screenEffect = new ChipFrameAnimation(surfaces);
                    targetType = TargetType.FRIEND;
                    break;
                case ScopeType.Magic:
                    screenEffect = new ChipFrameAnimation(surfaces);
                    break;
                case ScopeType.WallBreak:
                    screenEffect = new ChipFrameAnimation(surfaces);
                    createFunc = WallCrashCreator;
                    break;
                case ScopeType.Unknown:
                    screenEffect = new ChipFrameAnimation(surfaces);
                    break;
                case ScopeType.SixWay:
                    screenEffect = new ChipFrameAnimation(surfaces);
                    break;
                case ScopeType.BlackDragonSword:
                    screenEffect = new ChipFrameAnimation(surfaces);
                    break;
                default:
                    break;
                }

                // 行為の範囲や対象を設定する
                IScope scope;
                if (skill.Range < 0)
                    scope = new StraightScope(skill.Area, targetType);
                else if (skill.Area != 0)
                    scope = new DefaultScope(skill.Range, skill.Area, targetType);
                else
                    scope = new WholeScope(targetType);

                var action = createFunc(scope, skill, maxTimes, screenEffect);
                var command = new SingleActionCommand(skill.Name, skill.Name, Properties.Resources.w_skill, action);

                results.Add(command);
            }

            return results;
        }