-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathturn_base_combat.py
More file actions
92 lines (83 loc) · 2.58 KB
/
turn_base_combat.py
File metadata and controls
92 lines (83 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import random
class Entity:
def __init__(self, Name, IsMyTurn):
self.name = Name
self.is_my_turn = IsMyTurn
self.move = ""
self.psyche_moves = 0
# ---- Functions --- #
def swapTurns():
global player
global npc
player.is_my_turn = not player.is_my_turn
npc.is_my_turn = not npc.is_my_turn
def has_buff_points(Attacker):
return Attacker.psyche_moves > 0
def chooseCombatMove(Attacker):
if(has_buff_points(Attacker)):
rand = random.randint(1, 2)
if(rand == 1):
Attacker.move = "Range"
print(Attacker.name, " chose ", Attacker.move)
elif(rand == 2):
Attacker.move = "Mele"
print(Attacker.name, " chose ", Attacker.move)
else:
rand = random.randint(1, 3)
if(rand == 1):
Attacker.move = "Range"
print(Attacker.name, " chose ", Attacker.move)
elif(rand == 2):
Attacker.move = "Mele"
print(Attacker.name, " chose ", Attacker.move)
else:
Attacker.move = "Psyche Up"
print(Attacker.name, " chose ", Attacker.move)
Attacker.psyche_moves = 3
def doCombatMove(Attacker):
print(Attacker.name, " does a ", Attacker.move, " move!")
def resolveBuff(Attacker):
Attacker.psyche_moves -= 1
print(Attacker.name, " uses a psyche point. Psyche points remaining = ", Attacker.psyche_moves)
# ------------------ #
# ---- Variables --- #
player = Entity("Abel", False)
npc = Entity("Mawg", False)
i = 0
# ------------------ #
# ---- Initialze --- #
rand = random.randint(0, 1)
if(rand == 0):
player.is_my_turn = True
else:
npc.is_my_turn = True
# ------------------ #
while(i < 30):
if(player.is_my_turn == True):
print("It's ", player.name, "'s turn!")
if(has_buff_points(player) == False):
chooseCombatMove(player)
if (player.move != "Psyche Up"):
doCombatMove(player)
swapTurns()
else:
chooseCombatMove(player)
doCombatMove(player)
resolveBuff(player)
if(has_buff_points(player) == False):
swapTurns()
else:
print("It's ", npc.name, "'s turn!")
if(has_buff_points(npc) == False):
chooseCombatMove(npc)
if (npc.move != "Psyche Up"):
doCombatMove(npc)
swapTurns()
else:
chooseCombatMove(npc)
doCombatMove(npc)
resolveBuff(npc)
if(has_buff_points(npc) == False):
swapTurns()
print("\n")
i += 1