-
Notifications
You must be signed in to change notification settings - Fork 0
Removing HP and Attack
!! DISCLAIMER: THIS IS NOT REMOVING HP AND ATTACK FROM THE CODE, THIS IS REMOVING ANY MENTION OF IT IN THE BOT. !!
Have you seen dexes that have no mention of HP and attack and only show ball ID and wonder how you could do it? In this tutorial, we will be removing any mention of HP and attack in our bot.
We have plenty of files to edit, so let's break them down by location in your bot folder.
Caution
If you edit any of the files incorrectly, you might have a complicated error. I will show as many examples here to not let you do so.
Inside the core folder (ballsdex/core) you will be opening models.py
Inside models.py, you will be scrolling down to line 320 in which you will see this:
) -> str:
text = self.to_string(bot, is_trade=is_trade)
if not short:
text += f" ATK:{self.attack_bonus:+d}% HP:{self.health_bonus:+d}%"Remove the part that says ATK:{self.attack_bonus:+d}% HP:{self.health_bonus:+d}%
It should look like this:
) -> str:
text = self.to_string(bot, is_trade=is_trade)
if not short:
text += f" "Warning
Make sure you leave a blank space as seen above, or the bot will give an error. If you are afraid of accidentally not leaving the space blank, just copy and paste the text += f" " part.
This will remove the HP and attack parts when selecting a ball.
Difference can be seen below:

The last part to go to in this file is line 374. It should look like this:
content = (
f"ID: `#{self.pk:0X}`\n"
f"Caught on {format_dt(self.catch_date)} ({format_dt(self.catch_date, style='R')}).\n"
f"{trade_content}\n"
f"ATK: {self.attack} ({self.attack_bonus:+d}%)\n"
f"HP: {self.health} ({self.health_bonus:+d}%)"
)Remove the last two, that being f"ATK: {self.attack} ({self.attack_bonus:+d}%)\n" and f"HP: {self.health} ({self.health_bonus:+d}%)"
This will remove the text showing how much HP and attack the ball has when you do /balls info. Difference can be seen below:


Note
Make sure to save your changes!
This file will be located in the image_generator folder.
Remove this line in the file:
stats_font = ImageFont.truetype(str(SOURCES_PATH / "Bobby Jones Soft.otf"), 130)This will remove the stats font from being used when generating a card image.
Then, scroll down to line 100. You will see this:
for i, line in enumerate(textwrap.wrap(ball.capacity_description, width=32)):
draw.text(
(60, 1100 + 100 * len(cap_name) + 80 * i),
line,
font=capacity_description_font,
stroke_width=1,
stroke_fill=(0, 0, 0, 255),
)
draw.text(
(320, 1670),
str(ball_instance.health),
font=stats_font,
fill=ball_health,
stroke_width=1,
stroke_fill=(0, 0, 0, 255),
)
draw.text(
(1120, 1670),
str(ball_instance.attack),
font=stats_font,
fill=(252, 194, 76, 255),
stroke_width=1,
stroke_fill=(0, 0, 0, 255),
anchor="ra",
)Remove the last two draw.text, it will make it so that HP and attack numbers do not appear when generating a card image.
Tip
Doing this will not remove the HP and attack icons, you will have to edit the card image you are using in an image editing program to hide the icons (a good free one is PhotoPea).
Once you remove them, it will look like this:

Note
Make sure to save your changes!
Moving from the core folder and going on to the packages, our first edit will be located in the balls folder.
The file we will be editing is countryballs_paginator.py.
Open the file, and scroll down to line 41. It will look like this:
description=(
f"ATK: {ball.attack}({ball.attack_bonus:+d}%) "
f"• HP: {ball.health}({ball.health_bonus:+d}%) • "
f"{ball.catch_date.strftime('%Y/%m/%d | %H:%M')}"
),
emoji=emoji,
value=f"{ball.pk}",Remove the first two entries, that being f"ATK: {ball.attack}({ball.attack_bonus:+d}%) " and f"• HP: {ball.health}({ball.health_bonus:+d}%) • "
It should look like this:
description=(
f"{ball.catch_date.strftime('%Y/%m/%d | %H:%M')}"
),
emoji=emoji,
value=f"{ball.pk}",Doing this will remove HP and attack when doing /balls list, difference can be seen below:

Now open cog.py and scroll down to line 612. It will look like this:
cb_txt = (
countryball.description(short=True, include_emoji=True, bot=self.bot, is_trade=True)
+ f" (`{countryball.attack_bonus:+}%/{countryball.health_bonus:+}%`)"
)Remove the part that says ({countryball.attack_bonus:+}%/{countryball.health_bonus:+}%)
It should look like this:
cb_txt = (
countryball.description(short=True, include_emoji=True, bot=self.bot, is_trade=True)
+ f" "
)Warning
Make sure you leave a blank space as seen above, or the bot will give an error. If you are afraid of accidentally not leaving the space blank, just copy and paste the + f" " part.
Note
Make sure to save your changes!
Open countryball.py and scroll down all the way to the end. You will see this:
return (
f"You caught **{self.name}!** "
f"`(#{ball.pk:0X}, {ball.attack_bonus:+}%/{ball.health_bonus:+}%)`\n\n{text}"
)Remove {ball.attack_bonus:+}%/{ball.health_bonus:+}%. It will look like this:
return (
f"You caught **{self.name}!** "
f"`(#{ball.pk:0X})`\n\n{text}"
)This will remove mentions of HP and attack when catching a ball, it will only show what ID you got.
Difference can be seen below:


Note
Make sure to save your changes!
This will be the last edit we will be doing.
Open menu.py and go to line 457. It will look like this:
discord.SelectOption(
label=f"{favorite}{special}#{ball.pk:0X} {ball.countryball.country}",
description=f"ATK: {ball.attack_bonus:+d}% • HP: {ball.health_bonus:+d}% • "
f"Caught on {ball.catch_date.strftime('%d/%m/%y %H:%M')}",
emoji=emoji,
value=f"{ball.pk}",
default=ball in self.balls_selected,
)
)Remove the part that says f"ATK: {ball.attack_bonus:+d}% • HP: {ball.health_bonus:+d}% • "
It should look like this:
discord.SelectOption(
label=f"{favorite}{special}#{ball.pk:0X} {ball.countryball.country}",
description=f" "
f"Caught on {ball.catch_date.strftime('%d/%m/%y %H:%M')}",
emoji=emoji,
value=f"{ball.pk}",
default=ball in self.balls_selected,
)
)Warning
Make sure you leave a blank space as seen above, or the bot will give an error. If you are afraid of accidentally not leaving the space blank, just copy and paste the description=f" " part.
This will remove HP and attack being shown during trades.
Note
Make sure to save your changes!
Once you edit all the files and save your changes, restart your bot using docker compose restart and if you edited everything correctly, everything should work and show correctly!
If you have any errors, join the Ballsdex Developers server by clicking this blue text.