Ejemplo n.º 1
0
    public TargetType targetType; //目标类型

    #endregion Fields

    #region Methods

    public static List<Command> GetAvailableCommands(BattleObject bo)
    {
        List<Command> availableCommands = new List<Command>();
        //检查攻击类技能
        if(!bo.disableAttackCommand)
        {
            if(bo.GetBattleType() != BattleType.Magical && bo.GetWeapon() > 1000)
            {
                WeaponData weaponData = DataManager.Instance.GetItemDataSet().GetWeaponData(bo.GetWeapon());
                if(weaponData.skill1ID > 0)
                    availableCommands.Add(new CommandUseWeaponSkill(weaponData, weaponData.skill1ID));
                if(weaponData.skill2ID > 0)
                    availableCommands.Add(new CommandUseWeaponSkill(weaponData, weaponData.skill2ID));
                if(weaponData.skill3ID > 0)
                    availableCommands.Add(new CommandUseWeaponSkill(weaponData, weaponData.skill3ID));
            }
            if(bo.GetBattleType() != BattleType.Physical)
            {
                foreach(int magicID in bo.GetMagicList())
                {
                    MagicData magicData = DataManager.Instance.GetItemDataSet().GetMagicData(magicID);
                    availableCommands.Add(new CommandUseMagicSkill(magicData, magicData.skillID));
                }
            }
        }
        //检查防御技能
        if(!bo.disableDefenceCommand)
        {
            availableCommands.Add(new CommandBlock());
            availableCommands.Add(new CommandEvade());
            availableCommands.Add(new CommandGuard());
        }
        //检查物品
        if(!bo.disableItemCommand)
        {
            if(bo.GetBattleType() != BattleType.Magical)
            {
                foreach(int weaponID in bo.GetWeaponList())
                {
                    if(weaponID != bo.GetWeapon())
                        availableCommands.Add(new CommandSwitchWeapon(weaponID));
                }
            }
            foreach(var item in bo.GetItemList())
            {
                availableCommands.Add(new CommandUseItem(item.Key, item.Value));
            }
        }
        //检查策略
        if(!bo.disableStrategyCommand)
        {
            availableCommands.Add(new CommandNone());
            availableCommands.Add(new CommandEscape());
        }

        foreach(Command command in availableCommands)
        {
            command.source = bo;
        }

        return availableCommands;
    }