Skip to content

Commit

Permalink
1,2,3 from possible
Browse files Browse the repository at this point in the history
  • Loading branch information
paris-ci committed Apr 29, 2024
1 parent 1051a7c commit d66eca6
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 13 deletions.
20 changes: 20 additions & 0 deletions src/cogs/ducks_hunting_commands.py
Expand Up @@ -596,6 +596,26 @@ async def bang(self, ctx: MyContext, target: Optional[SmartMemberConverter], *ar
return False

if duck:
if self.bot.current_event == Events.REVOLUTION:
if random.randint(0, 99) < 10:
db_hunter.shooting_stats["shot_by_duck"] += 1
db_hunter.shooting_stats["got_killed"] += 1
db_hunter.active_powerups["dead"] += 1

await db_hunter.edit_experience_with_levelups(ctx, -2)
await db_hunter.save()

await ctx.reply(
_(
"🔫 You took your weapon out, aiming it perfectly towards the duck, and almost pulled the trigger "
"when you noticed the fluffy feathers were hiding a rifle of their own. "
"[**REVOLUTION**: You died][**MISSED**: -2 exp]",
),
force_public=True,
)

return False

db_hunter.shooting_stats["shots_with_duck"] += 1
duck.db_target_lock_by = db_hunter # Since we have unsaved data
result = await duck.shoot(args)
Expand Down
24 changes: 16 additions & 8 deletions src/cogs/ducks_spawning.py
Expand Up @@ -9,7 +9,7 @@

from utils import ducks
from utils.cog_class import Cog
from utils.ducks import deserialize_duck
from utils.ducks import deserialize_duck, GhostDuck
from utils.events import Events
from utils.models import DiscordChannel, DucksLeft, get_enabled_channels

Expand Down Expand Up @@ -91,14 +91,22 @@ async def spawn_ducks(self, now: int):
):
continue

asyncio.ensure_future(
ducks.spawn_random_weighted_duck(
self.bot,
channel,
ducks_left_to_spawn.db_channel,
sun=maybe_spawn_type,
if self.bot.current_event == Events.HAUNTED_HOUSE:
asyncio.ensure_future(
GhostDuck(
self.bot,
channel,
).spawn()
)
else:
asyncio.ensure_future(
ducks.spawn_random_weighted_duck(
self.bot,
channel,
ducks_left_to_spawn.db_channel,
sun=maybe_spawn_type,
)
)
)
ducks_spawned += 1

if (
Expand Down
20 changes: 15 additions & 5 deletions src/utils/ducks.py
Expand Up @@ -497,8 +497,14 @@ async def get_prestige_experience(self, db_killer) -> int:
if db_killer.prestige < 3:
return 0
else:

equalizer_offset = 0

if self.bot.current_event == Events.EQUALIZER:
equalizer_offset = 10

if self.prestige_experience_chance is not None:
if random.randint(0, 99) < self.prestige_experience_chance:
if random.randint(0 + equalizer_offset, 99) < self.prestige_experience_chance:
return db_killer.prestige
else:
return 0
Expand All @@ -512,19 +518,23 @@ async def get_prestige_experience(self, db_killer) -> int:

ducks_killed_today = sum(ducks_killed_today_dict.values()) - decoys_killed_today



if ducks_killed_today <= 5:
if random.randint(0, 99) < 100 - equalizer_offset:
return db_killer.prestige # 100% chance
return db_killer.prestige # 100% chance of getting prestige bonus
elif ducks_killed_today <= 10:
if random.randint(0, 99) < 50:
if random.randint(0 + equalizer_offset, 99) < 50:
return db_killer.prestige # 50% chance
elif ducks_killed_today <= 50:
if random.randint(0, 99) < 10:
if random.randint(0 + equalizer_offset, 99) < 10:
return db_killer.prestige # 10% chance
elif ducks_killed_today <= 100:
if random.randint(0, 99) < 7:
if random.randint(0 + equalizer_offset, 99) < 7:
return db_killer.prestige # 7% chance
else:
if random.randint(0, 99) < 2:
if random.randint(0 + equalizer_offset, 99) < 2:
return db_killer.prestige # 2% chance

return 0
Expand Down
13 changes: 13 additions & 0 deletions src/utils/events.py
Expand Up @@ -39,3 +39,16 @@ class Events(Enum):
UN_TREATY = _("A UN treaty bans damaging ammo"), _(
"AP and Explosive ammo are disabled. Super ducks are worth more exp, since they are getting rare."
)

EQUALIZER = _("Equalizer"), _(
"Ducks are angered that long time hunters get prestige bonuses and are encouraged to kill even more of their families. "
"They will steal some prestige bonuses when they can in order to ensure a fairer game for all."
)

HAUNTED_HOUSE = _("Haunted house"), _(
"As it turns dark, the ducks also change with the times. Be prepared to check if there’s a duck lurking in the corner!"
)

REVOLUTION = _("Duck revolution"), _("Beware! Ducks have obtained their own rifles, and will retaliate against hunters that shoot at them.")


0 comments on commit d66eca6

Please sign in to comment.