def playFunc(ply, enemy, target): cardChoices = [] for files in os.listdir('./cards'): cardChoices.append(files[:-3]) chosen = random.choice(cardChoices) ply.hand.append(chosen) yield from mechanics.heal(ply, mechanics.cardList[chosen.lower()].cost)
def triggerFunc(ply, enemy, data, affectedPlayer): print('before check') if affectedPlayer == "friendly": print('after check') yield from mechanics.heal(ply, 1) print('after heal') return
def playFunc(ply, enemy, target): mechanics.sacNode(enemy,ply,target) yield from mechanics.heal( enemy, 6 )
def startRound(match, activePlayer, activePlayerObj, otherPlayer, otherPlayerObj, ctx): #check if game still exists if not mechanics.isGameRunning(match): return #check if milled out when drawing a card (maybe condense this chunk somehow) if not activePlayerObj.drawCard(): yield from ctx.message.channel.send(activePlayer.name + " milled out!") yield from mechanics.gameOver(activePlayer.id) return #Energy costs (oooh actual phase orders are showing c:) yield from mechanics.heal(activePlayerObj, activePlayerObj.energy) #check if game still exists if not mechanics.isGameRunning(match): return #Activate all of active player's nodes/initialize turn-based vars if len(activePlayerObj.nodes) > 0: for thisNode in activePlayerObj.nodes.copy(): yield from mechanics.activateNode(thisNode, activePlayerObj, otherPlayerObj) yield from ctx.message.channel.send( activePlayerObj.name + " activated their start of turn abilities.") activePlayerObj.newTurn() otherPlayerObj.newTurn() activePlayerObj.newMyTurn() #check if game still exists if not mechanics.isGameRunning(match): return #Send the info yield from ctx.message.channel.send(activePlayer.name + "'s turn.") if not match.gameMessage == None: yield from bot.delete_message(match.gameMessage) yield from printLogs(match, ctx) match.gameMessage = yield from ctx.message.channel.send( str(activePlayerObj) + "\n\n" + str(otherPlayerObj) + "\nCommands: play, concede, pass, info, mill") yield from sendHand(activePlayer, activePlayerObj, ctx) #Make sure it's a game command def check(msg): return msg.content.lower().startswith('play') or msg.content.lower( ).startswith('concede') or msg.content.lower().startswith( 'pass') or msg.content.lower().startswith( 'info') or msg.content.lower().startswith('mill') #Wait for active player's command. while True: #check if game still exists if not mechanics.isGameRunning(match): return messageOriginal = yield from bot.wait_for_message( author=activePlayer, check=check, timeout=config.TURN_TIMEOUT) #Act within 500 seconds or game is lost try: message = messageOriginal.content.lower().split(' ', 1) except AttributeError: yield from ctx.message.channel.send("Game timed out!") match.timedOut = True yield from mechanics.gameOver(activePlayer.id) break if message[0] == 'info': if not match.gameMessage == None: yield from bot.delete_message(match.gameMessage) match.gameMessage = yield from ctx.message.channel.send( str(activePlayerObj) + "\n\n" + str(otherPlayerObj) + "\nCommands: play, concede, pass, info, mill") continue elif message[0] == 'play': #The big one #Ensure it's in hand if not any(message[1] in x.lower() for x in activePlayerObj.hand): yield from ctx.message.channel.send("Played an invalid card.") continue #Get proper targets playedObject = mechanics.cardList[message[1].lower()] thisTarget = yield from getTarget(playedObject, activePlayerObj, activePlayer, otherPlayerObj, ctx) if thisTarget == -1: continue #Check if node generator (for 1 per turn limit) if playedObject.cardtype == "NodeGen": if activePlayerObj.playedNode: yield from ctx.message.channel.send( "You already spawned a Node this turn.") continue else: activePlayerObj.playedNode = True yield from playCard(match, activePlayer, activePlayerObj, otherPlayer, otherPlayerObj, message[1], thisTarget, ctx) continue elif message[0] == 'pass': yield from startRound(match, otherPlayer, otherPlayerObj, activePlayer, activePlayerObj, ctx) break elif message[0] == 'mill': if activePlayerObj.milled == True: yield from ctx.message.channel.send( "You already milled a card this turn.") continue elif len(activePlayerObj.deck) <= 0: yield from ctx.message.channel.send( "You have no cards to mill.") continue else: activePlayerObj.milled = True poppedCard, lifeToGain = mechanics.millCard(activePlayerObj) yield from ctx.message.channel.send(activePlayerObj.name + " milled " + poppedCard + " for " + str(lifeToGain) + " health.") continue elif message[0] == 'concede': yield from ctx.message.channel.send(activePlayer.name + " conceded.") yield from mechanics.gameOver(activePlayer.id) return
def playFunc(ply, enemy, target): ply.desperation -= 5 yield from mechanics.heal(ply, 10)
def playFunc(ply, enemy, target): if len(ply.nodes) > 0: mechanics.sacNode(ply, enemy, target) yield from mechanics.heal(ply, 8)
def playFunc(ply, enemy, target): yield from mechanics.heal( enemy, ply.energy )
def playFunc(ply, enemy, target): yield from mechanics.heal(ply, 10) ply.hunger -= 5
def playFunc(ply, enemy): yield from mechanics.heal(ply, len(ply.nodes)) return
def playFunc(ply, enemy): if ply.lifeforce < 15: yield from mechanics.heal(ply, 5) ply.desperation += 5 mechanics.sacNode(ply, enemy, ply.nodes.index('Adrenaline')) return
def triggerFunc(ply, enemy, dataPassed, affectedPlayer): #dataPassed is damage dealt if affectedPlayer == "enemy": yield from mechanics.heal(ply, dataPassed) return
def deathFunc(ply, enemy): yield from mechanics.heal(ply, 5) return
def playFunc(ply, enemy, target): yield from mechanics.heal(ply, 7) yield from mechanics.damage(enemy, 7)
def playFunc(ply, enemy, target): yield from mechanics.heal( ply, 5 )
def playFunc(ply, enemy, target): yield from mechanics.heal(ply, 18) enemy.addNode('Lesser Leech')