Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions gato/gatos/BlackSwanGato.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# from random import random
import random
from ABaseGato import ABaseGato, require_alive

class BlackswanGato(ABaseGato):
"""
> Fav Food: Chocolate
> Upon deployment draw one tarot card.
Every 10 minutes there is a 50/50 chance to increase/decrease a random stat
(among hp, hunger, energy, mood or efficiency) by 10%
(efficiency boost/decrease only lasts for 10 minutes).
> Eidolons: e1->e5 (boost increases up to 15%, 1% every eidolon)
> E6: (Increases 50/50 chance to 70/30)
"""

# Override constants
IMAGE = "https://ibb.co/pz6B903"
ANIMATIONS = "blackswangato"
DISPLAY_NAME = "Blackberry Mousse"
RARITY = 4
VALUES_TO_SAVE = ABaseGato.VALUES_TO_SAVE + [
"buff_cooldown",
"buff_chance",
"buff_percentage",
"random_stats",
"og_efficiency"
]

# Override superclass values for stats

# Custom variables used for this gato
buff_cooldown: int = 0 # Remaining cooldown until its buff can be triggered again
buff_chance: int = 0.5 # Chance for buff to increase or decrease
buff_percentage: int = 0.1 # Percent that buff will be applied
og_efficiency: float = None # Value that keeps track of original efficiency
BUFF_KEY: str = "BSG_eff_buff" # dict key to keep track of this gato's buffs
random_stats: list = ["health", "energy", "hunger", "efficiency", "mood"]

# Helper to pick pos/neg sign representing incr/decr
def incr_decr_sign(self, chance):
choices = [True, False]
weights = [chance, 1-chance]
pick = random.choices(choices, weights=weights, k=1)[0]
return 1.0 if pick else -1.0

@require_alive
def random_buff(self, seconds):
# Set percentage and chance according to eidolon
if self.eidolon > 0:
buff_percentage = min(0.15, 0.1+ self.eidolon*0.01)
if self.eidolon > 6:
self.buff_chance = 0.7

self.buff_cooldown -= seconds
if self.buff_cooldown <= 0:
# Reset efficiency
if self.og_efficiency is not None:
self.efficiency = self.og_efficiency

# Calculate increase or decrease
chosen_percentage = 1.0 + (self.incr_decr_sign(self.buff_chance) * self.buff_percentage)

# Decide random stat
chosen_stat = random.choice(self.random_stats)

# Save original efficiency
self.og_efficiency = self.efficiency

# Set chosen_stat with chosen_percentage
setattr(self, chosen_stat, getattr(self, chosen_stat) * chosen_percentage)

# 10 min CD
self.buff_cooldown = 10*60


def simulate(self, team: list["ABaseGato"], seconds: int = 1):
# We calculate its efficiency boost before its actions
self.random_buff(seconds)

# Then call the parent simulation (VERY IMPORTANT)
super().simulate(seconds)

75 changes: 75 additions & 0 deletions gato/gatos/LuochaGato.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
from random import random

from ABaseGato import ABaseGato, require_alive

class LuochaGato(ABaseGato):
"""
> Fav Food: Coffee
> Restores an ally’s health by 12 when it reaches 30% of max HP.
> (cooldown of 30 minutes)
> Eidolons: e1->e4 (increases amount restored by 2)
> E5: (increases threshold to 40%)
> E6: (decreases cooldown to 25 minutes)
"""

# Override constants
IMAGE = "https://ibb.co/RPqFq6g"
# IMAGE = "https://media.discordapp.net/attachments/1117346551644295239/1202027480735830136/luochagato.png"
ANIMATIONS = "4star"
DISPLAY_NAME = "Latte Macchiato"
RARITY = 4
VALUES_TO_SAVE = ABaseGato.VALUES_TO_SAVE + [
"health_cooldown",
"health_threshold",
"health_restore"
]

# Override superclass values for stats

# Custom variables used for this gato
health_cooldown: int = 0 # 30 minutes default, set in heal_ally
health_threshold: float = 0.3 # default to heal at <= 30%
health_amount: int = 12 # default 12, 2 per e, cap at 20
chosen_ally: ABaseGato = None
BUFF_KEY: str = "LCG_energy_buff" # dict key to keep track of this gato's buffs

# If there is Luocha event
# LUOCHA_EVENT_TYPE = "luocha_event"
# EVENT_DESCRIPTIONS = ABaseGato.EVENT_DESCRIPTIONS | {}

@require_alive
def heal_ally(self, seconds, team):
# e1->e4 increase heal_amount by 2
if self.eidolon >= 1:
self.heal_amount = min(20, 12 + self.eidolon*2)

# e5 increase health_threshold to 40%
if self.eidolon >= 5:
self.health_threshold = 0.4

# pick ally to heal
if self.chosen_ally != None:
for i in team:
if i.health <= i.max_health * self.health_threshold:
self.chosen_ally = i

self.health_cooldown -= seconds

if self.health_cooldown <= 0 and self.chosen_ally != None:
self.chosen_ally.add_health(self.health_amount)
# e6 eidolon health cooldown to 25 mins
if self.eidolon == 6:
self.health_cooldown = 25*60
else:
self.health_cooldown = 30*60
self.chosen_ally = None

def simulate(self, team: list["ABaseGato"], seconds: int = 1):
# We calculate its energy boost before its actions
self.heal_ally(seconds, team)

# Then call the parent simulation (VERY IMPORTANT)
currency, objects = super().simulate(seconds)

# Return gathered currency and objects
return currency, objects