#做出地图,让地图可视化 Make a map, beacuase players will watch it! import sys import time import random #g_map = ['#','#','#','#','#','#'] p1_card_1 = ['1级攻击卡','1级攻击卡','1级攻击卡','2级攻击卡','2级攻击卡','3级攻击卡']#玩家一的攻击卡牌 No.1 player's card of biubiubiu card_num_p1 = 6#玩家1一开始拥有的卡牌数 player 1 have how many card in start it's this! p1_card_2 = ['1级防御卡','2级防御卡','3级防御卡']#玩家1拥有的防御卡牌 player1's card de-biubiubiu card_num2_p1 = 3 p1_card_1_level1 = 10 p1_card_1_level2 = 20 p1_card_1_level3 = 30 #卡牌攻击力设定 w1 = ['0','0','0','1','1',' '] #每回合开始的抽卡 give everyone card from start a new round! p1_card_3 = ['无!!!!']#绝招,还没做~ I'm did not do it~ player_blood = 100 viols_blood = 100 viols_blood_ = ["█","█","█","█","█","█","█","█","█","█"] def printer(text, delay=0.2): """打字机效果""" for ch in text: print(ch, end='', flush=True) time.sleep(delay) printer('*等待加载-') def waiting(cycle=20, delay=0.1): """旋转式进度指示""" for i in range(cycle): for ch in ['--', '\\', '|', '/']: print('\b%s'%ch, end='', flush=True) time.sleep(delay) waiting() while True: #+抽卡+# if random.choice(w1) == ("0"): print("玩家一抽到了攻击卡!") p1_card_1.append(random.choice(['1级攻击卡','2级攻击卡','3级攻击卡'])) print("记得打开卡组查收!") card_num_p1 += 1 if random.choice(w1) == ("1"): print("玩家一抽到了防御卡!") p1_card_2.append(random.choice(['1级防御卡','2级防御卡','3级防御卡'])) print("记得打开卡组查收!") card_num2_p1 += 1 if random.choice(w1) == (" "): print("玩家一什么也没有抽到!") #-抽卡-# if card_num_p1 == 0: print("你的攻击卡牌已经耗尽!或许你可以等到下一个回合!") time.sleep(1) #当玩家没有卡的时候就告诉ta!if player haven't any card,just tell him or her! else: print(str(card_num_p1)) print("===============\n|【攻击】卡牌 |" ) for c in range(card_num_p1): print('|> '+p1_card_1[c]+' <|') print("===============") #告诉玩家有什么攻击卡牌 tell player what is this card of biubiubiu here! choose = input("你要选择第几张卡牌?(数字0~5):") # let's "choose" do the num by int() while choose == (""):#if player is not input any thing,input the question to him or her again! dooooo it print("我相信你是手抖了没有输入····") choose = input("你要选择第几张卡牌?(数字0~5):")#let player input for game! #if have some question, will do something!!! if int(choose) > card_num_p1: print("我想,你想使用的牌不在你的手里!\n也许你可以等待下一轮的抽卡!")#if it's not anything in player's cards, will tell player this thing elif int(choose) < card_num_p1: print("你使用了【"+p1_card_1[int(choose)]+"】 !")#tell player what is player used card #wow, player use a card! word = '' viols_blood_ = [] for i in range(int(viols_blood / 10)): viols_blood_.append("█") ############################################# if p1_card_1[int(choose)] == '1级攻击卡': viols_blood -= p1_card_1_level1 if p1_card_1[int(choose)] == '2级攻击卡': viols_blood -= p1_card_1_level2 if p1_card_1[int(choose)] == '3级攻击卡': viols_blood -= p1_card_1_level3 ############################################### print("敌:" + str(viols_blood) + '% ' + word.join(viols_blood_)) print("敌人血量减少了!") card_num_p1 -= 1#player's card -1 if viols_blood < 1: print("敌——人——被——你——击——败——了————") time.sleep(3) break time.sleep(1) for a in range(1,100): print("") if card_num2_p1 < 1: print("防御卡牌已用尽!请等待下一轮抽卡!") time.sleep(1) else: print("===============\n|【防御】卡牌 |" ) for i in range(card_num2_p1): print('|> '+p1_card_2[i]+' <|') print("===============") #告诉玩家有什么攻击卡牌 tell player what is this card of biubiubiu here! choose = input("你要选择第几张卡牌?(数字0~1):") while choose == (""): print("我相信你是手抖了没有输入····") choose = input("你要选择第几张卡牌?(数字0~1):") if int(choose) > card_num_p1: print("我想,你想使用的牌不在你的手里!\n也许你可以等待下一轮的抽卡!")#if it's not anything in player's cards, will tell player this thing elif int(choose) < -1: print("我想,你想使用的牌不在你的手里!\n也许你可以等待下一轮的抽卡!") card_num2_p1 -= 1#player's card -1 time.sleep(0.5)#wait 0.5s for a in range(1,100): print("") #reload the sreen(maybe?) time.sleep(1)#wait 0.5s for a in range(1,100): print("") #reload the sreen(maybe?) del p1_card_2[int(choose)] del p1_card_1[int(choose)]#delete the card of player's choose , use this way to player can't use that card!
卡牌游戏目前代码分享~
猜你喜欢
转载自www.cnblogs.com/scpgo/p/12398864.html
今日推荐
周排行