SWNPC version 1
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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
#!/bin/python3 import random import sys # available species for NPC's species = [ 'human', 'keldor', 'arcona', 'gank' ] #======================================================= #basic human attributes human_attributes = { 'Brawn':'2','Agility':'2', 'Intellect':'2', 'Cunning':'2','Willpower':'2', 'Presence':'2', 'wound_threshold':'10', 'strain_threshold':'10' } keldor_attributes = { 'Brawn':'1','Agility':'2', 'Intellect':'2', 'Cunning':'2','Willpower':'3', 'Presence':'2', 'wound_threshold':'10', 'strain_threshold':'10' } arcona_attributes = { 'Brawn':'1','Agility':'2', 'Intellect':'2', 'Cunning':'2','Willpower':'3', 'Presence':'2', 'wound_threshold':'10', 'strain_threshold':'10' } #basic gank attributes gank_attributes = { 'Brawn':'2','Agility':'2', 'Intellect':'2', 'Cunning':'2','Willpower':'2', 'Presence':'1', 'wound_threshold':'10', 'strain_threshold':'10', 'equipment':'cybernetics' } #===================================================================== # NPC class/type/proffession npc_type = [ 'pirate', 'trooper', 'monk' , 'bounty hunter' ] #====================================================== # skill pool of pirate class pirate_skills = { 'Astrogation':'2', 'Atheletics':'1', 'Coercion':'2', 'Deception':'2', 'Mechanics':'2', \ 'Piloting':'2', 'Skullduggery':'2' } #pirate equipment pirate_equipment = { 'defense':'0' } #------------------------------------------------------ # skill pool of trooper class trooper_skills = { 'Knowledge-Warfare':'2', 'Atheletics':'2', 'Medicine':'1', 'Resilence':'2', 'Vigilance':'2', \ 'Piloting':'1', 'cool':'1' } # trooper equipment trooper_equipment = { 'blaster rifle':'damage 8, crit 4, medium range', 'armor':'Laminate - 2 soak', 'defense':'0' } #------------------------------------------------------ # skill pool of monk class monk_skills = { 'Knowledge-religion':'2', 'Atheletics':'2', 'Medicine':'1', 'Resilence':'2', 'Vigilance':'2', 'Lore':'1', \ 'Charm':'1', 'Coercion':'1', 'Education':'1', 'Perception':'1' } #monk equipment monk_equipment = { 'defense':'0' } #------------------------------------------------------ # skill pool of bounty hunter class bounty_hunter_skills = { 'Astrogation':'2', 'Atheletics':'2', 'Streetwise':'1', 'Perception':'2', 'Vigilance':'2', \ 'Piloting-planetary':'1', 'Skullduggery':'2', 'Stealth':'1', 'Investigation':'2', 'Computers':'1', 'Outer Rim':'1', \ 'Underworld':'1', 'Xenology':'1', 'survival':'1', } #bounty hunter equipment bounty_hunter_equipment = { 'defense':'0' } #------------------------------------------------------ # weapon skills used by any class weapon_skills = { 'Brawl':'2','Gunnery':'2','Melee':'2','Ranged-light':'2','Ranged-heavy':'2' } # weapon list weapons = { 'light blaster pistol':'damage 5, crit 4, medium range', 'heavy blaster pistol':'damage 9, crit 3, medium range', 'knife':'Damage 3, crit 2, melee' } # function evaluate species and adds/subtracts # between -1 an +1 random points/subtracts # from base characteristic values. #------------------------------------------------- def attr_apply(spec): global brawn global agility global intellect global cunning global willpower global presence global wthresh global sthresh brawn = int(eval(spec + "_attributes['Brawn']")) + random.randint(-1,1) agility = int(eval(spec + "_attributes['Agility']")) + random.randint(-1,1) intellect = int(eval(spec + "_attributes['Intellect']")) + random.randint(-1,1) cunning = int(eval(spec + "_attributes['Cunning']")) + random.randint(-1,1) willpower = int(eval(spec + "_attributes['Willpower']")) + random.randint(-1,1) presence = int(eval(spec + "_attributes['Presence']")) + random.randint(-1,1) wthresh = int(eval(spec + "_attributes['wound_threshold']")) + brawn sthresh = int(eval(spec + "_attributes['strain_threshold']")) + willpower #function to add class bonus and equipment #------------------------------------------------ def class_skills(npc_class): print("Skills:") print("-------------------------------------------") print("Career Skills:",str(random.sample(list(eval(npc_class + "_skills.items()")),4)).replace("[",'').replace("]",'').replace("'","")) print() print("Weapon skills:",str(random.sample(weapon_skills.items(),2)).replace("[",'').replace("]",'').replace("'","")) print() print() print("Credits & Equipment:") print("--------------------------------------------") print("Weapon(s):",str(random.sample(list(weapons.items()),2)).replace("[",'').replace("]",'').replace("'","")) print(str(list(eval(npc_class + "_equipment.items()"))).replace("[",'').replace("]",'').replace("'","")) #---------------------------------------------- print() print() print('========================================') print('Python interactive NPC builder') print('========================================') print(" _______..___________. ___ .______ ____ __ ____ ___ .______ _______.") print(" / || | / \ | _ \ \ \ / \ / / / \ | _ \ / |") print(" | (----``---| |----` / ^ \ | |_) | \ \/ \/ / / ^ \ | |_) | | (----`") print(" \ \ | | / /_\ \ | / \ / / /_\ \ | / \ \ ") print(".----) | | | / _____ \ | |\ \----. \ /\ / / _____ \ | |\ \----..----) | ") print("|_______/ |__| /__/ \__\ | _| `._____| \__/ \__/ /__/ \__\ | _| `._____||_______/ ") print() print() while True: try: # enter NPC number numbernpcs = int(input("Please enter number of NPC\'s:")) except ValueError: print("Please type whole number greater than 0") continue # check if user input is greater than one if numbernpcs < 1: print('NPC\'s must be greater than one') continue else: break print() while True: # enter NPC species print("============================================") print("Species select") print("Possible selections include:",species) print("============================================") species_select = input("Please select species of NPC\'s:") if species_select in species: break else: print("please enter valid species from list above") while True: # enter NPC type/class/profession print("============================================") print("tpye, career, profession select") print("Possible selections include:",npc_type) print("============================================") npc_type_select = input("Please select career type of NPC\'s:") npc_type_formatted = npc_type_select.replace(" ","_") if npc_type_select in npc_type: break else: print("please enter valid career type") print() print() # populate the armor defense value - default 0 #============================================================= armor_d = str(eval(npc_type_formatted + "_equipment['defense']")) #============================================================= print("=============================================") print("# of NPC's = ",numbernpcs) print("Species = ",species_select) print("NPC career type = ",npc_type_select) print("npc.txt Succesfully Created!") print(npc_type_formatted) print("=============================================") print() print() # variables for counter #--------------- count = numbernpcs npc_count = 1 #--------------- #attr_apply(species_select) #================================================================================= # Open file handle record to .txt file #------------------------ sys.stdout=open("npc.txt","w") #------------------------ while npc_count <= count: attr_apply(species_select) print("==============================================================================================") print("NPC #",npc_count,species_select,npc_type_select) print("Name:") print("Association:") print("==============================================================================================") print("--------------------------------------------------------------------------------------------------") print("| Soak Value | Wounds | | Strain | Defense | |") print("| | Threshold | Current |Threshold current | ranged | melee |") print("| | ",wthresh," | | ",sthresh," | |",armor_d," | |") print("| | | | | | | |") print("--------------------------------------------------------------------------------------------------") print() print(" Characteristics") print("-----------------------------------------------------------------------------") print("| Brawn | Agility | Intellect | Cunning | Willpower | Presence |") print("| ",brawn," | ",agility," | ",intellect," | ",cunning," \ | ",willpower," | ",presence," |") print("| | | | | | |") print("| | | | | | |") print("-----------------------------------------------------------------------------") print() class_skills(npc_type_formatted) print() print() print() print() print() print() print() npc_count += 1 #------------------------ # close file handle to .txt file sys.stdout.close() #------------------------ |
No Comments
RSS feed for comments on this post.
Sorry, the comment form is closed at this time.