Ejemplo n.º 1
0
async def name_slimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)
    command_used = ""

    # Check if player is in the labs and has a slimeoid incubating
    response = basic_slimeoid_incubation_checks(
        channel_name=cmd.message.channel.name,
        user_data=user_data,
        slimeoid_data=slimeoid_data)
    # If response returns None go to final response

    # Lifestate check for flavor text
    if slimeoid_data.sltype == ewcfg.sltype_nega:
        slimeoidtype = "Negaslimeoid"
    else:
        slimeoidtype = "Slimeoid"

    if response is None:  # Slimeoid is incubating

        # Check if player has specified a name
        if cmd.tokens_count < 2:
            response = "You must specify a name."
            # Go to final response

        else:

            # Turn entire message minus "!nameslimeoid" in to name variable
            command_used = ewutils.flattenTokenListToString(cmd.tokens[0])
            name = cmd.message.content[(len(command_used) +
                                        len(ewcfg.cmd_prefix)):].strip()

            # Limit name length to 32 characters
            if len(name) > 32:
                response = "That name is too long. ({:,}/32)".format(len(name))
                # Go to final response

            else:
                # Save slimeoid name
                slimeoid_data.name = str(name)

                user_data.persist()
                slimeoid_data.persist()

                if slimeoidtype == "Slimeoid":
                    response = "You enter the name {} into the console.".format(
                        str(name))
                else:
                    response = "You move the planchette between letters, spelling out the name {}.".format(
                        str(name))
                # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 2
0
def delete_enemy(enemy_data):
    # print("DEBUG - {} - {} DELETED".format(enemy_data.id_enemy, enemy_data.display_name))
    enemy_data.clear_allstatuses()

    # If the enemy is a Slimeoid Trainer, delete its slimeoid.
    if enemy_data.enemytype in ewcfg.slimeoid_trainers:
        trainer_slimeoid = EwSlimeoid(id_user=enemy_data.id_enemy,
                                      id_server=enemy_data.id_server)
        trainer_slimeoid.delete()

    bknd_core.execute_sql_query(
        "DELETE FROM enemies WHERE {id_enemy} = %s".format(
            id_enemy=ewcfg.col_id_enemy), (enemy_data.id_enemy, ))
Ejemplo n.º 3
0
def get_slimeoid_count(user_id=None, server_id=None):
    if user_id != None and server_id != None:
        count = 0
        slimeoid_data = EwSlimeoid(id_user=user_id, id_server=server_id)
        secondary_user = str(user_id) + "freeze"
        name_list = []
        if slimeoid_data.name != "":
            count += 1

        items = bknd_item.inventory(id_user=user_id,
                                    id_server=server_id,
                                    item_type_filter=ewcfg.it_item)

        bottles = []
        for item in items:
            item_data = EwItem(id_item=item.get('id_item'))
            if item_data.item_props.get(
                    'context') == ewcfg.context_slimeoidbottle:
                count += 1

        try:
            conn_info = bknd_core.databaseConnect()
            conn = conn_info.get('conn')
            cursor = conn.cursor()

            sql = "SELECT {} FROM slimeoids WHERE {} = %s"
            cursor.execute(sql.format(ewcfg.col_name, ewcfg.col_id_user),
                           [secondary_user])

            count += cursor.rowcount
        finally:
            # Clean up the database handles.
            cursor.close()
            bknd_core.databaseClose(conn_info)
            return count
Ejemplo n.º 4
0
def get_slimeoids_resp(id_server, poi):
    slimeoids_resp = ""

    slimeoids_in_district = ewutils.get_slimeoids_in_poi(id_server=id_server, poi=poi.id_poi)

    for id_slimeoid in slimeoids_in_district:
        slimeoid_data = EwSlimeoid(id_slimeoid=id_slimeoid)
        if slimeoid_data.sltype == ewcfg.sltype_nega:
            slimeoids_resp += "\n{} is here.".format(slimeoid_data.name)

    return slimeoids_resp
Ejemplo n.º 5
0
async def name_slimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check if player is in the labs and has a slimeoid incubating
    response = basic_slimeoid_incubation_checks(
        channel_name=cmd.message.channel.name,
        user_data=user_data,
        slimeoid_data=slimeoid_data)
    # If response returns None go to final response

    if response is None:  # Slimeoid is incubating

        # Check if player has specified a name
        if cmd.tokens_count < 2:
            response = "You must specify a name."
            # Go to final response

        else:

            # Turn entire message minus "!nameslimeoid" in to name variable
            name = cmd.message.content[(len(ewcfg.cmd_nameslimeoid)):].strip()

            # Limit name length to 32 characters
            if len(name) > 32:
                response = "That name is too long. ({:,}/32)".format(len(name))
                # Go to final response

            else:
                # Save slimeoid name
                slimeoid_data.name = str(name)

                user_data.persist()
                slimeoid_data.persist()

                response = "You enter the name {} into the console.".format(
                    str(name))
                # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 6
0
def can_slimeoid_battle(challenger: EwUser = None,
                        challengee=None,
                        challenger_slimeoid: EwSlimeoid = None,
                        challengee_slimeoid: EwSlimeoid = None,
                        bet: int = 0):
    response = ""
    time_now = int(time.time())
    # Gotta have a challenger, otherwise do nothing
    if challenger:
        challenger_data = challenger
        challenger_player = EwPlayer(id_user=challenger_data.id_user)
        ally_slimeoid = None
        target_slimeoid = None

        # If supplied a slimeoid, use that - otherwise we just grab it
        if challenger_slimeoid:
            ally_slimeoid = challenger_slimeoid
        else:
            ally_slimeoid = EwSlimeoid(member=challenger)

        # Challenger

        if ally_slimeoid.life_state != ewcfg.slimeoid_state_active:
            response = "You do not have a Slimeoid ready to battle with!"

        elif challenger_data.life_state == ewcfg.life_state_corpse:
            response = "Your Slimeoid won't battle for you while you're dead."

        elif (time_now -
              ally_slimeoid.time_defeated) < ewcfg.cd_slimeoiddefeated:
            time_until = ewcfg.cd_slimeoiddefeated - (
                time_now - ally_slimeoid.time_defeated)
            response = "Your Slimeoid is still recovering from its last defeat! It'll be ready in {} seconds.".format(
                int(time_until))

        elif ewutils.active_slimeoidbattles.get(ally_slimeoid.id_slimeoid):
            response = "You are already in the middle of a challenge."

        elif challengee:
            if isinstance(challengee, EwEnemy):
                challengee_data = challengee
                is_pvp = False
            else:
                challengee_data = challengee
                challengee_player = EwPlayer(id_user=challengee.id_user)

            if challengee_slimeoid:
                target_slimeoid = challengee_slimeoid
            else:
                target_slimeoid = EwSlimeoid(member=challengee)

            if target_slimeoid.life_state != ewcfg.slimeoid_state_active:
                response = "{} does not have a Slimeoid ready to battle with!".format(
                    challengee_player.
                    display_name if is_pvp else challengee_data.display_name)

            elif challenger_data.poi != challengee_data.poi:
                response = "Both slimeoid trainers must be in the same place."

            elif challenger_data.slimes < bet or challenger_data.slimes < 0:
                response = "You don't have enough slime!"
            elif challengee_data.slimes < bet or challengee_data.slimes < 0:
                response = "They don't have enough slime!"

            elif challengee_data.life_state == ewcfg.life_state_corpse:
                response = "{}'s Slimeoid won't battle for them while they're dead.".format(
                    challengee_player.display_name).replace("@", "\{at\}")

            elif (time_now -
                  target_slimeoid.time_defeated) < ewcfg.cd_slimeoiddefeated:
                time_until = ewcfg.cd_slimeoiddefeated - (
                    time_now - target_slimeoid.time_defeated)
                response = "{}'s Slimeoid is still recovering from its last defeat! It'll be ready in {} seconds.".format(
                    challengee_player.display_name, int(time_until))

            elif ewutils.active_slimeoidbattles.get(
                    target_slimeoid.id_slimeoid):
                response = "They are already in the middle of a challenge."

        return response
Ejemplo n.º 7
0
async def battle_slimeoids(id_s1, id_s2, challengee_name, challenger_name,
                           channel, battle_type):
    # fetch slimeoid data
    challengee_slimeoid = EwSlimeoid(id_slimeoid=id_s1)
    challenger_slimeoid = EwSlimeoid(id_slimeoid=id_s2)

    client = ewutils.get_client()

    # calculate starting hp
    s1hpmax = 50 + (challengee_slimeoid.level * 20)
    s2hpmax = 50 + (challenger_slimeoid.level * 20)

    # calculate starting sap
    s1sapmax = challengee_slimeoid.level * 2
    s2sapmax = challenger_slimeoid.level * 2

    # initialize combat data for challengee
    s1_combat_data = EwSlimeoidCombatData(
        name=str(challengee_slimeoid.name),
        weapon=sl_static.offense_map.get(challengee_slimeoid.weapon),
        armor=sl_static.defense_map.get(challengee_slimeoid.armor),
        special=sl_static.special_map.get(challengee_slimeoid.special),
        legs=sl_static.mobility_map.get(challengee_slimeoid.legs),
        brain=sl_static.brain_map.get(challengee_slimeoid.ai),
        hue=hue_static.hue_map.get(challengee_slimeoid.hue),
        coating=challengee_slimeoid.coating,
        moxie=challengee_slimeoid.atk + 1,
        grit=challengee_slimeoid.defense + 1,
        chutzpah=challengee_slimeoid.intel + 1,
        hpmax=s1hpmax,
        hp=s1hpmax,
        sapmax=s1sapmax,
        sap=s1sapmax,
        slimeoid=challengee_slimeoid,
        owner=challengee_name,
    )

    # initialize combat data for challenger
    s2_combat_data = EwSlimeoidCombatData(
        name=str(challenger_slimeoid.name),
        weapon=sl_static.offense_map.get(challenger_slimeoid.weapon),
        armor=sl_static.defense_map.get(challenger_slimeoid.armor),
        special=sl_static.special_map.get(challenger_slimeoid.special),
        legs=sl_static.mobility_map.get(challenger_slimeoid.legs),
        brain=sl_static.brain_map.get(challenger_slimeoid.ai),
        hue=hue_static.hue_map.get(challenger_slimeoid.hue),
        coating=challenger_slimeoid.coating,
        moxie=challenger_slimeoid.atk + 1,
        grit=challenger_slimeoid.defense + 1,
        chutzpah=challenger_slimeoid.intel + 1,
        hpmax=s2hpmax,
        hp=s2hpmax,
        sapmax=s2sapmax,
        sap=s2sapmax,
        slimeoid=challenger_slimeoid,
        owner=challenger_name,
    )

    s1_combat_data.apply_weapon_matchup(s2_combat_data)
    s2_combat_data.apply_weapon_matchup(s1_combat_data)

    s1_combat_data.apply_hue_matchup(s2_combat_data)
    s2_combat_data.apply_hue_matchup(s1_combat_data)

    # decide which slimeoid gets to move first
    s1_active = False
    in_range = False

    if challengee_slimeoid.defense > challenger_slimeoid.defense:
        s1_active = True
    elif challengee_slimeoid.defense == challenger_slimeoid.defense:
        coinflip = random.randrange(1, 3)
        if coinflip == 1:
            s1_active = True

    # flavor text for arena battles
    if battle_type == ewcfg.battle_type_arena:
        response = "**{} sends {} out into the Battle Arena!**".format(
            challenger_name, s2_combat_data.name)
        await fe_utils.send_message(client, channel, response)
        await asyncio.sleep(1)
        response = "**{} sends {} out into the Battle Arena!**".format(
            challengee_name, s1_combat_data.name)
        await fe_utils.send_message(client, channel, response)
        await asyncio.sleep(1)
        response = "\nThe crowd erupts into cheers! The battle between {} and {} has begun! :crossed_swords:".format(
            s1_combat_data.name, s2_combat_data.name)
        #		response += "\n{} {} {} {} {} {}".format(str(s1moxie),str(s1grit),str(s1chutzpah),str(challengee_slimeoid.weapon),str(challengee_slimeoid.armor),str(challengee_slimeoid.special))
        #		response += "\n{} {} {} {} {} {}".format(str(s2moxie),str(s2grit),str(s2chutzpah),str(challenger_slimeoid.weapon),str(challenger_slimeoid.armor),str(challenger_slimeoid.special))
        #		response += "\n{}, {}".format(str(challengee_resistance),str(challengee_weakness))
        #		response += "\n{}, {}".format(str(challenger_resistance),str(challenger_weakness))
        await fe_utils.send_message(client, channel, response)
        await asyncio.sleep(3)

    turncounter = 100
    # combat loop
    while s1_combat_data.hp > 0 and s2_combat_data.hp > 0 and turncounter > 0:
        # Limit the number of turns in battle.
        turncounter -= 1

        response = ""
        battlecry = random.randrange(1, 4)

        first_turn = (turncounter % 2) == 1

        # slimeoids regenerate their sap every odd turn
        if first_turn:
            s1_combat_data.sap = s1_combat_data.sapmax - s1_combat_data.hardened_sap
            s2_combat_data.sap = s2_combat_data.sapmax - s2_combat_data.hardened_sap

        # assign active and passive role for the turn
        if s1_active:
            active_data = s1_combat_data
            passive_data = s2_combat_data
        else:
            active_data = s2_combat_data
            passive_data = s1_combat_data

        # obtain action and how much sap to spend on it for both slimeoids
        active_strat, active_sap_spend = active_data.brain.get_strat(
            combat_data=active_data,
            active=True,
            in_range=in_range,
            first_turn=first_turn)
        passive_strat, passive_sap_spend = passive_data.brain.get_strat(
            combat_data=passive_data,
            active=False,
            in_range=in_range,
            first_turn=first_turn)

        # potentially add brain-based flavor text
        if active_strat == ewcfg.slimeoid_strat_attack and battlecry == 1:
            if (active_data.hpmax / active_data.hp) > 3:
                response = active_data.brain.str_battlecry_weak.format(
                    slimeoid_name=active_data.name)
            else:
                response = active_data.brain.str_battlecry.format(
                    slimeoid_name=active_data.name)
            await fe_utils.send_message(client, channel, response)
            await asyncio.sleep(1)

        elif active_strat == ewcfg.slimeoid_strat_evade and battlecry == 1:
            if (active_data.hpmax / active_data.hp) > 3:
                response = active_data.brain.str_movecry_weak.format(
                    slimeoid_name=active_data.name)
            else:
                response = active_data.brain.str_movecry.format(
                    slimeoid_name=active_data.name)
            await fe_utils.send_message(client, channel, response)
            await asyncio.sleep(1)

        # announce active slimeoid's chosen action
        response = ""
        if active_strat == ewcfg.slimeoid_strat_attack:
            if in_range:
                response = "{} attempts to strike {} in close combat!".format(
                    active_data.name, passive_data.name)
            else:
                response = "{} attempts to strike {} from a distance!".format(
                    active_data.name, passive_data.name)

        elif active_strat == ewcfg.slimeoid_strat_evade:
            if in_range:
                response = "{} attempts to avoid being hit, while gaining distance from {}.".format(
                    active_data.name, passive_data.name)
            else:
                response = "{} attempts to avoid being hit, while closing the distance to {}.".format(
                    active_data.name, passive_data.name)

        elif active_strat == ewcfg.slimeoid_strat_block:
            response = "{} focuses on blocking incoming attacks.".format(
                active_data.name)

        response += " (**{} sap**)".format(active_sap_spend)

        await fe_utils.send_message(client, channel, response)
        await asyncio.sleep(1)

        # announce passive slimeoid's chosen action
        response = ""
        if passive_strat == ewcfg.slimeoid_strat_attack:
            if in_range:
                response = "{} attempts to strike {} in close combat!".format(
                    passive_data.name, active_data.name)
            else:
                response = "{} attempts to strike {} from a distance!".format(
                    passive_data.name, active_data.name)

        elif passive_strat == ewcfg.slimeoid_strat_evade:
            if in_range:
                response = "{} attempts to avoid being hit, while gaining distance from {}.".format(
                    passive_data.name, active_data.name)
            else:
                response = "{} attempts to avoid being hit, while closing the distance to {}.".format(
                    passive_data.name, active_data.name)

        elif passive_strat == ewcfg.slimeoid_strat_block:
            response = "{} focuses on blocking incoming attacks.".format(
                passive_data.name)

        response += " (**{} sap**)".format(passive_sap_spend)

        await fe_utils.send_message(client, channel, response)
        await asyncio.sleep(1)

        # if the chosen actions are in direct competition, the roll is opposed. only one of them can succeed
        # otherwise both actions are resolved separately
        roll_opposed = False

        if active_strat == ewcfg.slimeoid_strat_attack:
            roll_opposed = passive_strat in [
                ewcfg.slimeoid_strat_evade, ewcfg.slimeoid_strat_block
            ]
        elif active_strat == ewcfg.slimeoid_strat_evade:
            roll_opposed = passive_strat in [
                ewcfg.slimeoid_strat_attack, ewcfg.slimeoid_strat_evade
            ]
        elif active_strat == ewcfg.slimeoid_strat_block:
            roll_opposed = passive_strat in [ewcfg.slimeoid_strat_attack]

        active_dos = active_data.attempt_action(strat=active_strat,
                                                sap_spend=active_sap_spend,
                                                in_range=in_range)

        # simultaneous attacks are a special case. the passive slimeoid only rolls the dice, after the active slimeoid's attack has been resolved
        if passive_strat != ewcfg.slimeoid_strat_attack:
            passive_dos = passive_data.attempt_action(
                strat=passive_strat,
                sap_spend=passive_sap_spend,
                in_range=in_range)
            if roll_opposed:
                active_dos -= passive_dos
                passive_dos = -active_dos

                # on an opposed roll, priority for the next turn (the active role) is passed to the winner of the roll
                if active_dos < 0:
                    s1_active = not s1_active
        else:
            passive_dos = 0

        # resolve active slimeoid's attack
        if active_strat == ewcfg.slimeoid_strat_attack:
            # the attack was successful
            if active_dos > 0:
                # calculate damage
                if in_range:
                    damage = int(active_dos * 30 /
                                 (passive_data.hardened_sap + 1))
                else:
                    damage = int(active_dos * 20)

                response = active_data.execute_attack(passive_data, damage,
                                                      in_range)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

                response = passive_data.take_damage(active_data, damage,
                                                    active_dos, in_range)
                if len(response) > 0:
                    await fe_utils.send_message(client, channel, response)
                    await asyncio.sleep(1)

            elif not roll_opposed:
                response = "{} whiffs its attack!".format(active_data.name)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)
            elif passive_strat == ewcfg.slimeoid_strat_evade:
                response = "{} dodges {}'s attack!".format(
                    passive_data.name, active_data.name)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)
            elif passive_strat == ewcfg.slimeoid_strat_block:
                response = "{} blocks {}'s attack!".format(
                    passive_data.name, active_data.name)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

        # if the active slimeoid's attack killed the passive slimeoid
        if passive_data.hp <= 0:
            break

        if passive_strat == ewcfg.slimeoid_strat_attack:
            passive_dos = passive_data.attempt_action(
                strat=passive_strat,
                sap_spend=passive_sap_spend,
                in_range=in_range)

            if roll_opposed:
                active_dos -= passive_dos
                passive_dos = -active_dos

                if active_dos < 0:
                    s1_active = not s1_active

        # resolve passive slimeoid's attack
        if passive_strat == ewcfg.slimeoid_strat_attack:
            # attack was successful
            if passive_dos > 0:
                # calculate damage
                if in_range:
                    damage = int(passive_dos * 30 /
                                 (active_data.hardened_sap + 1))
                else:
                    damage = int(passive_dos * 20)

                response = passive_data.execute_attack(active_data, damage,
                                                       in_range)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

                response = active_data.take_damage(passive_data, damage,
                                                   passive_dos, in_range)
                if len(response) > 0:
                    await fe_utils.send_message(client, channel, response)
                    await asyncio.sleep(1)

            elif not roll_opposed:
                response = "{} whiffs its attack!".format(passive_data.name)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)
            elif active_strat == ewcfg.slimeoid_strat_evade:
                response = "{} dodges {}'s attack!".format(
                    active_data.name, passive_data.name)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)
            elif active_strat == ewcfg.slimeoid_strat_block:
                response = "{} blocks {}'s attack!".format(
                    active_data.name, passive_data.name)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

        # resolve active slimeoid's movement
        if active_strat == ewcfg.slimeoid_strat_evade:
            if active_dos > 0:
                response = active_data.change_distance(passive_data, in_range)
                in_range = not in_range
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)
            elif active_dos == 0 and passive_strat == ewcfg.slimeoid_strat_evade:
                in_range = not in_range
                response = "{} and {} circle each other, looking for an opening...".format(
                    active_data.name, passive_data.name)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

        # resolve active slimeoid's defense
        if active_strat == ewcfg.slimeoid_strat_block:
            if active_dos > 0:
                response = active_data.harden_sap(active_dos)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

        # resolve passive slimeoid's movement
        if passive_strat == ewcfg.slimeoid_strat_evade:
            if passive_dos > 0:
                response = passive_data.change_distance(active_data, in_range)
                in_range = not in_range
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

        # resolve passive slimeoid's defense
        if passive_strat == ewcfg.slimeoid_strat_block:
            if passive_dos > 0:
                response = passive_data.harden_sap(passive_dos)
                await fe_utils.send_message(client, channel, response)
                await asyncio.sleep(1)

        # re-fetch slimeoid data
        challenger_slimeoid = EwSlimeoid(id_slimeoid=id_s2)
        challengee_slimeoid = EwSlimeoid(id_slimeoid=id_s1)

        s1_combat_data.slimeoid = challengee_slimeoid
        s2_combat_data.slimeoid = challenger_slimeoid

        # Check if slimeoids have died during the fight
        if challenger_slimeoid.life_state == ewcfg.slimeoid_state_dead:
            s2_combat_data.hp = 0
        elif challengee_slimeoid.life_state == ewcfg.slimeoid_state_dead:
            s1_combat_data.hp = 0

        await asyncio.sleep(2)

    # the challengee has lost
    if s1_combat_data.hp <= 0:
        result = 1
        response = "\n" + s1_combat_data.legs.str_defeat.format(
            slimeoid_name=s1_combat_data.name)
        response += " {}".format(ewcfg.emote_slimeskull)
        response += "\n" + s2_combat_data.brain.str_victory.format(
            slimeoid_name=s2_combat_data.name)

        challenger_slimeoid = EwSlimeoid(id_slimeoid=id_s2)
        challengee_slimeoid = EwSlimeoid(id_slimeoid=id_s1)

        # Losing slimeoid loses clout and has a time_defeated cooldown.
        if channel.name == ewcfg.channel_arena:
            challengee_slimeoid.clout = calculate_clout_loss(
                challengee_slimeoid.clout)
            challengee_slimeoid.time_defeated = int(time.time())
            challengee_slimeoid.persist()

        if channel.name == ewcfg.channel_arena:
            challenger_slimeoid.clout = calculate_clout_gain(
                challenger_slimeoid.clout)
            challenger_slimeoid.persist()

        await fe_utils.send_message(client, channel, response)
        await asyncio.sleep(2)
    # the challenger has lost
    else:
        result = -1
        response = "\n" + s2_combat_data.legs.str_defeat.format(
            slimeoid_name=s2_combat_data.name)
        response += " {}".format(ewcfg.emote_slimeskull)
        response += "\n" + s1_combat_data.brain.str_victory.format(
            slimeoid_name=s1_combat_data.name)

        challenger_slimeoid = EwSlimeoid(id_slimeoid=id_s2)
        challengee_slimeoid = EwSlimeoid(id_slimeoid=id_s1)

        # store defeated slimeoid's defeat time in the database
        if channel.name == ewcfg.channel_arena:
            challenger_slimeoid.clout = calculate_clout_loss(
                challenger_slimeoid.clout)
            challenger_slimeoid.time_defeated = int(time.time())
            challenger_slimeoid.persist()

        if channel.name == ewcfg.channel_arena:
            challengee_slimeoid.clout = calculate_clout_gain(
                challengee_slimeoid.clout)
            challengee_slimeoid.persist()

        await fe_utils.send_message(client, channel, response)
        await asyncio.sleep(2)
    return result
Ejemplo n.º 8
0
def gen_data_text(id_user=None,
                  id_server=None,
                  display_name=None,
                  channel_name=None):
    user_data = EwUser(id_user=id_user, id_server=id_server, data_level=2)
    slimeoid = EwSlimeoid(id_user=id_user, id_server=id_server)

    cosmetics = bknd_item.inventory(id_user=user_data.id_user,
                                    id_server=user_data.id_server,
                                    item_type_filter=ewcfg.it_cosmetic)
    adorned_cosmetics = []
    for cosmetic in cosmetics:
        cos = EwItem(id_item=cosmetic.get('id_item'))
        if cos.item_props['adorned'] == 'true':
            hue = hue_static.hue_map.get(cos.item_props.get('hue'))
            adorned_cosmetics.append((hue.str_name +
                                      " " if hue != None else "") +
                                     cosmetic.get('name'))

    if user_data.life_state == ewcfg.life_state_grandfoe:
        poi = poi_static.id_to_poi.get(user_data.poi)
        if poi != None:
            response = "{} is {} {}.".format(display_name, poi.str_in,
                                             poi.str_name)
        else:
            response = "You can't discern anything useful about {}.".format(
                display_name)

    else:

        # return somebody's score
        # get race flavor text
        player_race = ewcfg.defined_races.get(user_data.race)
        if player_race != None:
            race_prefix = player_race.get("race_prefix", "")
            race_suffix = player_race.get("race_suffix", "")
        else:
            race_prefix = ""
            race_suffix = ""

        if user_data.life_state == ewcfg.life_state_corpse:
            response = "{} is a {}level {} {}dead{}.".format(
                display_name, race_prefix, user_data.slimelevel, race_suffix,
                user_data.gender)
        elif user_data.life_state == ewcfg.life_state_shambler:
            response = "{} is a {}level {} {}shambler.".format(
                display_name, race_prefix, user_data.slimelevel, race_suffix)
        else:
            response = "{} is a {}level {} {}slime{}.".format(
                display_name, race_prefix, user_data.slimelevel, race_suffix,
                user_data.gender)
            """if user_data.degradation < 20:
                pass
            elif user_data.degradation < 40:
                response += " Their bodily integrity is starting to slip."
            elif user_data.degradation < 60:
                response += " Their face seems to be melting and they periodically have to put it back in place."
            elif user_data.degradation < 80:
                response += " They are walking a bit funny, because their legs are getting mushy."
            elif user_data.degradation < 100:
                response += " Their limbs keep falling off. It's really annoying."
            else:
                response += " They almost look like a shambler already."""

        coinbounty = int(user_data.bounty / ewcfg.slimecoin_exchangerate)

        weapon_item = EwItem(id_item=user_data.weapon)
        weapon = static_weapons.weapon_map.get(
            weapon_item.item_props.get("weapon_type"))

        if weapon != None:
            response += " {} {}{}.".format(
                ewcfg.str_weapon_married if user_data.weaponmarried == True
                else ewcfg.str_weapon_wielding,
                ("" if len(weapon_item.item_props.get("weapon_name")) == 0 else
                 "{}, ".format(weapon_item.item_props.get("weapon_name"))),
                weapon.str_weapon)
            if user_data.weaponskill >= 5:
                response += " {}".format(
                    weapon.str_weaponmaster.format(
                        rank=(user_data.weaponskill - 4), title="master"))
            else:
                response += " {}".format(
                    weapon.str_weaponmaster.format(rank=user_data.weaponskill,
                                                   title="rookie"))

        sidearm_item = EwItem(id_item=user_data.sidearm)
        sidearm = static_weapons.weapon_map.get(
            sidearm_item.item_props.get("weapon_type"))

        if sidearm != None:
            response += " They have sidearmed {}{}.".format(
                ("" if len(sidearm_item.item_props.get("weapon_name"))
                 == 0 else "{}, ".format(
                     sidearm_item.item_props.get("weapon_name"))),
                sidearm.str_weapon)

        trauma = se_static.trauma_map.get(user_data.trauma)

        if trauma != None:
            response += " {}".format(trauma.str_trauma)

        response_block = ""

        user_kills = ewstats.get_stat(user=user_data, metric=ewcfg.stat_kills)

        enemy_kills = ewstats.get_stat(user=user_data,
                                       metric=ewcfg.stat_pve_kills)

        response_block += "{}{}".format(
            get_crime_level(num=user_data.crime, forYou=0), " ")

        if user_kills > 0 and enemy_kills > 0:
            response_block += "They have {:,} confirmed kills, and {:,} confirmed hunts. ".format(
                user_kills, enemy_kills)
        elif user_kills > 0:
            response_block += "They have {:,} confirmed kills. ".format(
                user_kills)
        elif enemy_kills > 0:
            response_block += "They have {:,} confirmed hunts. ".format(
                enemy_kills)

        if coinbounty != 0:
            response_block += "SlimeCorp offers a bounty of {:,} SlimeCoin for their death. ".format(
                coinbounty)

        if len(adorned_cosmetics) > 0:
            response_block += "They have a {} adorned. ".format(
                ewutils.formatNiceList(adorned_cosmetics, 'and'))

            if user_data.freshness < ewcfg.freshnesslevel_1:
                response_block += "Their outfit is starting to look pretty fresh, but They’ve got a long way to go if they wanna be NLACakaNM’s next top model. "
            elif user_data.freshness < ewcfg.freshnesslevel_2:
                response_block += "Their outfit is low-key on point, not gonna lie. They’re goin’ places, kid. "
            elif user_data.freshness < ewcfg.freshnesslevel_3:
                response_block += "Their outfit is lookin’ fresh as hell, goddamn! They shop so much they can probably speak Italian. "
            elif user_data.freshness < ewcfg.freshnesslevel_4:
                response_block += "Their outfit is straight up **GOALS!** Like, honestly. I’m being, like, totally sincere right now. Their Instragrime has attracted a small following. "
            else:
                response_block += "Holy shit! Their outfit is downright, positively, without a doubt, 100% **ON FLEEK!!** They’ve blown up on Instragrime, and they’ve got modeling gigs with fashion labels all across the city. "

        statuses = user_data.getStatusEffects()

        for status in statuses:
            status_effect = EwStatusEffect(id_status=status,
                                           user_data=user_data)
            if status_effect.time_expire > time.time(
            ) or status_effect.time_expire == -1:
                status_flavor = se_static.status_effects_def_map.get(status)

                severity = ""
                try:
                    value_int = int(status_effect.value)
                    if value_int < 3:
                        severity = "lightly injured."
                    elif value_int < 7:
                        severity = "battered and bruised."
                    elif value_int < 11:
                        severity = "severely damaged."
                    else:
                        severity = "completely f****d up, holy shit!"
                except:
                    pass

                format_status = {'severity': severity}

                if status_flavor is not None:
                    response_block += status_flavor.str_describe.format_map(
                        format_status) + " "

        if (slimeoid.life_state == ewcfg.slimeoid_state_active):
            # If the user isn't a corpse
            if user_data.life_state != ewcfg.life_state_corpse:
                response_block += "They are accompanied by {}, a {}-foot-tall Slimeoid. ".format(
                    slimeoid.name, str(slimeoid.level))
            # If the user is a corpse, but has a negaslimeoid
            elif slimeoid.sltype == ewcfg.sltype_nega:
                response_block += "They are accompanied by {}, a {}-foot-tall Negaslimeoid. ".format(
                    slimeoid.name, str(slimeoid.level))

        # if user_data.swear_jar >= 500:
        # 	response_block += "They're going to The Underworld for the things they've said."
        # elif user_data.swear_jar >= 100:
        # 	response_block += "They swear like a sailor!"
        # elif user_data.swear_jar >= 50:
        # 	response_block += "They have quite a profane vocabulary."
        # elif user_data.swear_jar >= 10:
        # 	response_block += "They've said some naughty things in the past."
        # elif user_data.swear_jar >= 5:
        # 	response_block += "They've cussed a handful of times here and there."
        # elif user_data.swear_jar > 0:
        # 	response_block += "They've sworn only a few times."
        # else:
        # 	response_block += "Their mouth is clean as a whistle."

        if len(response_block) > 0:
            response += "\n" + response_block

    return response
Ejemplo n.º 9
0
async def incubate_slimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    if cmd.message.channel.name != ewcfg.channel_slimeoidlab:
        response = "You must go to the NLACU Laboratories in Brawlden to create a Slimeoid."
        # Go to final response

    elif user_data.life_state == ewcfg.life_state_corpse:
        response = "Ghosts cannot interact with the NLACU Lab apparati."
        # Go to final response

    #TODO: change this because player can have more than one slimeoid now
    # this is f*****g brutal. poor slimeoid
    elif slimeoid_data.life_state == ewcfg.slimeoid_state_active:
        response = "You have already created a Slimeoid. Bottle or dissolve your current slimeoid before incubating a new one."
        # Go to final response

    elif slimeoid_data.life_state == ewcfg.slimeoid_state_forming:
        response = "You are already in the process of incubating a Slimeoid."
        # Go to final response

    else:

        #Check if player has too many slimeoids
        slimeoid_count = get_slimeoid_count(user_id=cmd.message.author.id,
                                            server_id=cmd.guild.id)

        if slimeoid_count >= 3:
            response = "You have too many slimeoids."
            # Go to final response

        else:
            #Check if player has a poudrin
            poudrin = bknd_item.find_item(
                item_search=ewcfg.item_id_slimepoudrin,
                id_user=cmd.message.author.id,
                id_server=cmd.guild.id if cmd.guild is not None else None,
                item_type_filter=ewcfg.it_item)
            if poudrin is None:
                response = "You need a slime poudrin."
                # Go to final response

            else:
                # Get arguement for how big the slimeoid should be made
                injected_slime = None
                if cmd.tokens_count > 1:
                    injected_slime = ewutils.getIntToken(tokens=cmd.tokens,
                                                         allow_all=True)
                    # -1 from getIntToken() means use all slime
                    if injected_slime == -1:
                        injected_slime = user_data.slimes

                if injected_slime == None:
                    response = "You must contribute some of your own slime to create a Slimeoid. Specify how much slime you will sacrifice."
                    # Go to final response

                elif injected_slime > user_data.slimes:
                    response = "You do not have that much slime to sacrifice."
                    # Go to final response

                else:
                    # delete a slime poudrin from the player's inventory
                    bknd_item.item_delete(id_item=poudrin.get('id_item'))

                    # Remove slime
                    user_data.change_slimes(n=-injected_slime)

                    # Setup gestating slimeoid
                    level = len(str(injected_slime))
                    slimeoid_data.life_state = ewcfg.slimeoid_state_forming
                    slimeoid_data.level = level
                    slimeoid_data.id_user = str(user_data.id_user)
                    slimeoid_data.id_server = user_data.id_server

                    # Save changes
                    slimeoid_data.persist()
                    user_data.persist()

                    response = "You place a poudrin into a small opening on the console. As you do, a needle shoots up and pricks your finger, intravenously extracting {injected_slime:,} slime from your body. The poudrin is then dropped into the gestation tank. Looking through the observation window, you see what was once your slime begin to seep into the tank and accrete around the poudrin. The incubation of a new Slimeoid has begun! {slime_emote}".format(
                        injected_slime=injected_slime,
                        slime_emote=ewcfg.emote_slime2)
                    # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 10
0
async def change_body_part(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Checks whether slimeoid is a Negaslimeoid or not. For flavor text.
    if slimeoid_data.sltype == ewcfg.sltype_nega:
        slimeoidtype = "Negaslimeoid"
    else:
        slimeoidtype = "Slimeoid"

    # Check if player is in the labs and has a slimeoid incubating
    response = basic_slimeoid_incubation_checks(
        channel_name=cmd.message.channel.name,
        user_data=user_data,
        slimeoid_data=slimeoid_data)
    # If response returns None go to final response

    if response is None:  # Slimeoid is incubating

        button_pressed = None

        # If player does not provide an argument for the button they pressed# Interperate which part player is trying to grow by command name

        cmd_to_change_type = {
            ewcfg.cmd_growbody: ("body", sl_static.body_map),
            ewcfg.cmd_growhead: ("head", sl_static.head_map),
            ewcfg.cmd_growlegs: ("leg", sl_static.mobility_map),
            ewcfg.cmd_growweapon: ("weapon", sl_static.offense_map),
            ewcfg.cmd_growarmor: ("armor", sl_static.defense_map),
            ewcfg.cmd_growspecial: ("special", sl_static.special_map),
            ewcfg.cmd_growbrain: ("brain", sl_static.brain_map),
        }

        # Gets part_map based on command used
        desired_change, part_map = cmd_to_change_type.get(cmd.tokens[0])

        if cmd.tokens_count == 1:
            if slimeoidtype == "Slimeoid":
                response = f"You must specify a {desired_change} type. Choose an option from the buttons on the body console labelled A through G."
            else:
                response = f"You must specify a {desired_change} type. Choose an option with your planchette, from A through G."
            # Go to final response

        else:

            pressed_button = cmd.tokens[1].lower()

            # If it's a negaslimeoid and the desired part is a brain, change letter to the corresponding Negaslimeoid brain.
            if desired_change == "brain" and slimeoidtype == "Negaslimeoid":

                # This is done to keep abcdefg parity with between !growbrain and the other grow commands with negaslimeoids.
                cmd_abcdefg_to_hijklmn = {
                    "a": ("h"),
                    "b": ("i"),
                    "c": ("j"),
                    "d": ("k"),
                    "e": ("l"),
                    "f": ("m"),
                    "g": ("n"),
                }

                pressed_button = cmd_abcdefg_to_hijklmn.get(pressed_button)

            # Check if desired part is in part map
            part = part_map.get(pressed_button)

            # If no part is found
            if part == None:
                if slimeoidtype == "Slimeoid":
                    response = "Choose an option from the buttons on the body console labelled A through G."
                else:
                    response = "Choose an option with your planchette, from A through G."
                # Go to final response

            else:

                #TODO: this could be simplified if slimeoid part id variables to one name
                # e.g. EwSlimeoidBody.id_body and EwSlimeoidBody.id_head were called EwSlimeoidBody.part_id and EwSlimeoidBody.part_id instead
                if desired_change == "body":
                    slimeoid_data.body = part.id_body

                elif desired_change == "head":
                    slimeoid_data.head = part.id_head

                elif desired_change == "leg":
                    slimeoid_data.legs = part.id_mobility

                elif desired_change == "weapon":
                    slimeoid_data.weapon = part.id_offense

                elif desired_change == "armor":
                    slimeoid_data.armor = part.id_defense

                elif desired_change == "special":
                    slimeoid_data.special = part.id_special

                elif desired_change == "brain":
                    slimeoid_data.ai = part.id_brain

                else:
                    response = f"Some thing when wrong with {cmd.tokens[0]} command. Please report bug."  # something when wrong in cmd_to_change_type
                    return await send_response(response, cmd)
                    # Break out of command early because of error

                slimeoid_data.persist()
                response = "{}".format(part.str_create_nega if (
                    user_data.life_state == ewcfg.life_state_corpse
                    and desired_change != "brain") else part.str_create)
                # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 11
0
async def change_stat(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check if player is in the labs and has a slimeoid incubating
    response = basic_slimeoid_incubation_checks(
        channel_name=cmd.message.channel.name,
        user_data=user_data,
        slimeoid_data=slimeoid_data)
    # If response returns None go to final response

    if response is None:  # Slimeoid is incubating

        # Interperate which stat player is trying to change by command name

        cmd_to_change_type = {
            ewcfg.cmd_raisemoxie: "+ moxie",
            ewcfg.cmd_raisegrit: "+ grit",
            ewcfg.cmd_raisechutzpah: "+ chutzpah",
            ewcfg.cmd_lowermoxie: "- moxie",
            ewcfg.cmd_lowergrit: "- grit",
            ewcfg.cmd_lowerchutzpah: "- chutzpah",
        }
        desired_change = cmd_to_change_type.get(cmd.tokens[0])

        moxie_mod = 0
        grit_mod = 0
        chutzpah_mod = 0

        # Plus one stat
        if desired_change == "+ moxie":
            moxie_mod = 1
            changed_stat = "moxie"

        elif desired_change == "+ grit":
            grit_mod = 1
            changed_stat = "grit"

        elif desired_change == "+ chutzpah":
            chutzpah_mod = 1
            changed_stat = "chutzpah"

        # Minus one stat
        elif desired_change == "- moxie":
            moxie_mod = -1
            changed_stat = "moxie"

        elif desired_change == "- grit":
            grit_mod = -1
            changed_stat = "grit"

        elif desired_change == "- chutzpah":
            chutzpah_mod = -1
            changed_stat = "chutzpah"

        else:
            response = f"Some thing when wrong with {cmd.tokens[0]} command. Please report bug."  # something when wrong in cmd_to_change_type
            return await send_response(response, cmd)
            # Break out of command early because of error

        # Now that we no what stat is trying to be changed do the final checks

        available_points = slimeoid_data.level - (
            slimeoid_data.atk +
            moxie_mod) - (slimeoid_data.defense +
                          grit_mod) - (slimeoid_data.intel + chutzpah_mod)

        # Check if stat points are available
        if (available_points < 0):
            response = "You have allocated all of your Slimeoid's potential. Try !lowering some of its attributes first."
            response += stat_breakdown_str(slimeoid_data.atk,
                                           slimeoid_data.defense,
                                           slimeoid_data.intel,
                                           available_points + 1)
            # Go to final response

        # Check if player is trying to lower a stat below zero
        elif ((slimeoid_data.atk + moxie_mod < 0)
              or (slimeoid_data.defense + grit_mod < 0)
              or (slimeoid_data.intel + chutzpah_mod < 0)):
            response = f"You cannot reduce your slimeoid's {changed_stat} any further."
            response += stat_breakdown_str(slimeoid_data.atk,
                                           slimeoid_data.defense,
                                           slimeoid_data.intel,
                                           available_points - 1)

        elif (available_points >= slimeoid_data.level):
            response = f"You cannot reduce your slimeoid's {changed_stat} any further."
            response += stat_breakdown_str(slimeoid_data.atk,
                                           slimeoid_data.defense,
                                           slimeoid_data.intel,
                                           available_points - 1)
            # Go to final response

        # Command successful
        else:

            # Change slimeoid stats
            slimeoid_data.atk += moxie_mod
            slimeoid_data.defense += grit_mod
            slimeoid_data.intel += chutzpah_mod
            # Save changes
            slimeoid_data.persist()

            # Generate response
            if (moxie_mod + grit_mod + chutzpah_mod > 0):
                response = f"Your gestating slimeoid gains more {changed_stat}."
            else:
                response = f"Your gestating slimeoid loses some {changed_stat}."
            response += stat_breakdown_str(slimeoid_data.atk,
                                           slimeoid_data.defense,
                                           slimeoid_data.intel,
                                           available_points)
            # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 12
0
async def change_body_part(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check if player is in the labs and has a slimeoid incubating
    response = basic_slimeoid_incubation_checks(
        channel_name=cmd.message.channel.name,
        user_data=user_data,
        slimeoid_data=slimeoid_data)
    # If response returns None go to final response

    if response is None:  # Slimeoid is incubating

        button_pressed = None

        # If player does not provide an argument for the button they pressed# Interperate which part player is trying to grow by command name

        cmd_to_change_type = {
            ewcfg.cmd_growbody: ("body", sl_static.body_map),
            ewcfg.cmd_growhead: ("head", sl_static.head_map),
            ewcfg.cmd_growlegs: ("leg", sl_static.mobility_map),
            ewcfg.cmd_growweapon: ("weapon", sl_static.offense_map),
            ewcfg.cmd_growarmor: ("armor", sl_static.defense_map),
            ewcfg.cmd_growspecial: ("special", sl_static.special_map),
            ewcfg.cmd_growbrain: ("brain", sl_static.brain_map),
        }

        # Gets part_map based on command used
        desired_change, part_map = cmd_to_change_type.get(cmd.tokens[0])

        if cmd.tokens_count == 1:
            response = f"You must specify a {desired_change} type. Choose an option from the buttons on the body console labelled A through G."
            # Go to final response

        else:

            pressed_button = cmd.tokens[1].lower()

            # Check if desired part is in part map
            part = part_map.get(pressed_button)

            # If no part is found
            if part == None:
                response = "Choose an option from the buttons on the body console labelled A through G."
                # Go to final response

            else:

                #TODO: this could be simplified if slimeoid part id variables to one name
                # e.g. EwSlimeoidBody.id_body and EwSlimeoidBody.id_head were called EwSlimeoidBody.part_id and EwSlimeoidBody.part_id instead
                if desired_change == "body":
                    slimeoid_data.body = part.id_body

                elif desired_change == "head":
                    slimeoid_data.head = part.id_head

                elif desired_change == "leg":
                    slimeoid_data.legs = part.id_mobility

                elif desired_change == "weapon":
                    slimeoid_data.weapon = part.id_offense

                elif desired_change == "armor":
                    slimeoid_data.armor = part.id_defense

                elif desired_change == "special":
                    slimeoid_data.special = part.id_special

                elif desired_change == "brain":
                    slimeoid_data.ai = part.id_brain

                else:
                    response = f"Some thing when wrong with {cmd.tokens[0]} command. Please report bug."  # something when wrong in cmd_to_change_type
                    return await send_response(response, cmd)
                    # Break out of command early because of error

                slimeoid_data.persist()
                response = "{}".format(part.str_create)
                # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 13
0
async def piss(cmd):
    user_data = EwUser(member=cmd.message.author)
    mutations = user_data.get_mutations()

    if ewcfg.mutation_id_enlargedbladder in mutations:

        user_data.change_crime(n=1)
        user_data.persist()

        cosmetics = bknd_item.inventory(id_user=user_data.id_user, id_server=cmd.guild.id,
                                        item_type_filter=ewcfg.it_cosmetic)
        protected = False
        for cosmetic in cosmetics:
            cosmetic_data = EwItem(id_item=cosmetic.get('id_item'))
            if cosmetic_data.item_props.get('id_cosmetic') == 'chastitybelt':
                if cosmetic_data.item_props.get('adorned') == 'true':
                    protected = True

        if protected == True:
            response = "Reaching for your weewee, you instead hear the desolate metal clank of your hand against a steel groincage. Damn you, chastity belt. DAMN YOU TO HELL!!! "
            return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        if cmd.mentions_count == 0:
            response = "You unzip your dick and just start pissing all over the goddamn f*****g floor. God, you’ve waited so long for this moment, and it’s just as perfect as you could have possibly imagined. You love pissing so much."
            if random.randint(1, 100) < 2:
                slimeoid = EwSlimeoid(member=cmd.message.author)
                if slimeoid.life_state == ewcfg.slimeoid_state_active:
                    hue = hue_static.hue_map.get("yellow")
                    response = "CONGRATULATIONS. You suddenly lose control of your HUGE C**K and saturate your {} with your PISS. {}".format(slimeoid.name, hue.str_saturate)
                    slimeoid.hue = (hue_static.hue_map.get("yellow")).id_hue
                    slimeoid.persist()
            return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        if cmd.mentions_count == 1:
            target_member = cmd.mentions[0]
            target_user_data = EwUser(member=target_member)

            if user_data.id_user == target_user_data.id_user:
                response = "Your love for piss knows no bounds. You aim your urine stream sky high, causing it to land right back into your own mouth. Mmmm, tasty~!"
                return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

            if user_data.poi == target_user_data.poi:

                if target_user_data.life_state == ewcfg.life_state_corpse:
                    response = "You piss right through them! Their ghostly form ripples as the stream of urine pours endlessly unto them."
                    return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                response = "You piss HARD and FAST right onto {}!!".format(target_member.display_name)
            else:
                response = "You can't !piss on someone who isn't there! Moron!"

        elif cmd.mentions_count > 1:
            response = "Whoa, one water-sports fetishist at a time, pal!"

    elif user_data.life_state == ewcfg.life_state_corpse:
        if cmd.mentions_count == 0:
            response = "You grow a ghost dick, unzip it, and just start ghost pissing all over the goddamn f*****g floor. God, you’ve waited so long for this moment, and it’s just as perfect as you could have possibly imagined. You love ghost pissing so much."
            if random.randint(1, 100) < 3:
                response = "You grow a gussy, unzip it, and just start ghost pissing all over the goddamn f*****g floor. God, you've waited so long for this moment, and it's just as perfect as you could have possibly imagined. You love ghost pissing so much."
            return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        if cmd.mentions_count == 1:
            target_member = cmd.mentions[0]
            target_user_data = EwUser(member=target_member)

            if user_data.id_user == target_user_data.id_user:
                response = "Your love for negapiss knows no bounds. You aim your antiurine stream sky high, causing it to land right back into your own ghastly mouth. Mmmm, tasty~!"
                return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

            if user_data.poi == target_user_data.poi:

                if target_user_data.life_state == ewcfg.life_state_corpse:
                    response = "You ghost piss HARD and FAST right onto {}!!".format(target_member.display_name)
                    return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                response = "Your ghost piss passes right through them! {} seems annoyed at the negapiss you're streaming at them, but they're entirely unaffected.".format(target_member.display_name)
            else:
                response = "You can't !piss on someone who isn't there! Moron!"

        elif cmd.mentions_count > 1:
            response = "Whoa, one necrophiliac at a time, pal!"

    else:
        response = "You lack the moral fiber necessary for urination."

    return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 14
0
def can_slimeoid_battle(challenger: EwUser = None,
                        challengee=None,
                        challenger_slimeoid: EwSlimeoid = None,
                        challengee_slimeoid: EwSlimeoid = None,
                        bet: int = 0):
    response = ""
    time_now = int(time.time())
    # Gotta have a challenger, otherwise do nothing
    if challenger:
        challenger_data = challenger
        challenger_player = EwPlayer(id_user=challenger_data.id_user)
        ally_slimeoid = None
        target_slimeoid = None

        # If supplied a slimeoid, use that - otherwise we just grab it
        if challenger_slimeoid:
            ally_slimeoid = challenger_slimeoid
        else:
            ally_slimeoid = EwSlimeoid(member=challenger)

        # Challenger

        # Check for slimeoid's type - for flavor text
        if ally_slimeoid.sltype == ewcfg.sltype_nega:
            slimeoidtype = "Negaslimeoid"
        else:
            slimeoidtype = "Slimeoid"

        if ally_slimeoid.life_state != ewcfg.slimeoid_state_active:
            response = "You do not have a Slimeoid ready to battle with!"

        # Checks if the player is dead and if they're trying to battle with a slimeoid
        elif challenger_data.life_state == ewcfg.life_state_corpse and ally_slimeoid.sltype != ewcfg.sltype_nega:
            response = "Your Slimeoid won't battle for you while you're dead."

        elif (time_now -
              ally_slimeoid.time_defeated) < ewcfg.cd_slimeoiddefeated:
            time_until = ewcfg.cd_slimeoiddefeated - (
                time_now - ally_slimeoid.time_defeated)
            response = "Your {} is still recovering from its last defeat! It'll be ready in {} seconds.".format(
                slimeoidtype, int(time_until))

        elif ewutils.active_slimeoidbattles.get(ally_slimeoid.id_slimeoid):
            response = "You are already in the middle of a challenge."

        elif challengee:
            # If the opponent isn't a player, set pvp to false. Set data.
            if isinstance(challengee, EwEnemy):
                challengee_data = challengee
                is_pvp = False
            else:
                challengee_data = challengee
                challengee_player = EwPlayer(id_user=challengee.id_user)
                is_pvp = True

            if challengee_slimeoid:
                target_slimeoid = challengee_slimeoid
            else:
                target_slimeoid = EwSlimeoid(member=challengee)

            # Check for slimeoid's type - for flavor text.
            if target_slimeoid.sltype == ewcfg.sltype_nega:
                slimeoidtype = "Negaslimeoid"
            else:
                slimeoidtype = "Slimeoid"

            # If slimeoid isn't alive, then they can't battle.
            if target_slimeoid.life_state != ewcfg.slimeoid_state_active:
                response = "{} does not have a Slimeoid ready to battle with!".format(
                    challengee_player.
                    display_name if is_pvp else challengee_data.display_name)

            elif challenger_data.poi != challengee_data.poi:
                response = "Both players must be in the same place."

            # Checks if each player has enough slime if there is a bet
            elif (challenger_data.slimes < bet
                  or challenger_data.slimes < 0) and bet != 0:
                response = "You don't have enough slime!"
            elif (challengee_data.slimes < bet
                  or challengee_data.slimes < 0) and bet != 0:
                response = "They don't have enough slime!"

            # If a player is a ghost and has a living slimeoid, then they can't battle.
            elif challengee_data.life_state == ewcfg.life_state_corpse and challengee_slimeoid.sltype != ewcfg.sltype_nega:
                response = "{}'s Slimeoid won't battle for them while they're dead.".format(
                    challengee_player.display_name).replace("@", "\{at\}")

            elif (time_now -
                  target_slimeoid.time_defeated) < ewcfg.cd_slimeoiddefeated:
                time_until = ewcfg.cd_slimeoiddefeated - (
                    time_now - target_slimeoid.time_defeated)
                response = "{}'s {} is still recovering from its last defeat! It'll be ready in {} seconds.".format(
                    challengee_player.display_name, slimeoidtype,
                    int(time_until))

            elif ewutils.active_slimeoidbattles.get(
                    target_slimeoid.id_slimeoid):
                response = "They are already in the middle of a challenge."

        return response
Ejemplo n.º 15
0
async def destroy_slimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check of the player is alive
    if user_data.life_state != ewcfg.life_state_corpse:
        response = "You... want to destroy your Slimeoid? That's, like, sorta illegal."

    # Check if the player isn't at Waffle House as a ghost
    elif user_data.life_state == ewcfg.life_state_corpse and cmd.message.channel.name != ewcfg.channel_wafflehouse:
        response = "Slimeoids don't f**k with ghosts."

    # Check if the player has a slimeoid
    elif slimeoid_data.life_state == ewcfg.slimeoid_state_none:
        response = "Good news! You don't have a Slimeoid. So no need to destroy one."

    # If all of those don't work
    else:
        # Creates each type-specific heart. Also turns the slimeoid's type into a string, for flavor text purposes.
        if slimeoid_data.sltype == ewcfg.sltype_lab:
            # Creates string "Slimeoid"
            slimeoid_type = "Slimeoid"

            # Forming slimeoids DON'T drop hearts
            if slimeoid_data.life_state != ewcfg.slimeoid_state_forming:
                # Creates the item props for the slimeoid heart
                item_props = {
                    'context':
                    ewcfg.context_slimeoidheart,
                    'subcontext':
                    slimeoid_data.id_slimeoid,
                    'item_name':
                    "Heart of {}".format(slimeoid_data.name),
                    'item_desc':
                    "A poudrin-like crystal. If you listen carefully you can hear something that sounds like a faint heartbeat."
                }
                # Creates the item in downtown
                bknd_item.item_create(id_user=ewcfg.channel_downtown,
                                      id_server=cmd.guild.id,
                                      item_type=ewcfg.it_item,
                                      item_props=item_props)
        else:
            # Creates string "Negaslimeoid"
            slimeoid_type = "Negaslimeoid"

            # Forming negaslimeoids DON'T drop cores
            if slimeoid_data.life_state != ewcfg.slimeoid_state_forming:
                # Creates the item props for the negaslimeoid core
                item_props = {
                    'context':
                    ewcfg.context_negaslimeoidheart,
                    'subcontext':
                    slimeoid_data.id_slimeoid,
                    'item_name':
                    "Core of {}".format(slimeoid_data.name),
                    'item_desc':
                    "A smooth, inert rock. If you listen carefully you can hear otherworldly whispering."
                }
                # Creates the item at Waffle House
                bknd_item.item_create(id_user=ewcfg.channel_wafflehouse,
                                      id_server=cmd.guild.id,
                                      item_type=ewcfg.it_item,
                                      item_props=item_props)

        cosmetics = bknd_item.inventory(id_user=cmd.message.author.id,
                                        id_server=cmd.guild.id,
                                        item_type_filter=ewcfg.it_cosmetic)

        # get the cosmetics worn by the slimeoid
        for item in cosmetics:
            cos = EwItem(id_item=item.get('id_item'))
            if cos.item_props.get('slimeoid') == 'true':
                cos.item_props['slimeoid'] = 'false'
                cos.persist()

        # Craft the response
        response = "You think upon your past and spiritually connect with {} the {}. With the Ouija® Board in front of you, you spell out the forbidden words: \n\n\"lol\" \"lmao\" \n\nYour former companion is rended across space and time. All that remains is their {}, though unobtainable by you. {}".format(
            slimeoid_data.name, slimeoid_type,
            "heart" if slimeoid_type == "Slimeoid" else "core",
            ewcfg.emote_slimeskull)

        # Kill the slimeoid and persist
        slimeoid_data.die()
        slimeoid_data.persist()
        user_data.active_slimeoid = -1

        # Take some of the player's negaslime for destroying a slimeoid.
        if user_data.slimes < 0:
            user_data.slimes -= user_data.slimes / 10
            user_data.persist()

        # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 16
0
async def spawn_slimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check if player is in the appropriate POI and has a slimeoid incubating
    response = basic_slimeoid_incubation_checks(
        channel_name=cmd.message.channel.name,
        user_data=user_data,
        slimeoid_data=slimeoid_data)
    # If response returns None go to final response

    if response is None:  # Slimeoid is incubating

        incomplete = False
        required_parts_explanation = ""

        # Check for flavor text purposes
        if slimeoid_data.sltype == ewcfg.sltype_nega:
            slimeoidtype = "Negaslimeoid"
        else:
            slimeoidtype = "Slimeoid"

        # Check if parts are missing
        # Bold missing part names for visual clarity
        if (slimeoid_data.body == ""):
            incomplete = True
            required_parts_explanation += "\nIts **BODY** has not yet been given a distinct form."

        if (slimeoid_data.head == ""):
            incomplete = True
            required_parts_explanation += "\nIt does not yet have a **HEAD**."

        if (slimeoid_data.legs == ""):
            incomplete = True
            required_parts_explanation += "\nIt has no **LEGS** or means of locomotion."

        if (slimeoid_data.weapon == ""):
            incomplete = True
            required_parts_explanation += "\nIt lacks a means of **WEAPON**."

        if (slimeoid_data.armor == ""):
            incomplete = True
            required_parts_explanation += "\nIt lacks any form of **ARMOR**."

        if (slimeoid_data.special == ""):
            incomplete = True
            required_parts_explanation += "\nIt lacks a **SPECIAL** ability."

        if (slimeoid_data.ai == ""):
            incomplete = True
            required_parts_explanation += "\nIt does not yet have a **BRAIN**."

        if ((slimeoid_data.atk + slimeoid_data.defense + slimeoid_data.intel) <
            (slimeoid_data.level)):
            incomplete = True
            required_parts_explanation += "\nIt still has potential that must be distributed between **MOXIE**, **GRIT** and **CHUTZPAH**."

        if (slimeoid_data.name == ""):
            incomplete = True
            required_parts_explanation += "\nIt needs a **NAME**."

        if incomplete:
            # Add explanation of which parts need to be added
            if slimeoidtype == "Slimeoid":
                response = f"Your Slimeoid is not yet ready to be spawned from the gestation vat. {required_parts_explanation}"
            else:
                response = f"Your Negaslimeoid is not yet fully conjured by the Ancient Ones. {required_parts_explanation}"
            # Go to final response

        else:
            # Set slimeoid as active
            slimeoid_data.life_state = ewcfg.slimeoid_state_active
            # Save slimeoid
            slimeoid_data.persist()

            # Generate spawning flavor text
            if slimeoidtype == "Slimeoid":
                response = "You press the big red button labelled 'SPAWN'. The console lights up and there is a rush of mechanical noise as the fluid drains rapidly out of the gestation tube. The newly born Slimeoid within writhes in confusion before being sucked down an ejection chute and spat out messily onto the laboratory floor at your feet. Happy birthday, {slimeoid_name} the Slimeoid!! {slime_heart_emote}".format(
                    slimeoid_name=slimeoid_data.name,
                    slime_heart_emote=ewcfg.emote_slimeheart)
            else:
                response = "You move the Ouija® planchette to 'GOOD BYE'. The whispering around you explodes into a roaring chorus, nearly deafening your ghost ears. The pile of negaslime in front of you, now resembling a Negaslimeoid, ambles towards you. With a blood-curdling screech, the chorus around you dies. Your unholy abomination {slimeoid_name} the Negaslimeoid has been conjured!! {negaslime_emote}".format(
                    slimeoid_name=slimeoid_data.name,
                    negaslime_emote=ewcfg.emote_negaslime)

            # Add slimeoid description
            response += "\n\n{} is a {}-foot-tall {}.".format(
                slimeoid_data.name, str(slimeoid_data.level), slimeoidtype)
            response += slimeoid_utils.slimeoid_describe(slimeoid_data)

            # Add slimeoid's reaction based on brain type
            brain = sl_static.brain_map.get(slimeoid_data.ai)
            response += "\n\n" + brain.str_spawn.format(
                slimeoid_name=slimeoid_data.name)
            # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 17
0
async def sow(cmd):
    user_data = EwUser(member=cmd.message.author)
    if user_data.life_state == ewcfg.life_state_shambler:
        response = "You lack the higher brain functions required to {}.".format(
            cmd.tokens[0])
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    # check if the user has a farming tool equipped
    weapon_item = EwItem(id_item=user_data.weapon)
    weapon = static_weapons.weapon_map.get(
        weapon_item.item_props.get("weapon_type"))
    has_tool = False
    if weapon is not None:
        if ewcfg.weapon_class_farming in weapon.classes:
            has_tool = True

    # Checking availability of sow action
    if user_data.life_state != ewcfg.life_state_juvenile:
        response = "Only Juveniles of pure heart and with nothing better to do can farm."

    elif cmd.message.channel.name not in [
            ewcfg.channel_jr_farms, ewcfg.channel_og_farms,
            ewcfg.channel_ab_farms
    ]:
        response = "The cracked, filthy concrete streets around you would be a pretty terrible place for a farm. Try again on more arable land."

    else:
        poi = poi_static.id_to_poi.get(user_data.poi)
        district_data = EwDistrict(district=poi.id_poi,
                                   id_server=user_data.id_server)

        if district_data.is_degraded():
            response = "{} has been degraded by shamblers. You can't {} here anymore.".format(
                poi.str_name, cmd.tokens[0])
            return await fe_utils.send_message(
                cmd.client, cmd.message.channel,
                fe_utils.formatMessage(cmd.message.author, response))
        if user_data.poi == ewcfg.poi_id_jr_farms:
            farm_id = ewcfg.poi_id_jr_farms
        elif user_data.poi == ewcfg.poi_id_og_farms:
            farm_id = ewcfg.poi_id_og_farms
        else:  # if it's the farm in arsonbrook
            farm_id = ewcfg.poi_id_ab_farms

        farm = EwFarm(id_server=cmd.guild.id,
                      id_user=cmd.message.author.id,
                      farm=farm_id)

        if farm.time_lastsow > 0:
            response = "You’ve already sown something here. Try planting in another farming location. If you’ve planted in all three farming locations, you’re shit out of luck. Just wait, asshole."
        else:
            it_type_filter = None

            # gangsters can only plant poudrins
            if cmd.tokens_count > 1 and user_data.life_state == ewcfg.life_state_juvenile:
                item_search = ewutils.flattenTokenListToString(cmd.tokens[1:])

                # if the item selected was a vegetable, use a food only filter in find_item
                for v in static_food.vegetable_list:
                    if item_search in v.id_food or item_search in v.str_name:
                        it_type_filter = ewcfg.it_food
                        break
            else:
                item_search = "slimepoudrin"

            item_sought = bknd_item.find_item(
                item_search=item_search,
                id_user=cmd.message.author.id,
                id_server=cmd.guild.id if cmd.guild is not None else None,
                item_type_filter=it_type_filter)

            if item_sought == None:
                response = "You don't have anything to plant! Try collecting a poudrin."
            else:
                slimes_onreap = ewcfg.reap_gain
                item_data = EwItem(id_item=item_sought.get("id_item"))
                if item_data.item_type == ewcfg.it_item:
                    if item_data.item_props.get(
                            "id_item") == ewcfg.item_id_slimepoudrin:
                        vegetable = random.choice(static_food.vegetable_list)
                        slimes_onreap *= 2
                    elif item_data.item_props.get(
                            "context") == ewcfg.context_slimeoidheart:
                        vegetable = random.choice(static_food.vegetable_list)
                        slimes_onreap *= 2

                        slimeoid_data = EwSlimeoid(
                            id_slimeoid=item_data.item_props.get("subcontext"))
                        slimeoid_data.delete()

                    else:
                        response = "The soil has enough toxins without you burying your trash here."
                        return await fe_utils.send_message(
                            cmd.client, cmd.message.channel,
                            fe_utils.formatMessage(cmd.message.author,
                                                   response))
                elif item_data.item_type == ewcfg.it_food:
                    food_id = item_data.item_props.get("id_food")
                    vegetable = static_food.food_map.get(food_id)
                    if ewcfg.vendor_farm not in vegetable.vendors:
                        response = "It sure would be nice if {}s grew on trees, but alas they do not. Idiot.".format(
                            item_sought.get("name"))
                        return await fe_utils.send_message(
                            cmd.client, cmd.message.channel,
                            fe_utils.formatMessage(cmd.message.author,
                                                   response))
                    elif user_data.life_state != ewcfg.life_state_juvenile:
                        response = "You lack the knowledge required to grow {}.".format(
                            item_sought.get("name"))
                        return await fe_utils.send_message(
                            cmd.client, cmd.message.channel,
                            fe_utils.formatMessage(cmd.message.author,
                                                   response))

                else:
                    response = "The soil has enough toxins without you burying your trash here."
                    return await fe_utils.send_message(
                        cmd.client, cmd.message.channel,
                        fe_utils.formatMessage(cmd.message.author, response))

                mutations = user_data.get_mutations()
                growth_time = ewcfg.crops_time_to_grow
                if user_data.life_state == ewcfg.life_state_juvenile:
                    growth_time /= 2
                if ewcfg.mutation_id_greenfingers in mutations:
                    growth_time /= 1.5

                hours = int(growth_time / 60)
                minutes = int(growth_time % 60)

                str_growth_time = "{} hour{}{}".format(
                    hours, "s" if hours > 1 else "",
                    " and {} minutes".format(minutes) if minutes > 0 else "")

                # Sowing
                response = "You sow a {} into the fertile soil beneath you. It will grow in about {}.".format(
                    item_sought.get("name"), str_growth_time)

                farm.time_lastsow = int(time.time() /
                                        60)  # Grow time is stored in minutes.
                farm.time_lastphase = int(time.time())
                farm.slimes_onreap = slimes_onreap
                farm.crop = vegetable.id_food
                farm.phase = ewcfg.farm_phase_sow
                farm.action_required = ewcfg.farm_action_none
                farm.sow_life_state = user_data.life_state
                if ewcfg.mutation_id_greenfingers in mutations:
                    if user_data.life_state == ewcfg.life_state_juvenile:
                        farm.sow_life_state = ewcfg.farm_life_state_juviethumb
                    else:
                        farm.sow_life_state = ewcfg.farm_life_state_thumb

                bknd_item.item_delete(
                    id_item=item_sought.get('id_item'))  # Remove Poudrins

                farm.persist()

    await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 18
0
async def spawn_slimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check if player is in the labs and has a slimeoid incubating
    response = basic_slimeoid_incubation_checks(
        channel_name=cmd.message.channel.name,
        user_data=user_data,
        slimeoid_data=slimeoid_data)
    # If response returns None go to final response

    if response is None:  # Slimeoid is incubating
        incomplete = False
        required_parts_explanation = ""

        # Check if parts are missing
        # Bold missing part names for visual clarity
        if (slimeoid_data.body == ""):
            incomplete = True
            required_parts_explanation += "\nIts **BODY** has not yet been given a distinct form."

        if (slimeoid_data.head == ""):
            incomplete = True
            required_parts_explanation += "\nIt does not yet have a **HEAD**."

        if (slimeoid_data.legs == ""):
            incomplete = True
            required_parts_explanation += "\nIt has no **LEGS** or means of locomotion."

        if (slimeoid_data.weapon == ""):
            incomplete = True
            required_parts_explanation += "\nIt lacks a means of **WEAPON**."

        if (slimeoid_data.armor == ""):
            incomplete = True
            required_parts_explanation += "\nIt lacks any form of **ARMOR**."

        if (slimeoid_data.special == ""):
            incomplete = True
            required_parts_explanation += "\nIt lacks a **SPECIAL** ability."

        if (slimeoid_data.ai == ""):
            incomplete = True
            required_parts_explanation += "\nIt does not yet have a **BRAIN**."

        if ((slimeoid_data.atk + slimeoid_data.defense + slimeoid_data.intel) <
            (slimeoid_data.level)):
            incomplete = True
            required_parts_explanation += "\nIt still has potential that must be distributed between **MOXIE**, **GRIT** and **CHUTZPAH**."

        if (slimeoid_data.name == ""):
            incomplete = True
            required_parts_explanation += "\nIt needs a **NAME**."

        if incomplete:
            # Add explanation of which parts need to be added
            response = f"Your slimeoid is not yet ready to be spawned from the gestation vat. {required_parts_explanation}"
            # Go to final response

        else:
            # Set slimeoid as active
            slimeoid_data.life_state = ewcfg.slimeoid_state_active
            # Save slimeoid
            slimeoid_data.persist()

            # Generate spawning flavor text
            response = "You press the big red button labelled 'SPAWN'. The console lights up and there is a rush of mechanical noise as the fluid drains rapidly out of the gestation tube. The newly born Slimeoid within writhes in confusion before being sucked down an ejection chute and spat out messily onto the laboratory floor at your feet. Happy birthday, {slimeoid_name} the Slimeoid!! {slime_heart_emote}".format(
                slimeoid_name=slimeoid_data.name,
                slime_heart_emote=ewcfg.emote_slimeheart)

            # Add slimeoid description
            response += "\n\n{} is a {}-foot-tall Slimeoid.".format(
                slimeoid_data.name, str(slimeoid_data.level))
            response += slimeoid_utils.slimeoid_describe(slimeoid_data)

            # Add slimeoid's reaction based on brain type
            brain = sl_static.brain_map.get(slimeoid_data.ai)
            response += "\n\n" + brain.str_spawn.format(
                slimeoid_name=slimeoid_data.name)
            # Go to final response

    # Final response
    await send_response(response, cmd)
Ejemplo n.º 19
0
async def revive(cmd, player_auto=None):
    time_now = int(time.time())
    response = ""

    if cmd.message.channel.name != ewcfg.channel_endlesswar and cmd.message.channel.name != ewcfg.channel_sewers and player_auto is None:
        response = "Come to me. I hunger. #{}.".format(ewcfg.channel_sewers)
    else:
        if player_auto:
            player_data = EwUser(id_server=cmd.guild.id, id_user=player_auto)
        else:
            player_data = EwUser(member=cmd.message.author)

        # time_until_revive = (player_data.time_lastdeath + 600) - time_now
        time_until_revive = (player_data.time_lastdeath) - time_now

        if time_until_revive > 0 and player_auto is None:
            response = "ENDLESS WAR is not ready to {} you yet ({}s).".format(
                cmd.tokens[0], time_until_revive)
            return await fe_utils.send_message(
                cmd.client, cmd.message.channel,
                fe_utils.formatMessage(cmd.message.author, response))

        slimeoid = EwSlimeoid(member=cmd.message.author)

        if player_data.life_state == ewcfg.life_state_corpse:
            market_data = EwMarket(id_server=cmd.guild.id)

            # Endless War collects his fee.
            # fee = (player_data.slimecoin / 10)
            # player_data.change_slimecoin(n = -fee, coinsource = ewcfg.coinsource_revival)
            # market_data.slimes_revivefee += fee
            # player_data.busted = False

            # Preserve negaslime
            if player_data.slimes < 0:
                # market_data.negaslime += player_data.slimes
                player_data.change_slimes(n=-player_data.slimes)  # set to 0

            # reset slimelevel to zero
            player_data.slimelevel = 0

            # Set time of last revive. This used to provied spawn protection, but currently isn't used.
            player_data.time_lastrevive = time_now

            if False:  #player_data.degradation >= 100:
                player_data.life_state = ewcfg.life_state_shambler
                player_data.change_slimes(n=0.5 * ewcfg.slimes_shambler)
                player_data.trauma = ""
                poi_death = poi_static.id_to_poi.get(player_data.poi_death)
                if move_utils.inaccessible(poi=poi_death,
                                           user_data=player_data):
                    player_data.poi = ewcfg.poi_id_endlesswar
                else:
                    player_data.poi = poi_death.id_poi
            else:
                # Set life state. This is what determines whether the player is actually alive.
                player_data.life_state = ewcfg.life_state_juvenile
                # Give player some initial slimes.
                player_data.change_slimes(n=ewcfg.slimes_onrevive)
                # Get the player out of the sewers.
                player_data.poi = ewcfg.poi_id_endlesswar

            # Give newly spawned juvies a foul odour
            player_data.applyStatus(ewcfg.status_repelled_id)

            player_data.persist()
            market_data.persist()

            # Shower every district in the city with slime from the sewers.
            sewer_data = EwDistrict(district=ewcfg.poi_id_thesewers,
                                    id_server=cmd.guild.id)
            # the amount of slime showered is divided equally amongst the districts
            districts_amount = len(poi_static.capturable_districts)
            geyser_amount = int(0.5 * sewer_data.slimes / districts_amount)
            # Get a list of all the districts
            for poi in poi_static.capturable_districts:
                district_data = EwDistrict(district=poi,
                                           id_server=cmd.guild.id)

                district_data.change_slimes(n=geyser_amount)
                sewer_data.change_slimes(n=-1 * geyser_amount)

                district_data.persist()
                sewer_data.persist()

            sewer_inv = bknd_item.inventory(id_user=sewer_data.name,
                                            id_server=sewer_data.id_server)
            for item in sewer_inv:
                district = ewcfg.poi_id_slimesea
                if random.random() < 0.5:
                    district = random.choice(poi_static.capturable_districts)
                bknd_item.give_item(id_item=item.get("id_item"),
                                    id_user=district,
                                    id_server=sewer_data.id_server)

            await ewrolemgr.updateRoles(client=cmd.client,
                                        member=cmd.message.author)

            response = '{slime4} Geysers of fresh slime erupt from every manhole in the city, showering their surrounding districts. {slime4} {name} has been reborn in slime. {slime4}'.format(
                slime4=ewcfg.emote_slime4,
                name=cmd.message.author.display_name)
        else:
            response = 'You\'re not dead just yet.'

        #	deathreport = "You were {} by {}. {}".format(kill_descriptor, cmd.message.author.display_name, ewcfg.emote_slimeskull)
        #	deathreport = "{} ".format(ewcfg.emote_slimeskull) + fe_utils.formatMessage(member, deathreport)

        if slimeoid.life_state == ewcfg.slimeoid_state_active:
            reunite = ""
            brain = sl_static.brain_map.get(slimeoid.ai)
            reunite += brain.str_revive.format(slimeoid_name=slimeoid.name)
            new_poi = poi_static.id_to_poi.get(player_data.poi)
            revivechannel = fe_utils.get_channel(cmd.guild, new_poi.channel)
            reunite = fe_utils.formatMessage(cmd.message.author, reunite)
            await fe_utils.send_message(cmd.client, revivechannel, reunite)

    # Send the response to the player.
    await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 20
0
async def incubate_negaslimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check for if the player is a corpse
    if user_data.life_state != ewcfg.life_state_corpse:
        if cmd.message.channel.name == ewcfg.channel_wafflehouse:
            response = "You feel as though there is some ancient power here, but the slime coursing through your veins prevents you from using it."
        else:
            response = "Huh? What'd you say?"

    # Check for if the player is at Waffle House
    elif cmd.message.channel.name != ewcfg.channel_wafflehouse:
        response = "You can't exactly summon anything in {}. Go to Waffle House first.".format(
            cmd.message.channel.name)

    # Check if the player already has a Slimeoid or a Negaslimeoid.
    elif slimeoid_data.life_state == ewcfg.slimeoid_state_active:
        if slimeoid_data.sltype == ewcfg.sltype_nega:
            response = "You already have a Negaslimeoid by your side. Destroy your current Negaslimeoid before you commune with the Ancient Ones yet again."
        else:
            response = "You wish to summon a Negaslimeoid, yet you have a Slimeoid that still calls you its master. !destroyslimeoid if you wish to commune with the Ancient Ones properly."

    # Check if the player is already incubating a Slimeoid or Negaslimeoid
    elif slimeoid_data.life_state == ewcfg.slimeoid_state_forming:
        if slimeoid_data.sltype == ewcfg.sltype_nega:
            response = "You are already in the process of conjuring a Negaslimeoid."
        else:
            response = "You wish to summon a Negaslimeoid, yet you have a Slimeoid that is still yet to call you its master. !destroyslimeoid if you wish to commune with the Ancient Ones properly."

    else:

        #Check if player has too many slimeoids
        slimeoid_count = get_slimeoid_count(user_id=cmd.message.author.id,
                                            server_id=cmd.guild.id)

        if slimeoid_count >= 3:
            response = "You have too many slimeoids."
            # Go to final response

        else:
            #Check if player has a negapoudrin
            negapoudrin = bknd_item.find_item(
                item_search=ewcfg.item_id_negapoudrin,
                id_user=cmd.message.author.id,
                id_server=cmd.guild.id if cmd.guild is not None else None,
                item_type_filter=ewcfg.it_item)
            if negapoudrin is None:
                response = "You need a negapoudrin to bind a Negaslimeoid to your command."
                # Go to final response

            else:
                # Get argument for how big the negaslimeoid should be made
                sacrificed_negaslime = None
                if cmd.tokens_count > 1:
                    # -1 from getIntToken() could possibly be gotten from player input, so do a check here.
                    if cmd.tokens[1] == "all":
                        if user_data.slimes < 0:
                            sacrificed_negaslime = -user_data.slimes

                    else:
                        print(cmd.tokens[0])
                        sacrificed_negaslime = ewutils.getIntToken(
                            tokens=cmd.tokens)
                        if sacrificed_negaslime < 0:
                            sacrificed_negaslime = -sacrificed_negaslime

                # Check if player sacrificed any negaslime or if they have enough to sacrifice.
                if sacrificed_negaslime == None:
                    response = "You must sacrifice your own negaslime to conjure a Negaslimeoid. Specify how much negaslime you will sacrifice."
                    # Go to final response

                elif -sacrificed_negaslime < user_data.slimes:
                    response = "You do not have that much negaslime to sacrifice."
                    # Go to final response

                else:
                    # delete a negapoudrin from the player's inventory
                    bknd_item.item_delete(id_item=negapoudrin.get('id_item'))

                    # Remove negaslime
                    user_data.change_slimes(n=+sacrificed_negaslime)

                    # Establish these stats for conjuring the negaslimeoid
                    level = len(str(sacrificed_negaslime))
                    slimeoid_data.life_state = ewcfg.slimeoid_state_forming
                    slimeoid_data.level = level
                    slimeoid_data.sltype = ewcfg.sltype_nega
                    slimeoid_data.hue = ewcfg.hue_id_negative
                    slimeoid_data.id_user = str(user_data.id_user)
                    slimeoid_data.id_server = user_data.id_server

                    # Save changes
                    slimeoid_data.persist()
                    user_data.persist()

                    response = "Floating in front of the Ouija® Board, you place both of your ghastly appendages on the planchette. {sacrificed_negaslime:,} negaslime rises from your body, flowing towards your negapoudrin. The negapoudrin appears to lift into the air, held up by a pool of rising negaslime. Whispers awake around you, indiscernible and unknowable. It feels as though the planchette beneath your ghastly fingers has more than one set of hands on it. \n\nThe conjuration of a Negaslimeoid has begun! {negaslime_emote}".format(
                        sacrificed_negaslime=sacrificed_negaslime,
                        negaslime_emote=ewcfg.emote_negaslime)
                    # Go to final response

    # Final response
    await send_response(response, cmd)