repl.it
@KianAlford/

Text RPG

Python

an adventure. it's basic but has a decent amount of features to have fun with.

fork
loading
Files
  • main.py
main.py
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
93
94
95
import random
import sys

character_name = input('Characters name here: ')
print('Welcome ' + character_name + '!!')
print('commands: "help" = look over these commands. "explore" = explore the map. "attack" = to attack the enemies you will encounter throughout your adventure. "flee" to flee enemies when low on health or low on endurance. ""')

Help = ('commands: "help" = look over these commands. "explore" = explore the map. "attack" = to attack the enemies you will encounter throughout your adventure. "flee" to flee enemies when low on health or low on endurance. "stats" = show the stats u have after battle or what you have after leveling.')

X = 1
while X == 1:
  health = 100
  endurance = 50
  damage = 25
  XP = 0

  wantToBreak = False
  command = input('put the command you would like ' + character_name + ' to do: ')
  if command == 'help':
    print(Help)
  if command == 'stats':
    print('Health = ' + str(health))
    print('Endurance = ' + str(endurance))
  if command == 'explore':
    endurance -= 2
    while endurance == 0:
      rest = input('You must rest. To rest type "rest": ')
      if rest == 'rest':
        health += 100
        endurance += 50
        break
    Map = ['the dune' , 'a ravine']
    creatures = ['SandWorm' , 'Thrasher' , 'Beetle']
    encounter_chance = ('X' , 'Y')

    print(character_name + ' endurance is reduced by 2.')
    print(character_name + ' explores ' + random.choice(Map))
    Encounter_chance = random.choice(encounter_chance)

    while Encounter_chance == 'X':
      if XP == 120:
        health += 20
        endurance += 10
        damage += 25
        XP -= 120
        print('Congratulations ' + character_name + ', you gained 20 health and 10 endurance.')
      if wantToBreak == True:
        break
      creature = random.choice(creatures)
      print(character_name + ' runs into a ' + creature)
      creature_health = 0

      if creature == 'SandWorm':
        creature_health = 150
      elif creature == 'Thrasher':
        creature_health = 100
      elif creature == 'Beetle':
        creature_health = 75
      Y = 2
      while Y == 2:
        attack_flee = input('Does ' + character_name + ' Attack or Flee from the ' + creature + '.')
        if attack_flee == 'attack' or 'Attack':
          creature_attack = [1 , 2]
          creature_attack_chance = random.choice(creature_attack)
          if creature_attack_chance == 1:
            health -= 10
            if health == 0:
              print('YOU DIED')
              sys.exit()
            print(creature + ' attacks ' + character_name + ' putting them at ' + str(health))
          elif creature_attack_chance == 2:
            creature_health -= 0
          creature_health -= damage
          endurance -= 4
          print('the ' + creature + '\'s health is ' + str(creature_health))
          if endurance == 0:
            attack_flee = input('You must flee. Type "flee" to escape.')
            if attack_flee == 'Flee' or 'flee':
              wantToBreak = True
              if wantToBreak == True:
                break
          if creature_health == 0:
            print(character_name + ' has killed the ' + creature + '.')
            if creature == 'Beetle':
              XP += 45
              print(character_name + ' has gained 45 XP!')
            elif creature == 'Thrasher':
              XP += 60
              print(character_name + ' has gained 60 XP!')
            elif creature == 'SandWorm':
              XP += 75
              print(character_name + ' has gained 75 XP!')
            wantToBreak = True
            if wantToBreak == True:
              break
Fetching token
?