parameters: (line, position=0)
return_statement: return ability_forward_ref
docstring: Adds a Projectile ability to projectiles in a line. Which projectile should
          be added is determined by the 'position' argument.
  
          :param line: Unit/Building line that gets the ability.
          :type line: ...dataformat.converter_object.ConverterObjectGroup
          :param position: When 0, gives the first projectile its ability. When 1, the second...
          :type position: int
          :returns: The forward reference for the ability.
          :rtype: ...dataformat.forward_ref.ForwardRef
docstring_summary: Adds a Projectile ability to projectiles in a line. Which projectile should
          be added is determined by the 'position' argument.
docstring_tokens: Adds a Projectile ability to projectiles in a line . Which projectile should be added is determined by the position argument .
function: def projectile_ability(line, position=0):
          """
          Adds a Projectile ability to projectiles in a line. Which projectile should
          be added is determined by the 'position' argument.
  
          :param line: Unit/Building line that gets the ability.
          :type line: ...dataformat.converter_object.ConverterObjectGroup
          :param position: When 0, gives the first projectile its ability. When 1, the second...
          :type position: int
          :returns: The forward reference for the ability.
          :rtype: ...dataformat.forward_ref.ForwardRef
          """
          current_unit = line.get_head_unit()
          current_unit_id = line.get_head_unit_id()
          dataset = line.data
  
          name_lookup_dict = internal_name_lookups.get_entity_lookups(dataset.game_version)
  
          game_entity_name = name_lookup_dict[current_unit_id][0]
  
          # First projectile is mandatory
          obj_ref = f"{game_entity_name}.ShootProjectile.Projectile{str(position)}"
          ability_ref = "%s.ShootProjectile.Projectile%s.Projectile" % (game_entity_name,
                                                                        str(position))
          ability_raw_api_object = RawAPIObject(ability_ref,
                                                "Projectile",
                                                dataset.nyan_api_objects)
          ability_raw_api_object.add_raw_parent("engine.ability.type.Projectile")
          ability_location = ForwardRef(line, obj_ref)
          ability_raw_api_object.set_location(ability_location)
  
          # Arc
          if position == 0:
              projectile_id = current_unit["attack_projectile_primary_unit_id"].get_value()
  
          else:
              raise Exception("Invalid position")
  
          projectile = dataset.genie_units[projectile_id]
          arc = degrees(projectile["projectile_arc"].get_value())
          ability_raw_api_object.add_raw_member("arc",
                                                arc,
                                                "engine.ability.type.Projectile")
  
          # Accuracy
          accuracy_name = "%s.ShootProjectile.Projectile%s.Projectile.Accuracy"\
                          % (game_entity_name, str(position))
          accuracy_raw_api_object = RawAPIObject(accuracy_name, "Accuracy", dataset.nyan_api_objects)
          accuracy_raw_api_object.add_raw_parent("engine.util.accuracy.Accuracy")
          accuracy_location = ForwardRef(line, ability_ref)
          accuracy_raw_api_object.set_location(accuracy_location)
  
          accuracy_value = current_unit["accuracy"].get_value()
          accuracy_raw_api_object.add_raw_member("accuracy",
                                                 accuracy_value,
                                                 "engine.util.accuracy.Accuracy")
  
          accuracy_dispersion = 0
          accuracy_raw_api_object.add_raw_member("accuracy_dispersion",
                                                 accuracy_dispersion,
                                                 "engine.util.accuracy.Accuracy")
          dropoff_type = dataset.nyan_api_objects["engine.util.dropoff_type.type.NoDropoff"]
          accuracy_raw_api_object.add_raw_member("dispersion_dropoff",
                                                 dropoff_type,
                                                 "engine.util.accuracy.Accuracy")
  
          allowed_types = [
              dataset.pregen_nyan_objects["util.game_entity_type.types.Building"].get_nyan_object(),
              dataset.pregen_nyan_objects["util.game_entity_type.types.Unit"].get_nyan_object()
          ]
          accuracy_raw_api_object.add_raw_member("target_types",
                                                 allowed_types,
                                                 "engine.util.accuracy.Accuracy")
          accuracy_raw_api_object.add_raw_member("blacklisted_entities",
                                                 [],
                                                 "engine.util.accuracy.Accuracy")
  
          line.add_raw_api_object(accuracy_raw_api_object)
          accuracy_forward_ref = ForwardRef(line, accuracy_name)
          ability_raw_api_object.add_raw_member("accuracy",
                                                [accuracy_forward_ref],
                                                "engine.ability.type.Projectile")
  
          # Target mode
          target_mode = dataset.nyan_api_objects["engine.util.target_mode.type.CurrentPosition"]
          ability_raw_api_object.add_raw_member("target_mode",
                                                target_mode,
                                                "engine.ability.type.Projectile")
  
          # Ingore types; buildings are ignored unless targeted
          ignore_forward_refs = [
              dataset.pregen_nyan_objects["util.game_entity_type.types.Building"].get_nyan_object()
          ]
          ability_raw_api_object.add_raw_member("ignored_types",
                                                ignore_forward_refs,
                                                "engine.ability.type.Projectile")
          ability_raw_api_object.add_raw_member("unignored_entities",
                                                [],
                                                "engine.ability.type.Projectile")
  
          line.add_raw_api_object(ability_raw_api_object)
  
          ability_forward_ref = ForwardRef(line, ability_raw_api_object.get_id())
  
          return ability_forward_ref
function_tokens: def projectile_ability ( line , position = 0 ) : current_unit = line . get_head_unit ( ) current_unit_id = line . get_head_unit_id ( ) dataset = line . data name_lookup_dict = internal_name_lookups . get_entity_lookups ( dataset . game_version ) game_entity_name = name_lookup_dict [ current_unit_id ] [ 0 ] # First projectile is mandatory obj_ref = f"{game_entity_name}.ShootProjectile.Projectile{str(position)}" ability_ref = "%s.ShootProjectile.Projectile%s.Projectile" % ( game_entity_name , str ( position ) ) ability_raw_api_object = RawAPIObject ( ability_ref , "Projectile" , dataset . nyan_api_objects ) ability_raw_api_object . add_raw_parent ( "engine.ability.type.Projectile" ) ability_location = ForwardRef ( line , obj_ref ) ability_raw_api_object . set_location ( ability_location ) # Arc if position == 0 : projectile_id = current_unit [ "attack_projectile_primary_unit_id" ] . get_value ( ) else : raise Exception ( "Invalid position" ) projectile = dataset . genie_units [ projectile_id ] arc = degrees ( projectile [ "projectile_arc" ] . get_value ( ) ) ability_raw_api_object . add_raw_member ( "arc" , arc , "engine.ability.type.Projectile" ) # Accuracy accuracy_name = "%s.ShootProjectile.Projectile%s.Projectile.Accuracy" % ( game_entity_name , str ( position ) ) accuracy_raw_api_object = RawAPIObject ( accuracy_name , "Accuracy" , dataset . nyan_api_objects ) accuracy_raw_api_object . add_raw_parent ( "engine.util.accuracy.Accuracy" ) accuracy_location = ForwardRef ( line , ability_ref ) accuracy_raw_api_object . set_location ( accuracy_location ) accuracy_value = current_unit [ "accuracy" ] . get_value ( ) accuracy_raw_api_object . add_raw_member ( "accuracy" , accuracy_value , "engine.util.accuracy.Accuracy" ) accuracy_dispersion = 0 accuracy_raw_api_object . add_raw_member ( "accuracy_dispersion" , accuracy_dispersion , "engine.util.accuracy.Accuracy" ) dropoff_type = dataset . nyan_api_objects [ "engine.util.dropoff_type.type.NoDropoff" ] accuracy_raw_api_object . add_raw_member ( "dispersion_dropoff" , dropoff_type , "engine.util.accuracy.Accuracy" ) allowed_types = [ dataset . pregen_nyan_objects [ "util.game_entity_type.types.Building" ] . get_nyan_object ( ) , dataset . pregen_nyan_objects [ "util.game_entity_type.types.Unit" ] . get_nyan_object ( ) ] accuracy_raw_api_object . add_raw_member ( "target_types" , allowed_types , "engine.util.accuracy.Accuracy" ) accuracy_raw_api_object . add_raw_member ( "blacklisted_entities" , [ ] , "engine.util.accuracy.Accuracy" ) line . add_raw_api_object ( accuracy_raw_api_object ) accuracy_forward_ref = ForwardRef ( line , accuracy_name ) ability_raw_api_object . add_raw_member ( "accuracy" , [ accuracy_forward_ref ] , "engine.ability.type.Projectile" ) # Target mode target_mode = dataset . nyan_api_objects [ "engine.util.target_mode.type.CurrentPosition" ] ability_raw_api_object . add_raw_member ( "target_mode" , target_mode , "engine.ability.type.Projectile" ) # Ingore types; buildings are ignored unless targeted ignore_forward_refs = [ dataset . pregen_nyan_objects [ "util.game_entity_type.types.Building" ] . get_nyan_object ( ) ] ability_raw_api_object . add_raw_member ( "ignored_types" , ignore_forward_refs , "engine.ability.type.Projectile" ) ability_raw_api_object . add_raw_member ( "unignored_entities" , [ ] , "engine.ability.type.Projectile" ) line . add_raw_api_object ( ability_raw_api_object ) ability_forward_ref = ForwardRef ( line , ability_raw_api_object . get_id ( ) ) return ability_forward_ref