Skip to content
Snippets Groups Projects
idabot.rst 4.95 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Bergström's avatar
    David Bergström committed
    IDABot
    ======
    
    .. class:: library.IDABot
    
       This is the basis of your bot. It contains all available managers and some
       methods to get you started.
    
    
       See :ref:`this page <gettingstarted>` for how to properly
    
    David Bergström's avatar
    David Bergström committed
       inherit from IDABot.
    
       Instances of managers:
    
       .. attribute:: IDABot.base_location_manager
    
          An instance of the class :class:`library.BaseLocationManager`
    
       .. attribute:: IDABot.tech_tree
    
          An instance of the class :class:`library.TechTree`
    
       .. attribute:: IDABot.map_tools
    
          An instance of the class :class:`library.MapTools`
    
       .. attribute:: IDABot.building_placer
    
          An instance of the class :class:`library.BuildingPlacer`
    
    
       Inherited methods:
    
       .. method:: IDABot.on_game_start(self)
    
          This method when Starcraft has stared, when you inherit it you have to
    
          call the parent's on_game_start method in order to make it work (see
    
          :ref:`gettingstarted`).
    
       .. method:: IDABot.on_step(self)
    
          This method is run on every tick of the game, when you inherit it you
          have to call the parent's on_step method in order to make it work (see
          :ref:`gettingstarted`).
    
    
    David Bergström's avatar
    David Bergström committed
       Methods:
    
       .. method:: IDABot.get_all_units(self) -> List[library.Unit]
    
          Retrieves a list of all visible units
    
       .. method:: IDABot.get_my_units(self) -> List[library.Unit]
    
          Retrieves a list of all your visible units
    
       .. method:: IDABot.get_player_race(self) -> library.Race
    
          Returns the players race, useful if you play Race.Random
    
    
       .. method:: IDABot.send_chat(self, message)
    
          Sends the string 'message' to the game chat
    
    
       .. method:: IDABot.has_creep(self, Point2D) -> Boolean
    
    
          Returns if the position has a creep
    
    
       .. method:: IDABot.move_camera(self, Point2DI)
    
    
          Move the camera to the position
    
       .. method:: IDABot.ability_for_upgrade(self, UpgradeID)
    
          Ability that researches this upgrade
    
    
          Example: If we send in UPGRADE_ID.BANSHEECLOAK, it will return
          ABILITY_ID.RESEARCH_BANSHEECLOAKINGFIELD. In this case,
          the unit of scv has the ability for this. You can then use the
          unit.ability(AbilityID) on the scv for creating the upgrade.
    
    
       .. method:: IDABot.upgrade_mineral_cost(self, UpgradeID)
    
          Mineral cost of researching the upgrade
    
       .. method:: IDABot.upgrade_gas_cost(self, UpgradeID)
    
          Vespene/gas cost of researching the upgrade
    
       .. method:: IDABot.upgrade_research_time(self, UpgradeID)
    
          Time in GameLoops to research this upgrade
    
    
       .. method:: IDABot.effect_radius(self, EffectID)
    
          Size of the circle the effect impacts
    
    
    David Bergström's avatar
    David Bergström committed
       Attributes:
    
       .. autoattribute:: minerals
    
       .. autoattribute:: gas
    
       .. autoattribute:: current_supply
    
       .. autoattribute:: max_supply
    
    
       .. autoattribute:: current_frame
    
    
    Debug
    -----
    
    When developing AI-methods or when simply having a problem.
    The debug-methods are a great tool for speeding up the process.
    
       .. method:: IDABot.debug_create_unit(self, UnitTypeID, Point2D, Player Constant, Int)
    
    
          This method creates the nr (INT) of units on the position :class:`library.Point2D`, the unit 
    
          belongs to the Player Constant
    
    
       .. method:: IDABot.debug_kill_unit(self, Unit)
    
    
          Kills the :class:`library.Unit`
    
          Make the entire map visible
    
    
       .. method:: IDABot.debug_fast_build(self)
    
    
          Set the build time in game to 1
    
      
       .. method:: IDABot.debug_enemy_control(self)
    
    
          Gives the player full control over the enemy
    
    
       .. method:: IDABot.debug_fast_build(self)
    
    
          Set the build time in game to 1
    
    
       .. method:: IDABot.debug_ignore_food(self)
    
    
          Ignore food in game
    
    
       .. method:: IDABot.debug_ignore_resource_cost(self)
    
    
          Ignore the resource cost in game. Everything cost 0 resources
    
    
       .. method:: IDABot.debug_give_all_resources(self)
    
    
          Set the mineral and vespene gas to 5000
    
          Give yourself god mode in the game
    
    
       .. method:: IDABot.debug_ignore_mineral(self)
    
    
          Ignore the mineral cost in the game
    
    
       .. method:: IDABot.debug_no_cooldowns(self)
    
    
          Deactivate cooldowns (Basically setting them to 0)
    
    
       .. method:: IDABot.debug_give_all_tech(self)
    
    
          Give yourself all tech
    
    
       .. method:: IDABot.debug_give_all_upgrades(self)
    
    
          Give yourself all upgrades
    
    
       .. method:: IDABot.debug_set_score(self, Float)
    
    
          Set the player score in game
    
    
       .. method:: IDABot.debug_end_game(self, Boolean)
    
          End the game, if the Boolean is True then victory.
          If False, defeat.
    
       .. method:: IDABot.debug_set_energy(self, Float, Unit)
    
    
          Set the amount (Float) of energy to the :class:`library.Unit`
    
          The maximum depends on the unit maxenergy.
          Note: This is not in percent of the unit energy.
          Same goes for life and shields.
    
    
       .. method:: IDABot.debug_set_life(self, Float, Unit)
    
    
          Set the amount (Float) of life to the unit
    
    
       .. method:: IDABot.debug_set_shields(self, Float, Unit)
    
    
          Set the amount (Float) of shield to the unit