Overpowered

by gapty


main.py

from DroneControl import Drone
from Messenger import send_notification
from GeodeScanner import GeodeScanner
from FS_Position import get_FS_position

ELEMENTS = ['Kindness', 'Honesty', 'Laughter', 'Generosity', 'Loyalty', 'Empathy', 'Magic']

# Initialize power level states for each element
power_states = {}
for element in ELEMENTS:
    if element == 'Kindness'
        power_states[element] = 'approachable'
    else:
        power_states[element] = 'fighting'

# Initialize power levels for each element
power_levels = {}
for element in ELEMENTS:
    power_levels[element] = GeodeScanner.measure_power(element)

previous_FS_position = get_FS_position()
send_notification('all', "Fluttershy's current position is " + previous_FS_position)

while (GeodeScanner.measure_power("Kindness") < 0):
    # Update Fluttershy’s position
    current_FS_position = get_FS_position()
    if previous_FS_position != current_FS_position:
        send_notification('all', "Fluttershy has moved to " + current_FS_position)
        previous_FS_position = current_FS_position

    # Control drones
    for drone_id in Drone.id:
        # Drones get destroyed if in Fluttershy's region.
        if Drone.id[drone_id].position == current_FS_position:
            Drone.id[drone_id].change_position()
        else:
            # Detect and respond to animals
            animal = Drone.id[drone_id].detect_animal()
            # Contact authorities if animal is large
            if animal.category == "mammal" or animal.category == "reptile":
                send_notification('authority', animal.name + " has been spotted at " + Drone.id[drone_id].position)
            # Use smoke to calm down arthropods
            if animal.category == "arthropod":
                Drone.id[drone_id].smoke(animal)
            # Lead birds to a region with insects
            if animal.category == "bird":
                Drone.id[drone_id].lead_to_insects(animal)
"""
            if animal.name == “Ladybug”:
                Drone.id[drone_id].kill_with_fire(animal)

            Removed after discussions, but may be needed in the future. I don't understand why everyone wants to kill spiders though instead of the ladybugs. They're cute. -Twilight
"""

    # Check geode’s power levels
    for element in ELEMENTS:
        power_levels[element] = GeodeScanner.measure_power(element)
        # Update Rainboom’s power level state
        if element != 'Kindness':
            if power_levels[element] < 370:
                if power_states[element] != 'resting':
                    power_states[element] = 'resting'
                    send_notification(element, "Warning: low power level detected. Seek safety from Fluttershy and charge your geode!")
            elif power_levels[element] > 400:
                if power_states[element] != 'fighting':
                    power_states[element] = 'fighting'
                    send_notification(element, "Power level has been restored. It is safe to fight.")

        # Update Fluttershy's power level state
        else:
            if power_levels[element] < -200:
                if power_states[element] != 'enraged':
                    power_states[element] = 'enraged'
                    send_notification('Rainbooms', "Warning: Fluttershy is enraged. Do not harm animals!")
            elif power_levels[element] <= -30:
                if power_states[element] != 'approachable':
                    power_states[element] = 'approachable'
                    send_notification('Rainbooms', "Fluttershy can be approached again!")
            elif power_levels[element] > -30:
                if power_states[element] != 'low':
                    power_states[element] = 'low'
                    send_notification('Rainbooms', "Fluttershy is close to being purified. Attack together!")