parameters: (converter_group, effect)
return_statement: return patches
docstring: Creates the patches for upgrading entities in a line.
docstring_summary: Creates the patches for upgrading entities in a line.
docstring_tokens: Creates the patches for upgrading entities in a line .
function: def upgrade_unit_effect(converter_group, effect):
          """
          Creates the patches for upgrading entities in a line.
          """
          patches = []
          tech_id = converter_group.get_id()
          dataset = converter_group.data
  
          tech_lookup_dict = internal_name_lookups.get_tech_lookups(dataset.game_version)
  
          head_unit_id = effect["attr_a"].get_value()
          upgrade_target_id = effect["attr_b"].get_value()
  
          if head_unit_id not in dataset.unit_ref.keys() or\
                  upgrade_target_id not in dataset.unit_ref.keys():
              # Skip annexes or transform units
              return patches
  
          line = dataset.unit_ref[head_unit_id]
          upgrade_target_pos = line.get_unit_position(upgrade_target_id)
          upgrade_source_pos = upgrade_target_pos - 1
  
          upgrade_source = line.line[upgrade_source_pos]
          upgrade_target = line.line[upgrade_target_pos]
          tech_name = tech_lookup_dict[tech_id][0]
  
          diff = upgrade_source.diff(upgrade_target)
  
          patches.extend(AoCUpgradeAbilitySubprocessor.death_ability(converter_group, line, tech_name, diff))
          patches.extend(AoCUpgradeAbilitySubprocessor.despawn_ability(converter_group, line, tech_name, diff))
          patches.extend(AoCUpgradeAbilitySubprocessor.idle_ability(converter_group, line, tech_name, diff))
          patches.extend(AoCUpgradeAbilitySubprocessor.live_ability(converter_group, line, tech_name, diff))
          patches.extend(AoCUpgradeAbilitySubprocessor.los_ability(converter_group, line, tech_name, diff))
          patches.extend(AoCUpgradeAbilitySubprocessor.named_ability(converter_group, line, tech_name, diff))
          # patches.extend(AoCUpgradeAbilitySubprocessor.resistance_ability(converter_group, line, tech_name, diff))
          patches.extend(AoCUpgradeAbilitySubprocessor.selectable_ability(converter_group, line, tech_name, diff))
          patches.extend(AoCUpgradeAbilitySubprocessor.turn_ability(converter_group, line, tech_name, diff))
  
          if line.is_projectile_shooter():
              patches.extend(RoRUpgradeAbilitySubprocessor.shoot_projectile_ability(converter_group, line,
                                                                                    tech_name,
                                                                                    7, diff))
  
          elif line.is_melee() or line.is_ranged():
              if line.has_command(7):
                  # Attack
                  patches.extend(AoCUpgradeAbilitySubprocessor.apply_discrete_effect_ability(converter_group,
                                                                                             line, tech_name,
                                                                                             7,
                                                                                             line.is_ranged(),
                                                                                             diff))
  
          if isinstance(line, GenieUnitLineGroup):
              patches.extend(AoCUpgradeAbilitySubprocessor.move_ability(converter_group, line,
                                                                        tech_name, diff))
  
          if isinstance(line, GenieBuildingLineGroup):
              # TODO: Damage percentages change
              # patches.extend(AoCUpgradeAbilitySubprocessor.attribute_change_tracker_ability(converter_group, line,
              #                                                                               tech_name, diff))
              pass
  
          return patches
function_tokens: def upgrade_unit_effect ( converter_group , effect ) : patches = [ ] tech_id = converter_group . get_id ( ) dataset = converter_group . data tech_lookup_dict = internal_name_lookups . get_tech_lookups ( dataset . game_version ) head_unit_id = effect [ "attr_a" ] . get_value ( ) upgrade_target_id = effect [ "attr_b" ] . get_value ( ) if head_unit_id not in dataset . unit_ref . keys ( ) or upgrade_target_id not in dataset . unit_ref . keys ( ) : # Skip annexes or transform units return patches line = dataset . unit_ref [ head_unit_id ] upgrade_target_pos = line . get_unit_position ( upgrade_target_id ) upgrade_source_pos = upgrade_target_pos - 1 upgrade_source = line . line [ upgrade_source_pos ] upgrade_target = line . line [ upgrade_target_pos ] tech_name = tech_lookup_dict [ tech_id ] [ 0 ] diff = upgrade_source . diff ( upgrade_target ) patches . extend ( AoCUpgradeAbilitySubprocessor . death_ability ( converter_group , line , tech_name , diff ) ) patches . extend ( AoCUpgradeAbilitySubprocessor . despawn_ability ( converter_group , line , tech_name , diff ) ) patches . extend ( AoCUpgradeAbilitySubprocessor . idle_ability ( converter_group , line , tech_name , diff ) ) patches . extend ( AoCUpgradeAbilitySubprocessor . live_ability ( converter_group , line , tech_name , diff ) ) patches . extend ( AoCUpgradeAbilitySubprocessor . los_ability ( converter_group , line , tech_name , diff ) ) patches . extend ( AoCUpgradeAbilitySubprocessor . named_ability ( converter_group , line , tech_name , diff ) ) # patches.extend(AoCUpgradeAbilitySubprocessor.resistance_ability(converter_group, line, tech_name, diff)) patches . extend ( AoCUpgradeAbilitySubprocessor . selectable_ability ( converter_group , line , tech_name , diff ) ) patches . extend ( AoCUpgradeAbilitySubprocessor . turn_ability ( converter_group , line , tech_name , diff ) ) if line . is_projectile_shooter ( ) : patches . extend ( RoRUpgradeAbilitySubprocessor . shoot_projectile_ability ( converter_group , line , tech_name , 7 , diff ) ) elif line . is_melee ( ) or line . is_ranged ( ) : if line . has_command ( 7 ) : # Attack patches . extend ( AoCUpgradeAbilitySubprocessor . apply_discrete_effect_ability ( converter_group , line , tech_name , 7 , line . is_ranged ( ) , diff ) ) if isinstance ( line , GenieUnitLineGroup ) : patches . extend ( AoCUpgradeAbilitySubprocessor . move_ability ( converter_group , line , tech_name , diff ) ) if isinstance ( line , GenieBuildingLineGroup ) : # TODO: Damage percentages change # patches.extend(AoCUpgradeAbilitySubprocessor.attribute_change_tracker_ability(converter_group, line, #                                                                               tech_name, diff)) pass return patches