Skip to content

Medivac boost isn't a buff #206

Open

Description

@WickedFridge

When trying to check if Medivac could use their boost, I tried checking if the medivac was actually boosted, checking its buffs. I've found the Medivacspeedboost buff in the list, but when a medivac is boosted, it doesn't have any buffs.
my code reads as follow but doesn't work (as medivac.buffs is always empty) :

if (not medivac.has_buff(BuffId.MEDIVACSPEEDBOOST)):
    medivac(AbilityId.EFFECT_MEDIVACIGNITEAFTERBURNERS)

Activity

  1. BurnySc2 commented on Dec 6, 2024

    @BurnySc2
    Owner

    The Unit object don't update themselves. My guess is that you don't refresh the Unit object via

    medivac = self.units(UnitTypeId.MEDIVAC)[0]

    You can verify this by checking if medivac.position is the same - then you are using an outdated Unit object.
    The unit.tag is unique so you can find the medivac in the next frame/iteration (assuming it was not destroyed) via

    python-sc2/sc2/units.py

    Lines 506 to 518 in aa247cc

    def tags_in(self, other: Iterable[int]) -> Units:
    """Filters all units that have their tags in the 'other' set/list/dict
    Example::
    my_inject_queens = self.units.tags_in(self.queen_tags_assigned_to_do_injects)
    # Do not use the following as it is slower because it first loops over all units to filter out if they are queens and loops over those again to check if their tags are in the list/set
    my_inject_queens_slow = self.units(QUEEN).tags_in(self.queen_tags_assigned_to_do_injects)
    :param other:
    """
    return self.filter(lambda unit: unit.tag in other)

  2. WickedFridge commented on Jan 3, 2025

    @WickedFridge
    Author

    Actually the medivac I use is different in each iteration, so I don't have an explanation as to why that is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions