async def use(self): """ `coroutine` Add a stack to all active acid debuff on the enemy team. -- Return : str """ # init move = Move_displayer() effect_checker = Effect_checker(self.caster) has_unity = False acid_ref = await effect_checker.get_effect(1, self.client, self.ctx, self.caster, self.team_a, self.team_b) unity_ref = await effect_checker.get_effect(2, self.client, self.ctx, self.caster, self.team_a, self.team_b) # check if there is a unity buff in the team a for ally in self.team_a: await asyncio.sleep(0) unity_checker = Effect_checker(ally) unity = await unity_checker.get_buff(unity_ref) if (unity != None): has_unity = True break # now increase the stack of acids for enemy in self.team_b: await asyncio.sleep(0) acid_checker = Effect_checker(enemy) acid = await acid_checker.get_debuff(acid_ref) if (acid != None): await acid.add_stack() # set up the move display _move = await move.get_new_move() _move["name"] = self.name _move["icon"] = self.icon _move["ki"] = True _move = await move.effect_move(_move) return (_move)
async def use(self): """ `coroutine` Applies the Unity is strenght buff on all the allied Saibaimen. -- Return : str """ # init await self.caster.posture.change_posture("attacking") move = Move_displayer() # applies the buff on the team for character in self.team_a: await asyncio.sleep(0) # init checker = Effect_checker(character) unity_buff = await checker.get_effect(2, self.client, self.ctx, character, self.team_a, self.team_b) ally_buff = None # check if the ally already has the Unity is strenght active character.bonus.append(unity_buff) if character.info.id in self.saibaimen: # if the ally is a saibaimen # applies the buff ally_buff = await checker.get_buff(unity_buff) if (ally_buff != None): # if the ally has the buff, reset duration ally_buff.duration = unity_buff.initial_duration else: # otherwise, add the buff character.bonus.append(unity_buff) # setup the move display display = await move.get_new_move() display["name"] = self.name display["icon"] = self.icon display["ki"] = True display = await move.effect_move(display) return (display)
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)
async def use(self): """ `coroutine` Applies the Pilaf Barrier buff on the caster. -- Return : str """ # init # change the posture move = Move_displayer() _move = await move.get_new_move() effect_checker = Effect_checker(self.caster) barrier_ref = await effect_checker.get_effect( 5, self.client, self.ctx, self.caster, self.team_a, self.team_b ) await self.caster.posture.change_posture("defending") # first check if the target (caster) already have the buff active has_barrier = await effect_checker.get_buff(barrier_ref) if(has_barrier != None): # just reset the duration has_barrier.duration = has_barrier.initial_duration else: # if the target doesn't have the buff self.caster.bonus.append(barrier_ref) # set cooldown self.cooldown = 3 # define the move _move["name"] = self.name _move["icon"] = self.icon _move = await move.effect_move(_move) return(_move)
async def use(self): """ `coroutine` Consums one stack of Triple pilots to recover health -- Return : str """ # init move = Move_displayer() heal = 0 effect_checker = Effect_checker(self.caster) triple_ref = await effect_checker.get_effect(6, self.client, self.ctx, self.caster, self.team_a, self.team_b) # check if the caster has the triple pilots buff has_triple = await effect_checker.get_buff(triple_ref) if (has_triple != None): if (has_triple.stack > 0): # consum a stack has_triple.stack -= 1 # restore health heal = int((30 * self.caster.health.maximum) / 100) self.caster.health.current += heal await self.caster.health.health_limit() if (has_triple.stack <= 0): # the caster doesn't have triple pilots stacks anymore self.caster.bonus.remove(has_triple) # set up the move _move = await move.get_new_move() _move["name"], _move["icon"] = self.name, self.icon _move = await move.effect_move(_move) if (heal > 0): _move += f"__Heal__ : **+{heal:,}** :hearts:" return (_move)
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)
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)
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)
async def use(self): """ `coroutine` Applies the Paralyzing debuff on the target. If the target already has the debuff : reset the duration -- Return : str """ # init effect_checker = Effect_checker(self.target) move = Move_displayer() _move = "" has_paralyzing = None has_acid = None # effect reference acid_ref = await effect_checker.get_effect(1, self.client, self.ctx, self.target, self.team_a, self.team_b) paralyzing_ref = await effect_checker.get_effect( 4, self.client, self.ctx, self.target, self.team_a, self.team_b) # set up the move _move = await move.get_new_move() _move["name"] = self.name _move["icon"] = self.icon _move["ki"] = True _move = await move.effect_move(_move) # check if the target has acid stack active has_acid = await effect_checker.get_debuff(acid_ref) if (has_acid != None): # get the amount of acid's stack the target has acid_stack = has_acid.stack # check if the target has 3 or more active stacks if (acid_stack >= 3): # check if the target has an active paralyzing burns has_paralyzing = await effect_checker.get_debuff(paralyzing_ref ) if (has_paralyzing != None): # reset the duration if (acid_stack == 3): has_paralyzing.initial_duration = 2 has_paralyzing.duration = has_paralyzing.initial_duration elif (acid_stack > 3): has_paralyzing.initial_duration = 4 has_paralyzing.duration = has_paralyzing.initial_duration else: # the target doesn't have paralyzing burns active on it # set the duration of the stun if (acid_stack == 3): paralyzing_ref.initial_duration = 2 paralyzing_ref.duration = paralyzing_ref.initial_duration elif (acid_stack > 3): paralyzing_ref.initial_duration = 4 paralyzing_ref.duration = paralyzing_ref.initial_duration # apply the debuff on the target self.target.malus.append(paralyzing_ref) # consums all the acid stacks self.target.malus.remove(has_acid) else: # the target has less that 3 acid stacks pass else: # the target doesn't have acid stack, don't do nothing pass return (_move)
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
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)
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)