YOU SAID:
import random global going class pokemon(): def __init__(self,hp,attack,defense,side): self.hp = int(hp) self.attack = int(attack) self.defense = int(defense) self.side = side # Side 1 will be player, 2 will be cpu def _attack(): attack(self.attack,) def damage(amount): self.hp -= amount def hp(): return self.hp def defense(): return self.defense def attack(attack,target): if side == 1: if random.randrange(1,100) <= 8: print("miss") else: if random.randrange(1,80) <= 5: print("Critical Hit!") cpu.damage((attack*2)-cpu.defense()) else: cpu.damage(attack-cpu.defense()) print("Hit for "+attack+" Damage!") else: if random.randrange(1,100) <= 8: print("miss") else: if random.randrange(1,80) <= 5: player.damage((attack*2)-player.defense()) print("Critical Hit!") else: player.damage(attack-player.defense()) print("Hit for "+attack+" damage!") def turn(): check() if random.randrange(2) == 1: cpu.attack() player.attack() else: player.attack() cpu.attack() check() def check(): if (player.hp() <= 0) or (cpu.hp() <= 0): print("Game Over!") print("%5s" % "Your HP", "%10s" % "Enemy HP", "\n","%5f" % player.hp(), "%10f" % cpu.hp()) going = False def main(): going = True hp = input("Enter the hp for both users: ") atk = input("Enter the base attack for both users: ") defense = input("Enter the base defense for both users: ") player = pokemon(hp,atk,defense,1) cpu = pokemon(hp,atk,defense,2) while going: turn() main()
INTO JAPANESE
ランダムなグローバル行くクラス pokemon() をインポート: def __init__(self,hp,attack,defense,side): self.hp = int(hp) self.attack = int(attack) self.defense = int(defense) self.side = 側プレーヤーになります # 側 1、2 cpu def _attack(): attack(self.attack,) def damage(amount): self.hp-= 量 def hp(): self.hp を返す
BACK INTO ENGLISH
To go global with random class pokemon() import: def _ _init _ _ (self, hp, attack, defense, side): self.hp = int (hp) self.attack = int (attack) becomes self.defense = int (defense) self.side = Player # 1, cpu 2 def _attack(): attack(self.attack) def damage (amount): self.HP-= how much def hp(): return self.hp
INTO JAPANESE
ランダムなクラス pokemon() インポートのグローバル化: def _ _init _ _ (セルフ、hp、攻撃、防御、側): self.hp = int (hp) self.attack = int (攻撃) となる self.defense = int (防衛) self.side = プレーヤー # 1、cpu 2 デフ _attack(): attack(self.attack) デフ破損 (量): 自己。HP = どのくらいの def は hp(): self.hp を返す
BACK INTO ENGLISH
Globalization of import random class pokemon(): def _ _init _ _ (self, hp, attack, defense, side): self.CP = int (hp) self.defense = int self.attack = int (attack) and (Defense) self.side = Player # 1 and cpu 2 def _attack(): attack(self.attack) def (quantity): self. HP = how much def
INTO JAPANESE
インポート ランダム クラス pokemon() のグローバル化: def _ _init _ _ (自己、hp、攻撃、防御、サイド): 自己。CP = int (hp) self.defense int self.attack を = = int (攻撃) と (防衛) self.side = プレーヤー # 1、cpu 2 デフ _attack(): attack(self.attack) デフ (数量): 自己。HP どのくらいの def を =
Yes! You've got it man! You've got it