コード例 #1
0
        public BattleCommand GetNextAction(Player[] party, Enemy[] allies, ElementType[] fieldEffect)
        {
            if (pressTheAdvantage.CanUse(fieldEffect))
            {
                var target = new Target { TheTarget = BehaviorHelpers.GetStrongestTarget(party), TargetType = TargetTypes.Single };

                return CreateBattleCommand(target, pressTheAdvantage, CommandType.Ability);
            }

            if ((me.CurrentHP / (decimal)me.MaxHP) <= .5m && solarBeam.CanUse(fieldEffect))
            {
                var target = new Target { TheTarget = BehaviorHelpers.GetWeakestTarget(party), TargetType = TargetTypes.Single };

                return CreateBattleCommand(target, solarBeam, CommandType.Ability);
            }

            if (party.All(p => !p.IsDead) && cleave.CanUse(fieldEffect))
            {
                var target = new Target { TargetType = TargetTypes.All };

                return CreateBattleCommand(target, cleave, CommandType.Ability);
            }

            if (sliceAndDice.CanUse(fieldEffect))
            {
                var target = new Target { TheTarget = BehaviorHelpers.GetRandomTarget(party), TargetType = TargetTypes.Single };

                return CreateBattleCommand(target, sliceAndDice, CommandType.Ability);
            }

            return CreateBattleCommand(new Target { TheTarget = BehaviorHelpers.GetRandomTarget(party), TargetType = TargetTypes.Single },
                                       Ability.ATTACK,
                                       CommandType.Attack);
        }
コード例 #2
0
        public Player Read()
        {
            var p = new Player();

            int version = reader.ReadLine().ToInt();

            switch (version)
            {
                case 1:
                    p.Name = reader.ReadLine();
                    p.MaxHP = reader.ReadLine().ToInt();
                    p.CurrentHP = p.MaxHP;
                    p.Level = reader.ReadLine().ToInt();
                    p.Exp = reader.ReadLine().ToInt();
                    p.Class = reader.ReadLine();
                    p.Speed = reader.ReadLine().ToInt();
                    p.Strength = reader.ReadLine().ToInt();
                    p.Will = reader.ReadLine().ToInt();
                    p.Endurance = reader.ReadLine().ToInt();

                    int abilityCount = reader.ReadLine().ToInt();

                    for (int i = 0; i < abilityCount; i++)
                    {
                        int abilityId = reader.ReadLine().ToInt();
                        p.AllAbilities[i] = AbilityManager.Instance.GetAbility(abilityId);
                    }

                    int equippedAbilityCount = reader.ReadLine().ToInt();

                    for (int i = 0; i < equippedAbilityCount; i++)
                    {
                        int abilityId = reader.ReadLine().ToInt();
                        p.EquippedAbilities[i] = AbilityManager.Instance.GetAbility(abilityId);
                    }

                    int equippedFinisherCount = reader.ReadLine().ToInt();

                    for (int i = 0; i < equippedFinisherCount; i++)
                    {
                        int abilityId = reader.ReadLine().ToInt();
                        p.EquippedFinishers[i] = AbilityManager.Instance.GetAbility(abilityId);
                    }

                    int weaponId = reader.ReadLine().ToInt();

                    p.Weapon = WeaponManager.Instance.GetWeapon(weaponId);

                    break;
                default:
                    break;
            }

            return p;
        }
コード例 #3
0
        protected override void OnPostDialog()
        {
            var golem = new Player("Rocky", 25);

            golem.Class = "Elemental";
            golem.Level = 1;
            golem.Exp = 0;

            golem.Speed = 2;
            golem.Strength = 8;
            golem.Will = 3;
            golem.Endurance = 8;

            golem.Weapon = WeaponManager.Instance.GetWeapon(2);

            GameStateManager.Instance.GameData.Party[1] = golem;
        }
コード例 #4
0
        protected override void OnPostDialog()
        {
            var ghost = new Player("", 20);

            ghost.Class = "Sorcerer";
            ghost.Level = 1;
            ghost.Exp = 0;

            ghost.Speed = 6;
            ghost.Strength = 2;
            ghost.Will = 8;
            ghost.Endurance = 5;

            ghost.Weapon = WeaponManager.Instance.GetWeapon(3);

            GameStateManager.Instance.GameData.Party[2] = ghost;
        }
コード例 #5
0
 public PlayerSerializer(Player player, StreamWriter writer)
 {
     this.player = player;
     this.writer = writer;
 }