Ejemplo n.º 1
0
    async def use(self):
        """
        `coroutine`

        Inflicts damage and applies a dot to the target.

        --

        Return : str
        """

        # init
        await self.caster.posture.change_posture("attacking")

        move = Move_displayer()
        calculator = Damage_calculator(self.caster, self.target)
        checker = Effect_checker(self.target)

        # get the damage
        damage = randint(self.caster.damage.ki_min, self.caster.damage.ki_max)
        damage = int(damage *
                     0.25)  # the ability inflicts only 25 % of the ki damage
        damage = await calculator.ki_damage(damage,
                                            critable=True,
                                            dodgable=True)

        # define move info
        _move = await move.get_new_move()

        _move["name"] = self.name
        _move["icon"] = self.icon
        _move["damage"] = damage["calculated"]
        _move["critical"] = damage["critical"]
        _move["dodge"] = damage["dodge"]
        _move["ki"] = True

        _move = await move.offensive_move(_move)

        # inflict damage
        await self.target.receive_damage(damage["calculated"])

        # add a stack of acid on the target
        _acid = Dot_acid(self.client, self.ctx, self.target, self.team_a,
                         self.team_b)

        await _acid.add_stack()

        return (_move)
Ejemplo n.º 2
0
    async def use(self):
        """
        `coroutine`

        Inflicts 150 % of the character's physical damage and ignore the damage reduction.

        Cooldown : 4 turns.

        --

        Return : str
        """

        # init
        move = Move_displayer()
        damage_calculator = Damage_calculator(self.caster, self.target)

        roll_damage = int((randint(self.caster.damage.physical_min, self.caster.damage.physical_max)) * 1.5)
        damage_done = await damage_calculator.physical_damage(
            roll_damage,
            dodgable = True,
            critable = True,
            ignore_defense = True
        )
        
        # inflict the damage to the target
        await self.target.receive_damage(damage_done["calculated"])

        # set the cooldown
        self.cooldown = 4

        # set the move
        _move = await move.get_new_move()

        _move["name"] = self.name
        _move["icon"] = self.icon
        _move["damage"] = damage_done["calculated"]
        _move["dodge"] = damage_done["dodge"]
        _move["critical"] = damage_done["critical"]
        _move["physical"] = True

        _move = await move.offensive_move(_move)

        return(_move)
Ejemplo n.º 3
0
    async def use(self):
        """
        `coroutine`

        Performs a sequence attack against any enemy

        --

        Return : str
        """

        # init
        await self.caster.posture.change_posture("attacking")

        move = Move_displayer()
        calculator = Damage_calculator(self.caster, self.target)
        checker = Effect_checker(self.target)

        # get the damage
        damage = randint(self.caster.damage.physical_min, self.caster.damage.physical_max)
        damage = await calculator.physical_damage(
            damage,
            critable = True,
            dodgable = True
        )

        # define move info
        _move = await move.get_new_move()

        _move["name"] = self.name
        _move["icon"] = self.icon
        _move["damage"] = damage["calculated"]
        _move["critical"] = damage["critical"]
        _move["dodge"] = damage["dodge"]
        _move["physical"] = True

        _move = await move.offensive_move(_move)

        # inflict damage
        await self.target.receive_damage(damage["calculated"])

        return(_move)
Ejemplo n.º 4
0
    def __init__(self, client, ctx, target, team_a, team_b):
        # dot
        Dot.__init__(self, client, ctx, team_a, team_b)

        # attribute
        self.name = "Acid"
        self.icon = self.game_icon['effect']['acid']
        self.caster = None
        self.target = target
        self.id = 1

        # duration
        self.initial_duration = 4
        self.duration = 4

        # stack
        self.max_stack = 3
        self.stack = 1

        # unique
        self.damager = Damage_calculator(self.caster, self.target)
        self.saibaiman_id = [1, 2, 3]
Ejemplo n.º 5
0
    async def use(self):
        """
        `coroutine`

        Inflicts 50% of users ki as true damage 

        --

        Return : str
        """

        # init
        move = Move_displayer()
        damage_calculator = Damage_calculator(self.caster, self.target)

        roll_damage = int(
            (randint(self.caster.damage.ki_min, self.caster.damage.ki_max)) *
            0.5)
        damage_done = await damage_calculator.physical_damage(
            roll_damage, dodgable=True, critable=False, ignore_defense=True)

        # inflict the damage to the target
        await self.target.receive_damage(damage_done["calculated"])

        # set the move
        _move = await move.get_new_move()

        _move["name"] = self.name
        _move["icon"] = self.icon
        _move["damage"] = damage_done["calculated"]
        _move["dodge"] = damage_done["dodge"]
        _move["critical"] = damage_done["critical"]
        _move["physical"] = False
        _move["ki"] = False

        _move = await move.offensive_move(_move)

        return (_move)
Ejemplo n.º 6
0
    async def start_battle(self, team, team_a_move, team_b_move, turn):
        """
        `coroutine`

        Runs the battle phase.

        - Parameter :

        `team` : Represents a list of unit.

        `team_a_move` | `team_b_move` : Represents a dict of move.
        --

        Return : None
        """

        # init
        _move_display = Move_displayer()
        character_move = None

        _team_a, _team_b = team[0], team[1]

        team_a = {"index": 0, "display": ""}

        team_b = {"index": 0, "display": ""}

        unit_index = 1

        # battle
        for _team in range(2):  # team 0 then 1
            await asyncio.sleep(0)

            if (_team == 0):
                await self.ctx.send(
                    f"```🔵 - {self.player_a.name}\'s team```")
                await asyncio.sleep(2)

            else:
                await self.ctx.send(f"```🔴 - Enemy team```")
                await asyncio.sleep(2)

            for character in team[_team]:
                await asyncio.sleep(0)

                # patch
                if (_team == 1):
                    team_a = team_b
                    team_a_move = team_b_move
                ###

                team_a["display"] = ""

                # check if the character is able to fight
                if (character != None):
                    if (character.health.current > 0
                            and character.posture.stunned == False):
                        character_move = team_a_move[team_a["index"]]

                        if (character_move != None):
                            # set the target display
                            if (character_move["target"] == None
                                ):  # if there is no target
                                team_a[
                                    "display"] += f"\n{unit_index}. {character.image.icon}**{character.info.name}**{character.type.icon} to **Himself** :\n"

                            else:
                                team_a[
                                    "display"] += f"\n{unit_index}. {character.image.icon}**{character.info.name}**{character.type.icon} to {character_move['target'].image.icon}**{character_move['target'].info.name}**{character_move['target'].type.icon} :\n"

                            # manage the move
                            if (type(character_move["move"]) == str):
                                if (character_move["move"] == "skip"):
                                    team_a[
                                        "display"] += await _move_display.skip_move(
                                        )

                            else:
                                if (character_move["move"] == 1):  # sequence
                                    await character.posture.change_posture(
                                        "attacking")

                                    # damage
                                    damager = Damage_calculator(
                                        character, character_move["target"])

                                    # generate a random number of damage
                                    sequence_damage = randint(
                                        character.damage.physical_min,
                                        character.damage.physical_max)
                                    damage_done = await damager.physical_damage(
                                        sequence_damage,
                                        dodgable=True,
                                        critable=True)

                                    # inflict the damage
                                    await character_move[
                                        "target"].receive_damage(
                                            damage_done["calculated"])

                                    # prepare the move info
                                    move_info = {
                                        "name": "Sequence",
                                        "icon": "👊",
                                        "damage": damage_done["calculated"],
                                        "critical": damage_done["critical"],
                                        "dodge": damage_done["dodge"],
                                        "physical": True,
                                        "ki": False
                                    }

                                    # displays the move
                                    team_a[
                                        "display"] += await _move_display.offensive_move(
                                            move_info)

                                if (character_move["move"] == 2
                                    ):  # charging ki
                                    await character.posture.change_posture(
                                        "charging")

                                    # init
                                    # get the missing ki of the character
                                    missing_ki = character.ki.maximum - character.ki.current
                                    # take 10 % of the missing ki
                                    missing_ki *= 0.1

                                    # get the ki gain
                                    # based on misisng ki and rarity of the character
                                    ki_gain = int(
                                        randint(1, 5) +
                                        character.rarity.value + missing_ki)

                                    # add the ki to the character
                                    character.ki.current += ki_gain
                                    await character.ki.ki_limit()

                                    # prepare the move info
                                    move_info = {
                                        "name": "Ki charge",
                                        "icon": "🔥",
                                        "damage": ki_gain,
                                        "critical": False,
                                        "dodge": False,
                                        "physical": False,
                                        "ki": False
                                    }

                                    team_a[
                                        "display"] += await _move_display.ki_move(
                                            move_info)

                                if (character_move["move"] == 3):  # defending
                                    await character.posture.change_posture(
                                        "defending")

                                    team_a[
                                        "display"] += await _move_display.defense_move(
                                        )

                                if (character_move["move"] > 3):  # if ability
                                    await character.posture.change_posture(
                                        "attacking")

                                    # find the ability the player wants to use
                                    ability = await character.get_ability(
                                        self.client, self.ctx, character,
                                        character_move["target"], _team_a,
                                        _team_b, character_move["move"] - 4)

                                    # use the ability
                                    # the ability returns the display
                                    team_a["display"] += await ability.use()

                                    character.ki.current -= ability.cost
                                    await character.ki.ki_limit()

                    else:  # if the character is dead or stunned
                        # dead
                        if (character.health.current <= 0):
                            team_a[
                                "display"] += f"\n{unit_index}. {character.image.icon}**{character.info.name}**{character.type.icon} is **K.O**:skull: !"

                        # alive but stunned
                        elif (character.health.current > 0
                              and character.posture.stunned == True):
                            team_a[
                                "display"] += f"\n{unit_index}. {character.image.icon}**{character.info.name}**{character.type.icon} is **Stunned**:dizzy_face:, he can't do anything !"

                # end of loop

                # update the index
                team_a["index"] += 1
                unit_index += 1

                # display the team_a move
                # color
                if (_team == 0):
                    team_a_embed = await Custom_embed(
                        self.client, colour=0x009dff).setup_embed()

                if (_team == 1):
                    team_a_embed = await Custom_embed(
                        self.client, colour=0xff0000).setup_embed()

                team_a_embed.add_field(name=f"{self.player_a.name} team :",
                                       value=team_a["display"],
                                       inline=False)

                if (len(team_a["display"]) > 0):
                    await self.ctx.send(embed=team_a_embed)

            # swap the team
            _team_a = team[1]
            _team_b = team[0]

        return
Ejemplo n.º 7
0
    async def use(self):
        """
        `coroutine`

        Inflicts 50 % of the caster's ki damage to the target.

        If the target has at least 3 stacks of acid, splashes it onto all of the target's team members.

        Applies the Acid explosion debuff that increases the ki damages that they take by 2 %.

        --

        Return : str
        """

        # init
        move = Move_displayer()
        effect_checker = Effect_checker(self.target)
        damage_calculator = Damage_calculator(self.caster, self.target)

        # debuff
        acid_ref = await effect_checker.get_effect(1, self.client, self.ctx,
                                                   self.target, self.team_a,
                                                   self.team_b)

        explosion_ref = await effect_checker.get_effect(
            3, self.client, self.ctx, self.target, self.team_a, self.team_b)

        # set the damage
        damage = randint(self.caster.damage.ki_min, self.caster.damage.ki_max)
        damage /= 2  # 50 % of the ki damage
        damage = await damage_calculator.ki_damage(damage, critable=True)

        # check if the target has acid
        has_acid = await effect_checker.get_debuff(acid_ref)

        if (has_acid != None):  # the target has an acid dot active on it
            # now check if the target has at least 3 stacks of acid
            if (has_acid.stack >= 3):
                # spread the dot onto the enemy members

                for unit in self.team_b:
                    await asyncio.sleep(0)

                    # init
                    effect_checker = Effect_checker(unit)

                    # check if the unit has acid stack
                    unit_has_acid = await effect_checker.get_debuff(acid_ref)

                    if (unit_has_acid != None):
                        await unit_has_acid.add_stack()
                        unit_has_acid.duration = unit_has_acid.initial_duration

                    else:  # the unit doesn't have acid active on it
                        # create a new acid instance for the target
                        unit_acid = await effect_checker.get_effect(
                            1, self.client, self.ctx, unit, self.team_a,
                            self.team_b)
                        # applies the new acid instance
                        await unit_acid.add_stack()

        # now check if the target already have explosion debuff active
        has_explosion = await effect_checker.get_debuff(explosion_ref)

        if (has_explosion != None):
            # reset the duration
            has_explosion.duration = has_explosion.initial_duration

        else:
            self.target.malus.append(explosion_ref)

        # setting up the move display
        _move = await move.get_new_move()

        _move["name"] = self.name
        _move["icon"] = self.icon
        _move["damage"] = damage["calculated"]
        _move["critical"] = damage["critical"]
        _move["dodge"] = damage["dodge"]
        _move["ki"] = True

        _move = await move.offensive_move(_move)

        return (_move)
Ejemplo n.º 8
0
    async def use(self):
        """
        `coroutine`

        See class description.

        --

        Return : str
        """

        # init
        move = Move_displayer()
        effect_checker = Effect_checker(self.target)
        damager = Damage_calculator(self.caster, self.target)

        missing_health = self.target.health.maximum - self.target.health.current
        roll_damage = randint(self.caster.damage.ki_min, self.caster.damage.ki_max)
        damage_done = await damager.ki_damage(
            roll_damage,
            dodgable = True,
            critable = True
        )

        # init the damage done
        damage_done["calculated"] = int(damage_done["calculated"] * 0.1)

        # special effect
        if not damage_done["dodge"]:  # if the damage has not been dodged
            # check if the target has acid stack active on it
            acid = await effect_checker.get_effect(
                1,
                self.client,
                self.ctx,
                self.target,
                self.team_a,
                self.team_b
            )

            has_acid = await effect_checker.get_debuff(acid)

            if(has_acid != None):
                damage_done["calculated"] += int(((2 * missing_health)/100) * has_acid.stack)
                
                # remove the acid debuff to the target
                # consums it
                self.target.malus.remove(has_acid)
            
            else:  # doesn't have acid active on it
                pass
        
        # deal damage to the target
        await self.target.receive_damage(damage_done["calculated"])
        
        # heal the caster
        # of 50 % of damage done
        healing = int(damage_done["calculated"] / 2)
        self.caster.health.current += healing
        await self.caster.health.health_limit()

        # setting up the move    
        _move = await move.get_new_move()
        _move["name"] = self.name
        _move["icon"] = self.icon
        _move["damage"] = damage_done["calculated"]
        _move["critical"] = damage_done["critical"]
        _move["dodge"] = damage_done["dodge"]
        _move["ki"] = True

        _move = await move.offensive_move(_move)

        # healing display
        if(healing > 0):
            _move += f"__Heal__ : +**{healing}** :hearts:\n"

        return(_move)