public PhaseCreator(Area battleArea, Province friendProvince, Action battleFinish)
 {
     _result = BattleResult.None;
     _battleArea = battleArea;
     _friendProvince = friendProvince;
     _battleFinish = battleFinish;
 }
 public WarInitializer(IList<UnitData> unitDatas,
     Area area, IList<Tuple<int, IList<Unit>, Area>> conquerInfo,
     PhaseCreator phaseCreator, string gamepath)
 {
     _units = unitDatas;
     _area = area;
     _conquerInfo = conquerInfo;
     _conquerInfo.OrderBy(conquer => conquer.Item1);
     _phaseCreator = phaseCreator;
     _gamePath = gamepath;
 }
Exemple #3
0
        private Area CreateArea(AreaData data, IList<Province> provinces)
        {
            Area area = new Area(data);
            // 勢力の設定
            var provNo = _root.SelectedScenario.AreaOwner[data.No - 1];
            switch (provNo)
            {
            case -1:
                break;
            case 0:
                // 中立
                area.Province = provinces.Single(p => p.No == provNo);
                break;
            default:
                // 通常
                area.Province = provinces.Single(p => p.No == provNo);
                break;
            }
            // 固有ユニットのセット
            var locs = _root.SelectedScenario.Locates;
            var units = _root.SelectedGame.Units;
            var locates = from l in locs
                          where l.AreaNo == area.No
                          join unit in units on l.UnitID equals unit.ID
                          let rank = (UnitRank)l.Rank
                          select new Unit(unit, rank);
            area.Units.AddRange(locates);
            while (area.Units.Count > 20) area.Units.RemoveAt(area.Units.Count - 1);
            // 街、道路、城壁の値をセット
            switch (provNo)
            {
            case -1:
            case 0:
                area.NumCity100 = area.MaxCity * 10;
                area.NumRoad100 = area.MaxRoad * 10;
                area.NumWall100 = area.MaxWall * data.DefautlWallRate;
                break;
            default:
                area.NumCity100 = area.MaxCity / 6 * 100;
                area.NumRoad100 = area.MaxRoad / 6 * 100;
                area.NumWall100 = area.MaxWall * (data.DefautlWallRate + 40);
                // マスターのいる拠点だったばあい
                if (area.Units.Any(u => u.ID == area.Province.Master.ID))
                {
                    area.NumCity100 *= 2;
                    area.NumRoad100 *= 2;
                    area.NumWall100 = area.MaxWall * 100;
                }
                break;
            }

            return area;
        }
        // ----- ----- ----- ----- ----- CTOR ----- ----- ----- ----- -----
        public ProvinceInfo(Province prov, IList<Area> areas, ReignManager manager)
        {
            Contract.Requires(prov != null, "prov");
            Contract.Requires(areas != null, "areas");

            _prov = prov;
            foreach (var area in areas)
            {
                _nArea++;
                _income += area.Income;
                foreach (var unit in area.Units)
                {
                    if (unit.IsMaster)
                        _area = area;
                    else if (unit.IsUnique)
                        _nUnique++;
                    _power += unit.Potential;
                }
            }
            _league = manager.League[_prov.No, manager.ActingProv.No];
        }
Exemple #5
0
        /// <summary>
        /// アプリケーションのメイン エントリ ポイントです。
        /// </summary>
        public static void Main2()
        {
            // アプリケーションの初期設定
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);

            var scenarioDir = GetScenarioDir();
            Global.ScenarioDir = scenarioDir;
            var unitDataes = UnitDataLoader.LoadList(new[] {
                Path.Combine(scenarioDir, "DefChar"),
                Path.Combine(scenarioDir, "Element")
            });
            var conquerArea1 = new Area(new AreaData(23));
            var conquerArea2 = new Area(new AreaData(25));
            var conquerList = new List<Tuple<int, IList<Unit>, Area>>();
            conquerList.Add(new Tuple<int, IList<Unit>, Area>(2, new Unit[] { new Unit(unitDataes[0]), new Unit(unitDataes[50]) }, conquerArea1));
            conquerList.Add(new Tuple<int, IList<Unit>, Area>(1, new Unit[] { new Unit(unitDataes[60]), new Unit(unitDataes[55]) }, conquerArea2));

            var battleAreaData = new AreaData(24);
            var battleArea = new Area(battleAreaData);
            battleArea.Units.Add(new Unit(unitDataes[10]));
            battleArea.Units.Add(new Unit(unitDataes[70]));
            battleArea.Units.Add(new Unit(unitDataes[30]));
            battleArea.Units.Add(new Unit(unitDataes[80]));

            var freMaster = new UnitData();
            var eneMaster = new UnitData();

            //コンパイルエラーがでるので、コメント中
            //Province friPro = new Province(10, "TestFriendProvince", fresurface);
            //Province enePro = new Province(11, "TestEnemyProvince", enesurface);
            //area.Province = enePro;

            var phaseCreator = new AutoDeployPhaseCreator(battleArea, null, () => Environment.Exit(0));
            new WarInitializer(unitDataes, battleArea, conquerList, phaseCreator, scenarioDir).Initialize();
        }
 public WarUnit Create(Unit unit, WarSide side, Area area)
 {
     _commands[3] = _skillCommands[unit.SkillIndex];
     var states = GetCommandStateList(_commands);
     return new WarUnit(unit, side, states[0], area);
 }
 /// <summary>
 /// 指定したエリアを中立で埋める
 /// </summary>
 private void FillNeutral(Area area)
 {
     area.SetRandomNeutrals(Level, Callable, UnitsData);
 }
Exemple #8
0
 public WarUnit(Unit unit, WarSide warSide, CommandState initState, Area area)
 {
     _unit = unit;
     // ステータスの生成
     CreateStatus();
     // コマンド状態の初期化
     _initCommandState = _commandState = initState;
     _visible = true;
     _unit = unit;
     unit.Acted = true;
     _magicLevels = new ListIndexer<AttackType, byte>(unit.MagicLevel, i => (int)i - (int)AttackType.火);
     _side = warSide;
     _conditions = new ConditionSet(this);
     _area = area;
 }
 public AutoDeployPhaseCreator(Area battleArea, Province friendProvince, Action battleFinish)
     : base(battleArea, friendProvince, battleFinish)
 {
 }