Example #1
0
 public SummonAction(IScope scope, ICost cost, UnitData unit, IScreenEffect screenEffect)
 {
     _scope = scope;
     _cost = cost;
     _unit = unit;
     _screenEffect = screenEffect;
 }
Example #2
0
        // ----- ----- ----- Method ----- ----- -----
        private Province(int no, string name, IList<Surface> flags, UnitData master, bool isNeutral)
        {
            Contract.Requires(no >= 0, "no");
            Contract.Requires(name != null, "name");
            Contract.Requires(flags != null, "flags");

            _no = no;
            _name = name;
            _master = master;
            _flags = flags;
            IsNeutral = isNeutral;
        }
Example #3
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();
        }
Example #4
0
 /// <summary>
 /// マスター有りの勢力
 /// </summary>
 /// <param name="no">勢力No</param>
 /// <param name="name">勢力名</param>
 /// <param name="master">マスター</param>
 public Province(int no, string name, UnitData master)
     : this(no, name, master.Images.Flag, master, false)
 {
 }
Example #5
0
 /// <summary>
 /// ListBoxに張るテキストを得る関数
 /// </summary>
 private string GetText(UnitData u)
 {
     return
         (u.Species == _area.Province.Master.Species ? "(同)" : "")
         + u.Name
         + " (" + u.Cost + "Ley)";
 }
        private static UnitData ReadUnit(IEnumerable<string> charaDirPathes, BinaryReader reader, bool isMaster)
        {
            var unit = new UnitData();
            unit.IsMaster = isMaster; // マスターかどうか
            // ユニット名
            //unsafe {
            //    sbyte* buf = stackalloc sbyte[22];
            //    for (int i = 0; i < 21; i++)
            //        buf[i] = reader.ReadSByte();
            //    buf[21] = 0;
            //    unit.Name = new String(buf);
            //}
            unit.Name = BytesToStr(reader.ReadBytes(21));

            unit.MagicLevel = reader.ReadBytes(6); // 魔法レベル(火~闇)
            unit.Resistivity = new Resistivity(reader.ReadBytes(15));
            unit.IsUnique = (reader.ReadByte() != 0); // 人材ユニットかどうか
            unit.IsVagrant = (reader.ReadByte() == 0); // 放浪ユニットかどうか
            unit.IsSpecial = (reader.ReadUInt16() != 0); // 特殊ユニットかどうか
            unit.Species = (Species)reader.ReadUInt16(); // 種族
            unit.Cost = reader.ReadUInt16(); // 費用
            unit.MoveType = (MoveType)reader.ReadUInt16(); // 移動タイプ
            unit.Mobility = ReadByDecimal(reader.ReadUInt16()); // 移動量

            // ステータス
            unit.HP = reader.ReadUInt16();
            unit.MP = reader.ReadUInt16();
            unit.Atk = reader.ReadUInt16();
            unit.Def = reader.ReadUInt16();
            unit.Tec = reader.ReadUInt16();
            unit.Agi = reader.ReadUInt16();
            unit.Mag = reader.ReadUInt16();
            unit.Res = reader.ReadUInt16();

            unit.Morale = reader.ReadUInt16(); // 士気
            unit.Courage = reader.ReadUInt16(); // 勇猛
            unit.HpHeal = reader.ReadUInt16();
            unit.MpHeal = reader.ReadUInt16();

            unit.SkillIndex = reader.ReadUInt16();
            unit.SkillTimes = reader.ReadUInt16();
            reader.ReadUInt16(); // SKIP				// 不明
            unit.ClassChangeNo = reader.ReadUInt16();
            unit.Exp = reader.ReadUInt16();

            unit.EntryTurn = reader.ReadUInt16(); // 出現ターン
            unit.LimitTurn = reader.ReadUInt16(); // 放浪上限
            unit.HelpID = reader.ReadUInt16();

            // 通常攻撃
            const int MAX_ATTACK = 5;
            var tmpAtkAttr = new AttackType[MAX_ATTACK];
            for (int i = 0; i < MAX_ATTACK; i++)
                tmpAtkAttr[i] = (AttackType)(reader.ReadUInt16() - (UInt16)AttackType.なし);
            var tmpAtkPower = new byte[MAX_ATTACK];
            for (int i = 0; i < MAX_ATTACK; i++)
                tmpAtkPower[i] = (byte)reader.ReadUInt16();
            unit.Attacks = new DefaultAttack[MAX_ATTACK];
            for (int i = 0; i < MAX_ATTACK; i++)
                unit.Attacks[i] = new DefaultAttack(tmpAtkPower[i], tmpAtkAttr[i]);

            // 雇用可能なユニット
            unit.Summon = new int[8];
            for (int i = 0; i < unit.Summon.Count; i++)
                unit.Summon[i] = reader.ReadUInt16();

            for (int i = 0; i < 16; i++) // SKIP
                reader.ReadByte();
            unit.IsTamer = (reader.ReadByte() != 0); // ビーストマスターかどうか

            for (int i = 0; i < 5; i++) // SKIP
                reader.ReadByte();

            var imgUnit = LoadBitmap(charaDirPathes, "Char" + reader.ReadInt32() + ".bmp");
            var imgFace = LoadBitmap(charaDirPathes, "Face" + reader.ReadInt32() + ".bmp");
            var imgFlag = LoadBitmapSet(charaDirPathes, "Flag" + reader.ReadInt32() + ".bmp");

            unit.Images = new UnitImageResources(imgUnit, imgFace, imgFlag);
            // ユニットID
            //unsafe {
            //    sbyte* buf = stackalloc sbyte[22];
            //    for (int i = 0; i < 21; i++)
            //        buf[i] = reader.ReadSByte();
            //    buf[21] = 0;
            //    unit.ID = new String(buf);
            //}
            unit.ID = BytesToStr(reader.ReadBytes(21));
            for (int i = 0; i < 10; i++) // SKIP
                reader.ReadByte();

            unit.IsUndead = (reader.ReadByte() != 0); // アンデットかどうか

            for (int i = 0; i < 128; i++) // SKIP
                reader.ReadByte();
            return unit;
        }