标签:infer bsp div nta ack %s -- ice 游戏
import random,time
class God_mountain: # 类名 神天兵
Game =‘Dhxy‘
def __init__(self,role,hp,spell,mp,skill,skill1,skill2):
self.role = role
self.hp = hp
self.spell = spell
self.mp = mp
self.skill = skill
self.skill1 = skill1
self.skill2 = skill2
def spell_attacks1(self, inferno): # 技能1 inferno 魔族
if self.hp > 0:
n = random.randint(0,1)
if n == 0:
print(‘%s使出了%s攻击了%s造成了%s伤害‘%(self.role,self.skill1,inferno.role,self.spell))
inferno.hp -= self.spell
else:
crit_spell_attack = random.randint(50, self.spell) + self.spell
print(‘%s使出了%s攻击了%s引发了法术暴击,造成了%s伤害‘ % (self.role, self.skill, inferno.role,crit_spell_attack))
inferno.hp -= crit_spell_attack
def spell_attacks2(self, inferno): # 攻击方法2 技能2
if self.hp > 0:
n = random.randint(0,1)
if n == 0:
print(‘%s使出了%s攻击了%s造成了%s伤害‘%(self.role,self.skill1,inferno.role,self.spell))
inferno.hp -= self.spell
else:
crit_spell_attack = random.randint(50, self.spell) + self.spell
print(‘%s使出了%s攻击了%s引发了法术暴击,造成了%s伤害‘ % (self.role, self.skill1, inferno.role,crit_spell_attack))
inferno.hp -= crit_spell_attack
def spell_attacks3(self, inferno): #攻击方法3 技能3
if self.hp > 0:
n = random.randint(0,1)
if n == 0:
print(‘%s使出了%s攻击了%s造成了%s伤害‘%(self.role,self.skill1,inferno.role,self.spell))
inferno.hp -= self.spell
else:
crit_spell_attack = random.randint(50, self.spell) + self.spell
print(‘%s使出了%s攻击了%s引发了法术暴击,造成了%s伤害‘ % (self.role, self.skill2, inferno.role,crit_spell_attack))
inferno.hp -= crit_spell_attack
class Mix_monty: # 大话西游
Game = ‘Dhxy‘
def __init__(self, role,hp,attack,mp,skill):
self.role = role
self.hp = hp
self.attack = attack
self.mp = mp
self.skill = skill
def physical_attacks(self,Wizards): # Wizards 仙
if self.hp > 0:
n = random.randint(0,1)
if n == 0:
print(‘%s**仰天长啸**攻击了%s造成了%s伤害‘%(self.role,Wizards.role,self.attack))
Wizards.hp -= self.attack
else:
crit__attack = random.randint(50, self.attack) + self.attack
print(‘%s**仰天长啸**使出了%s攻击了%s引发了雷霆暴击造成了%s伤害‘%(self.role,self.skill,Wizards.role,self.attack))
Wizards.hp -= crit__attack
deity = God_mountain(‘神天兵‘,1000,100,2000,‘袖里乾坤‘,‘天诛地灭‘,‘九龙冰封‘) #仙族 神天兵的 信息
demon = Mix_monty(‘混天魔‘,1000,100,1000,‘乾坤一棍‘) # 魔族 混天魔的信息
print(‘\r准备决斗‘,end=‘‘)
time.sleep(0.5)
print(‘\r3‘,end=‘‘)
time.sleep(0.5)
print(‘\r2‘,end=‘‘)
time.sleep(0.5)
print(‘\r1‘,end=‘‘)
time.sleep(0.5)
print(‘\r开始‘,end=‘‘)
time.sleep(0.5)
print(‘\r ‘,end=‘‘)
def func():
demon.physical_attacks(deity)
if deity.hp < 0:
deity.hp = 0
print(‘神天兵剩余HP‘, deity.hp)
print(‘----------------------------‘)
time.sleep(0.5)
if random.randint(0,1):
func()
while 1:
if deity.hp > 0 and demon.hp > 0:
random.choice([deity.spell_attacks1,
deity.spell_attacks2,
deity.spell_attacks3])(demon)
if demon.hp < 0:
demon.hp = 0
print(‘混天魔剩余HP‘,demon.hp)
print(‘----------------------------‘)
time.sleep(0.5)
func()
if demon.hp <= 0:
demon.hp = 0
print(‘\n%s阵亡! 仰天大吼一声,生而为民,死亦何憾! ‘%(demon.role))
break
if deity.hp <= 0:
deity.hp = 0
print(‘\n%s阵亡! 发出神灵叹息,吾来生再战 ‘%(deity.role))
break
标签:infer bsp div nta ack %s -- ice 游戏
原文地址:https://www.cnblogs.com/CrazySheldon1/p/9986943.html