parameters: (converter_group, line, container_obj_ref, diff=None)
return_statement: return patches
docstring: Creates a patch for the Move ability of a line.
  
          :param converter_group: Group that gets the patch.
          :type converter_group: ...dataformat.converter_object.ConverterObjectGroup
          :param line: Unit/Building line that has the ability.
          :type line: ...dataformat.converter_object.ConverterObjectGroup
          :param container_obj_ref: Reference of the raw API object the patch is nested in.
          :type container_obj_ref: str
          :param diff: A diff between two ConvertObject instances.
          :type diff: ...dataformat.converter_object.ConverterObject
          :returns: The forward references for the generated patches.
          :rtype: list
docstring_summary: Creates a patch for the Move ability of a line.
docstring_tokens: Creates a patch for the Move ability of a line .
function: def move_ability(converter_group, line, container_obj_ref, diff=None):
          """
          Creates a patch for the Move ability of a line.
  
          :param converter_group: Group that gets the patch.
          :type converter_group: ...dataformat.converter_object.ConverterObjectGroup
          :param line: Unit/Building line that has the ability.
          :type line: ...dataformat.converter_object.ConverterObjectGroup
          :param container_obj_ref: Reference of the raw API object the patch is nested in.
          :type container_obj_ref: str
          :param diff: A diff between two ConvertObject instances.
          :type diff: ...dataformat.converter_object.ConverterObject
          :returns: The forward references for the generated patches.
          :rtype: list
          """
          head_unit_id = line.get_head_unit_id()
          tech_id = converter_group.get_id()
          dataset = line.data
  
          patches = []
  
          name_lookup_dict = internal_name_lookups.get_entity_lookups(dataset.game_version)
          tech_lookup_dict = internal_name_lookups.get_tech_lookups(dataset.game_version)
  
          game_entity_name = name_lookup_dict[head_unit_id][0]
  
          changed = False
          diff_move_animation = diff["move_graphics"]
          diff_comm_sound = diff["command_sound_id"]
          diff_move_speed = diff["speed"]
          if any(not isinstance(value, NoDiffMember) for value in (diff_move_animation,
                                                                   diff_comm_sound,
                                                                   diff_move_speed)):
              changed = True
  
          if changed:
              patch_target_ref = f"{game_entity_name}.Move"
              patch_target_forward_ref = ForwardRef(line, patch_target_ref)
  
              # Wrapper
              wrapper_name = f"Change{game_entity_name}MoveWrapper"
              wrapper_ref = f"{container_obj_ref}.{wrapper_name}"
              wrapper_raw_api_object = RawAPIObject(wrapper_ref,
                                                    wrapper_name,
                                                    dataset.nyan_api_objects)
              wrapper_raw_api_object.add_raw_parent("engine.util.patch.Patch")
  
              if isinstance(line, GenieBuildingLineGroup):
                  # Store building upgrades next to their game entity definition,
                  # not in the Age up techs.
                  wrapper_raw_api_object.set_location("data/game_entity/generic/%s/"
                                                      % (name_lookup_dict[head_unit_id][1]))
                  wrapper_raw_api_object.set_filename(f"{tech_lookup_dict[tech_id][1]}_upgrade")
  
              else:
                  wrapper_raw_api_object.set_location(ForwardRef(converter_group, container_obj_ref))
  
              # Nyan patch
              nyan_patch_name = f"Change{game_entity_name}Move"
              nyan_patch_ref = f"{container_obj_ref}.{wrapper_name}.{nyan_patch_name}"
              nyan_patch_location = ForwardRef(converter_group, wrapper_ref)
              nyan_patch_raw_api_object = RawAPIObject(nyan_patch_ref,
                                                       nyan_patch_name,
                                                       dataset.nyan_api_objects,
                                                       nyan_patch_location)
              nyan_patch_raw_api_object.add_raw_parent("engine.util.patch.NyanPatch")
              nyan_patch_raw_api_object.set_patch_target(patch_target_forward_ref)
  
              if not isinstance(diff_move_animation, NoDiffMember):
                  animations_set = []
                  diff_animation_id = diff_move_animation.get_value()
                  if diff_animation_id > -1:
                      # Patch the new animation in
                      animation_forward_ref = AoCUpgradeAbilitySubprocessor.create_animation(converter_group,
                                                                                             line,
                                                                                             diff_animation_id,
                                                                                             nyan_patch_ref,
                                                                                             "Move",
                                                                                             "move_")
                      animations_set.append(animation_forward_ref)
  
                  nyan_patch_raw_api_object.add_raw_patch_member("animations",
                                                                 animations_set,
                                                                 "engine.ability.property.type.Animated",
                                                                 MemberOperator.ASSIGN)
  
              if not isinstance(diff_comm_sound, NoDiffMember):
                  sounds_set = []
                  diff_comm_sound_id = diff_comm_sound.get_value()
                  if diff_comm_sound_id > -1:
                      # Patch the new sound in
                      sound_forward_ref = AoCUpgradeAbilitySubprocessor.create_sound(converter_group,
                                                                                     diff_comm_sound_id,
                                                                                     nyan_patch_ref,
                                                                                     "Move",
                                                                                     "move_")
                      sounds_set.append(sound_forward_ref)
  
                  nyan_patch_raw_api_object.add_raw_patch_member("sounds",
                                                                 sounds_set,
                                                                 "engine.ability.property.type.CommandSound",
                                                                 MemberOperator.ASSIGN)
  
              if not isinstance(diff_move_speed, NoDiffMember):
                  diff_speed_value = diff_move_speed.get_value()
  
                  nyan_patch_raw_api_object.add_raw_patch_member("speed",
                                                                 diff_speed_value,
                                                                 "engine.ability.type.Move",
                                                                 MemberOperator.ADD)
  
              patch_forward_ref = ForwardRef(converter_group, nyan_patch_ref)
              wrapper_raw_api_object.add_raw_member("patch",
                                                    patch_forward_ref,
                                                    "engine.util.patch.Patch")
  
              converter_group.add_raw_api_object(wrapper_raw_api_object)
              converter_group.add_raw_api_object(nyan_patch_raw_api_object)
  
              wrapper_forward_ref = ForwardRef(converter_group, wrapper_ref)
              patches.append(wrapper_forward_ref)
  
          return patches
function_tokens: def move_ability ( converter_group , line , container_obj_ref , diff = None ) : head_unit_id = line . get_head_unit_id ( ) tech_id = converter_group . get_id ( ) dataset = line . data patches = [ ] name_lookup_dict = internal_name_lookups . get_entity_lookups ( dataset . game_version ) tech_lookup_dict = internal_name_lookups . get_tech_lookups ( dataset . game_version ) game_entity_name = name_lookup_dict [ head_unit_id ] [ 0 ] changed = False diff_move_animation = diff [ "move_graphics" ] diff_comm_sound = diff [ "command_sound_id" ] diff_move_speed = diff [ "speed" ] if any ( not isinstance ( value , NoDiffMember ) for value in ( diff_move_animation , diff_comm_sound , diff_move_speed ) ) : changed = True if changed : patch_target_ref = f"{game_entity_name}.Move" patch_target_forward_ref = ForwardRef ( line , patch_target_ref ) # Wrapper wrapper_name = f"Change{game_entity_name}MoveWrapper" wrapper_ref = f"{container_obj_ref}.{wrapper_name}" wrapper_raw_api_object = RawAPIObject ( wrapper_ref , wrapper_name , dataset . nyan_api_objects ) wrapper_raw_api_object . add_raw_parent ( "engine.util.patch.Patch" ) if isinstance ( line , GenieBuildingLineGroup ) : # Store building upgrades next to their game entity definition, # not in the Age up techs. wrapper_raw_api_object . set_location ( "data/game_entity/generic/%s/" % ( name_lookup_dict [ head_unit_id ] [ 1 ] ) ) wrapper_raw_api_object . set_filename ( f"{tech_lookup_dict[tech_id][1]}_upgrade" ) else : wrapper_raw_api_object . set_location ( ForwardRef ( converter_group , container_obj_ref ) ) # Nyan patch nyan_patch_name = f"Change{game_entity_name}Move" nyan_patch_ref = f"{container_obj_ref}.{wrapper_name}.{nyan_patch_name}" nyan_patch_location = ForwardRef ( converter_group , wrapper_ref ) nyan_patch_raw_api_object = RawAPIObject ( nyan_patch_ref , nyan_patch_name , dataset . nyan_api_objects , nyan_patch_location ) nyan_patch_raw_api_object . add_raw_parent ( "engine.util.patch.NyanPatch" ) nyan_patch_raw_api_object . set_patch_target ( patch_target_forward_ref ) if not isinstance ( diff_move_animation , NoDiffMember ) : animations_set = [ ] diff_animation_id = diff_move_animation . get_value ( ) if diff_animation_id > - 1 : # Patch the new animation in animation_forward_ref = AoCUpgradeAbilitySubprocessor . create_animation ( converter_group , line , diff_animation_id , nyan_patch_ref , "Move" , "move_" ) animations_set . append ( animation_forward_ref ) nyan_patch_raw_api_object . add_raw_patch_member ( "animations" , animations_set , "engine.ability.property.type.Animated" , MemberOperator . ASSIGN ) if not isinstance ( diff_comm_sound , NoDiffMember ) : sounds_set = [ ] diff_comm_sound_id = diff_comm_sound . get_value ( ) if diff_comm_sound_id > - 1 : # Patch the new sound in sound_forward_ref = AoCUpgradeAbilitySubprocessor . create_sound ( converter_group , diff_comm_sound_id , nyan_patch_ref , "Move" , "move_" ) sounds_set . append ( sound_forward_ref ) nyan_patch_raw_api_object . add_raw_patch_member ( "sounds" , sounds_set , "engine.ability.property.type.CommandSound" , MemberOperator . ASSIGN ) if not isinstance ( diff_move_speed , NoDiffMember ) : diff_speed_value = diff_move_speed . get_value ( ) nyan_patch_raw_api_object . add_raw_patch_member ( "speed" , diff_speed_value , "engine.ability.type.Move" , MemberOperator . ADD ) patch_forward_ref = ForwardRef ( converter_group , nyan_patch_ref ) wrapper_raw_api_object . add_raw_member ( "patch" , patch_forward_ref , "engine.util.patch.Patch" ) converter_group . add_raw_api_object ( wrapper_raw_api_object ) converter_group . add_raw_api_object ( nyan_patch_raw_api_object ) wrapper_forward_ref = ForwardRef ( converter_group , wrapper_ref ) patches . append ( wrapper_forward_ref ) return patches