예제 #1
0
        /// <summary>
        /// BattleTaskを生成します
        /// </summary>
        /// <returns>生成したタスク</returns>
        private BattleTask creatTask()
        {
            if (!isReady)
            {
                throw new InvalidOperationException("manager hasn't readied yet");
            }

            IActiveSkill skill = ai.decideSkill();

            if (ActiveSkillSupporter.isAffectSkill(skill))
            {
                Extent     extent = ActiveSkillSupporter.searchExtent(skill);
                BattleTask returnTask;
                //効果範囲に応じてタスクを生成
                switch (extent)
                {
                case Extent.SINGLE:
                    IBattleable        target           = ai.decideSingleTarget(skill);
                    List <IBattleable> singleTargetList = new List <IBattleable>()
                    {
                        target
                    };
                    returnTask = new BattleTask(user.getUniqueId(), skill, singleTargetList, battletaskIdCount);
                    break;

                case Extent.AREA:
                    FieldPosition pos = ai.decideAreaTarget(skill);
                    returnTask = new BattleTask(user.getUniqueId(), skill, pos, battletaskIdCount);
                    break;

                case Extent.ALL:
                    List <IBattleable> allTargetList = BattleManager.getInstance().getJoinedBattleCharacter();
                    returnTask = new BattleTask(user.getUniqueId(), skill, allTargetList, battletaskIdCount);
                    break;

                default: throw new NotSupportedException("unkonwn extent");
                }
                battletaskIdCount++;
                return(returnTask);
            }
            else if (skill.getActiveSkillType() == ActiveSkillType.MOVE)
            {
                MoveSkill  moveSkill  = (MoveSkill)skill;
                int        move       = ai.decideMove(moveSkill);
                BattleTask returnTask = new BattleTask(user.getUniqueId(), skill, move, battletaskIdCount);
                battletaskIdCount++;
                return(returnTask);
            }
            throw new InvalidOperationException("unknown skillType");
        }
예제 #2
0
        /// <summary>
        /// skillNodeが選択された時の処理
        /// </summary>
        /// <param name="chosenSkill">選択されたIActiveSkill</param>
        public void skillChose(IActiveSkill chosenSkill)
        {
            this.chosenActiveSkill = chosenSkill;

            if (ActiveSkillSupporter.isAffectSkill(chosenSkill))
            {
                Extent extent = ActiveSkillSupporter.searchExtent(chosenSkill);
                int    range  = ActiveSkillSupporter.searchRange(chosenSkill, player);
                inputTargetList(extent, range);
            }
            else if (chosenSkill.getActiveSkillType() == ActiveSkillType.MOVE)
            {
                int move = ActiveSkillSupporter.searchMove(chosenSkill, player);
                inputMoveAreaList(move);
            }
            else
            {
                throw new NotSupportedException("Unkonwn skillType");
            }
        }
예제 #3
0
        public FieldPosition decideAreaTarget(IActiveSkill useSkill)
        {
            if (!ActiveSkillSupporter.isAffectSkill(useSkill))
            {
                throw new ArgumentException("the skill " + useSkill + " dosen't has to decide target.");
            }
            if (ActiveSkillSupporter.searchExtent(useSkill) != Extent.AREA)
            {
                throw new ArgumentException("the skill " + useSkill + " isn't a skill for single");
            }

            if (useSkill.isFriendly())
            {
                return(this.decideAreaFriendlyTarget(useSkill));
            }
            else
            {
                return(this.decideHostileAreaTarget(useSkill));
            }
        }
예제 #4
0
        /// <summary>
        /// スキルの対象を決定します
        /// </summary>
        /// <returns>対象のリスト</returns>
        /// <param name="useSkill">使用するスキル</param>
        public IBattleable decideSingleTarget(IActiveSkill useSkill)
        {
            if (!ActiveSkillSupporter.isAffectSkill(useSkill))
            {
                throw new ArgumentException("the skill " + useSkill + " dosen't has to decide target.");
            }
            if (ActiveSkillSupporter.searchExtent(useSkill) != Extent.SINGLE)
            {
                throw new ArgumentException("the skill " + useSkill + " isn't a skill for single");
            }

            if (useSkill.isFriendly())
            {
                return(this.decideFriendlySingleTarget(useSkill));
            }
            else
            {
                return(this.decideHostileSingleTarget(useSkill));
            }
        }