Open Newb420 opened 1 year ago
Here is code w/ scrapper support to check for 2 rank 1's before trying to merge thus preserving scrapper
# Find targets for special merge
def special_merge(self, df_split, merge_series, df_groups, target='demon_hunter.png'):
merge_df = None
# Try to rank up dryads
dryads_series = adv_filter_keys(merge_series, units='dryad.png')
if not dryads_series.empty:
dryads_rank = dryads_series.index.get_level_values('rank')
for rank in dryads_rank:
# Count rank 1 Scrappers
rank1_scrappers = adv_filter_keys(merge_series, units='scrapper.png', ranks=1).sum()
# Existing logic for merging with harlequin or zealot
merge_series_dryad = adv_filter_keys(merge_series, units=['harlequin.png', 'dryad.png'], ranks=rank)
merge_series_zealot = adv_filter_keys(merge_series, units=['dryad.png', target], ranks=rank)
if len(merge_series_dryad.index) == 2:
merge_df = self.merge_special_unit(df_split, merge_series_dryad, special_type='harlequin.png')
break
if len(merge_series_zealot.index) == 2:
merge_df = self.merge_special_unit(df_split, merge_series_zealot, special_type='dryad.png')
break
# New logic for merging with any unit that has another unit on the board one rank higher
if df_groups['empty.png'] <= 3: # You can adjust this condition
same_rank_series = adv_filter_keys(merge_series, ranks=rank, units='dryad.png', remove=True)
for unit_to_merge in same_rank_series.index.get_level_values('unit'):
# Skip Scrapper if there is only one rank 1 Scrapper
if unit_to_merge == 'scrapper.png' and rank1_scrappers < 2:
continue
if adv_filter_keys(merge_series, units=unit_to_merge, ranks=rank+1).sum() >= 1:
merge_series_dryad = adv_filter_keys(merge_series, units=['dryad.png', unit_to_merge], ranks=rank)
if len(merge_series_dryad.index) == 2:
merge_df = self.merge_special_unit(df_split, merge_series_dryad, special_type='dryad.png')
break
if merge_df is not None: # Break the loop if a merge was successful
break
return merge_df
"if empty_slots <= 1: # You can adjust this condition" empty_slots is not defined
"if empty_slots <= 1: # You can adjust this condition" empty_slots is not defined
its updated now i wrote it wrong at first
idk github being weird andnot updating my comment haha
replace that line w/
if df_groups['empty.png'] <= 3:
or w/e number u want
also here is a cleaned up dryad and summoner so they dont have identification issues these dont work on floor ten tho. when doing dungeons the backgrounds mess up detection you can always pull fresh icons from the ocr_inputs folder
Oh awesome ill add them to the units right now, thanks for all this
Oh awesome ill add them to the units right now, thanks for all this
np man i've only really figured out a lil bit still learning everyday Chatgpt does wonders :D
Oh awesome ill add them to the units right now, thanks for all this
Actually them units work on floor 7 floor 10 they dont work
Oh awesome ill add them to the units right now, thanks for all this
Actually them units work on floor 7 floor 10 they dont work
Interesting, What causes that?
Oh awesome ill add them to the units right now, thanks for all this
Actually them units work on floor 7 floor 10 they dont work
Interesting, What causes that?
I think it's the tile color, in the OCR_inputs folder it takes fresh shots of the units you can copy the unit you need from there. You just gotta be quick cuz the icons refresh every 3-4 seconds haha. you might have to crop it, you can do that with photos on windows and make sure its 90x90
Oh awesome ill add them to the units right now, thanks for all this
Actually them units work on floor 7 floor 10 they dont work
Interesting, What causes that?
I think it's the tile color, in the OCR_inputs folder it takes fresh shots of the units you can copy the unit you need from there. You just gotta be quick cuz the icons refresh every 3-4 seconds haha. you might have to crop it, you can do that with photos on windows and make sure its 90x90
Any way to do the same with merge ranks? ranks seem to get stuck aswell when the board starts to fill up and the bot keeps trying to combine incorrect merge ranks instead of stuff like harlequin in order to create a possible merge. Makes it difficult to get to 40 demon hunters
Oh awesome ill add them to the units right now, thanks for all this
Actually them units work on floor 7 floor 10 they dont work
Interesting, What causes that?
I think it's the tile color, in the OCR_inputs folder it takes fresh shots of the units you can copy the unit you need from there. You just gotta be quick cuz the icons refresh every 3-4 seconds haha. you might have to crop it, you can do that with photos on windows and make sure its 90x90
Any way to do the same with merge ranks? ranks seem to get stuck aswell when the board starts to fill up and the bot keeps trying to combine incorrect merge ranks instead of stuff like harlequin in order to create a possible merge. Makes it difficult to get to 40 demon hunters
i really dont have issue with merge ranks besides summoner idk if icons effect the way rank is read or not i'd have to look into it some more
Oh awesome ill add them to the units right now, thanks for all this
Actually them units work on floor 7 floor 10 they dont work
Interesting, What causes that?
I think it's the tile color, in the OCR_inputs folder it takes fresh shots of the units you can copy the unit you need from there. You just gotta be quick cuz the icons refresh every 3-4 seconds haha. you might have to crop it, you can do that with photos on windows and make sure its 90x90
Any way to do the same with merge ranks? ranks seem to get stuck aswell when the board starts to fill up and the bot keeps trying to combine incorrect merge ranks instead of stuff like harlequin in order to create a possible merge. Makes it difficult to get to 40 demon hunters
i really dont have issue with merge ranks besides summoner idk if icons effect the way rank is read or not i'd have to look into it some more
Yeah it could possibly be summoner if you aren't having the same issues with scrapper or any other unit. I noticed you use summoner and scrapper but may I ask why trapper? I feel like at the end of the game the bot merges away almost all trappers anyways and the one or two trapper left just takes up a space of yours that could be a demon hunter which could be the difference between 40 demon hunters or not, so it may be more useful to have a harlequin to help your chances at reaching 40 demon hunters.
Thanks, I'll give this a try in new branch
I've been testing it, but one thing I noticed that it doesn't take into account the preserved units. So it adds dryad to a unit but then it won't actually merge it since 1 of them is preserved. So I'll put the preserve logic higher inside try_merge, so it happens before the call to special_merge.
I'll test it out for a while
Oh awesome ill add them to the units right now, thanks for all this
Actually them units work on floor 7 floor 10 they dont work
Interesting, What causes that?
I think it's the tile color, in the OCR_inputs folder it takes fresh shots of the units you can copy the unit you need from there. You just gotta be quick cuz the icons refresh every 3-4 seconds haha. you might have to crop it, you can do that with photos on windows and make sure its 90x90
Any way to do the same with merge ranks? ranks seem to get stuck aswell when the board starts to fill up and the bot keeps trying to combine incorrect merge ranks instead of stuff like harlequin in order to create a possible merge. Makes it difficult to get to 40 demon hunters
i really dont have issue with merge ranks besides summoner idk if icons effect the way rank is read or not i'd have to look into it some more
Yeah it could possibly be summoner if you aren't having the same issues with scrapper or any other unit. I noticed you use summoner and scrapper but may I ask why trapper? I feel like at the end of the game the bot merges away almost all trappers anyways and the one or two trapper left just takes up a space of yours that could be a demon hunter which could be the difference between 40 demon hunters or not, so it may be more useful to have a harlequin to help your chances at reaching 40 demon hunters.
i'm just using trapper for now since i still dont have a harly card trapper is decent for slowing units in coop and extra dmg. but will swap trapper when i get harley
I've been testing it, but one thing I noticed that it doesn't take into account the preserved units. So it adds dryad to a unit but then it won't actually merge it since 1 of them is preserved. So I'll put the preserve logic higher inside try_merge, so it happens before the call to special_merge.
I'll test it out for a while
been noticing this too might change the preserve logic to just keep 1 unit regardless of the rank instead of keeping highest rank for preserve.
This new function will merge dryad with another unit that has another unit 1 rank higher so the 2 units can merge instead of only merging with target unit if anyone is using scrapper and want it to preserve 1 rank 1 scrapper i have logic to handle that. just lmk
part 2 we need to add df_groups to try_merge function