Added the start of weapon skills calc and lots of little fixes.
Showing
4 changed files
with
229 additions
and
38 deletions
... | @@ -339,6 +339,14 @@ def db_remove_soul_plate(member_id, idx): | ... | @@ -339,6 +339,14 @@ def db_remove_soul_plate(member_id, idx): |
339 | conn.commit() | 339 | conn.commit() |
340 | return True | 340 | return True |
341 | 341 | ||
342 | def db_update_pankration_record(member_id, column_name, value): | ||
343 | conn = sqlite3.connect('db.sqlite3') | ||
344 | c = conn.cursor() | ||
345 | c.execute("""UPDATE pankration SET """ + column_name + """ = ? | ||
346 | WHERE member_id = ?;""", (value, member_id)) | ||
347 | conn.commit() | ||
348 | conn.close() | ||
349 | |||
342 | def db_add_reflector(member_id, reflector): | 350 | def db_add_reflector(member_id, reflector): |
343 | pan_record = db_get_pankration_record(member_id) | 351 | pan_record = db_get_pankration_record(member_id) |
344 | log("{}".format(member_id)) | 352 | log("{}".format(member_id)) |
... | @@ -394,15 +402,22 @@ def db_convert_soul_plate_to_reflector(member_id, soul_plate, idx): | ... | @@ -394,15 +402,22 @@ def db_convert_soul_plate_to_reflector(member_id, soul_plate, idx): |
394 | return True | 402 | return True |
395 | 403 | ||
396 | 404 | ||
397 | def db_register_battle(member_id, reflector, idx, target_member=None): | 405 | def db_register_battle(member_id, reflector, idx, target_member_id=None): |
398 | pan_record = db_get_pankration_record(member_id) | 406 | pan_record = db_get_pankration_record(member_id) |
399 | conn = sqlite3.connect('db.sqlite3') | 407 | conn = sqlite3.connect('db.sqlite3') |
400 | c = conn.cursor() | 408 | c = conn.cursor() |
401 | db_state = c.execute("SELECT battle_id, reflector_primary member_id FROM pankration_arena WHERE battle_status = 'waiting';").fetchall() | 409 | if target_member_id: |
410 | db_state = c.execute("SELECT battle_id, reflector_primary FROM pankration_arena WHERE battle_status = 'waiting' AND direct_challenge = ?;", (member_id,)).fetchall() | ||
411 | else: | ||
412 | db_state = c.execute("SELECT battle_id, reflector_primary FROM pankration_arena WHERE battle_status = 'waiting' AND direct_challenge = 0;").fetchall() | ||
402 | if not db_state: | 413 | if not db_state: |
403 | log("No battles available: {}".format(idx,)) | 414 | log("No battles available: {}".format(idx,)) |
404 | c.execute("""INSERT INTO pankration_arena(primary_member_id, reflector_primary) | 415 | if target_member_id: |
405 | VALUES(?, ?);""", (member_id, pickle.dumps(reflector))) | 416 | c.execute("""INSERT INTO pankration_arena(primary_member_id, reflector_primary, direct_challenge) |
417 | VALUES(?, ?, ?);""", (member_id, pickle.dumps(reflector), target_member_id)) | ||
418 | else: | ||
419 | c.execute("""INSERT INTO pankration_arena(primary_member_id, reflector_primary) | ||
420 | VALUES(?, ?);""", (member_id, pickle.dumps(reflector))) | ||
406 | conn.commit() | 421 | conn.commit() |
407 | conn.close() | 422 | conn.close() |
408 | db_remove_reflector(member_id, idx) | 423 | db_remove_reflector(member_id, idx) |
... | @@ -440,16 +455,17 @@ def db_complete_battle(battle_id, primary_member_id, primary_reflector, secondar | ... | @@ -440,16 +455,17 @@ def db_complete_battle(battle_id, primary_member_id, primary_reflector, secondar |
440 | else: | 455 | else: |
441 | c.execute("""UPDATE pankration SET reflectors = ?, losses = losses + 1 | 456 | c.execute("""UPDATE pankration SET reflectors = ?, losses = losses + 1 |
442 | WHERE member_id = ?;""", (pickle.dumps(reflectors), primary_member_id)) | 457 | WHERE member_id = ?;""", (pickle.dumps(reflectors), primary_member_id)) |
458 | conn.commit() | ||
443 | 459 | ||
444 | reflectors = pickle.loads(str(db_get_pankration_record(secondary_member_id)['reflectors'])) | 460 | reflectors2 = pickle.loads(str(db_get_pankration_record(secondary_member_id)['reflectors'])) |
445 | reflectors.append(secondary_reflector) | 461 | reflectors2.append(secondary_reflector) |
446 | log('Completing battle - secondary') | 462 | log('Completing battle - secondary') |
447 | if winner == 2: | 463 | if winner == 2: |
448 | c.execute("""UPDATE pankration SET reflectors = ?, wins = wins + 1 | 464 | c.execute("""UPDATE pankration SET reflectors = ?, wins = wins + 1 |
449 | WHERE member_id = ?;""", (pickle.dumps(reflectors), secondary_member_id)) | 465 | WHERE member_id = ?;""", (pickle.dumps(reflectors2), secondary_member_id)) |
450 | else: | 466 | else: |
451 | c.execute("""UPDATE pankration SET reflectors = ?, losses = losses + 1 | 467 | c.execute("""UPDATE pankration SET reflectors = ?, losses = losses + 1 |
452 | WHERE member_id = ?;""", (pickle.dumps(reflectors), secondary_member_id)) | 468 | WHERE member_id = ?;""", (pickle.dumps(reflectors2), secondary_member_id)) |
453 | conn.commit() | 469 | conn.commit() |
454 | conn.close() | 470 | conn.close() |
455 | log('Completing battle - done') | 471 | log('Completing battle - done') | ... | ... |
No preview for this file type
... | @@ -93,6 +93,7 @@ registered_commands = {'!help': 'do_help', '!commands': 'do_help', | ... | @@ -93,6 +93,7 @@ registered_commands = {'!help': 'do_help', '!commands': 'do_help', |
93 | '!convertplate': 'do_convert_plate', '!convertsoulplate': 'do_convert_plate', | 93 | '!convertplate': 'do_convert_plate', '!convertsoulplate': 'do_convert_plate', |
94 | '!assignskill': 'do_assign_skill', | 94 | '!assignskill': 'do_assign_skill', |
95 | '!registerbattle': 'do_register_battle', | 95 | '!registerbattle': 'do_register_battle', |
96 | '!setreflectorname': 'do_set_reflector_name', | ||
96 | '!pankration': 'do_pankration', | 97 | '!pankration': 'do_pankration', |
97 | } | 98 | } |
98 | 99 | ||
... | @@ -1041,6 +1042,7 @@ def do_pankration(client, message_parts, message): | ... | @@ -1041,6 +1042,7 @@ def do_pankration(client, message_parts, message): |
1041 | Ex: **!convertplate 1 reflector** | 1042 | Ex: **!convertplate 1 reflector** |
1042 | **!convertplate 4 skill** | 1043 | **!convertplate 4 skill** |
1043 | **!assignskill <reflector number> <skill num>** - Assigns a skill to a reflector. Each skill is worth a certain amount of feral points, each monster has a maximum of feral points available. | 1044 | **!assignskill <reflector number> <skill num>** - Assigns a skill to a reflector. Each skill is worth a certain amount of feral points, each monster has a maximum of feral points available. |
1045 | **!setreflectorname <reflector number> <name>** - This will rename a monster in your collection to a custom name. | ||
1044 | 1046 | ||
1045 | *Arena Battle:* | 1047 | *Arena Battle:* |
1046 | **!registerbattle <reflector number>** - Adds your reflector to the queue in the arena. When the arena is available your monster will be paired with either another players monster or a similarly matched arena monster. | 1048 | **!registerbattle <reflector number>** - Adds your reflector to the queue in the arena. When the arena is available your monster will be paired with either another players monster or a similarly matched arena monster. |
... | @@ -1048,6 +1050,28 @@ def do_pankration(client, message_parts, message): | ... | @@ -1048,6 +1050,28 @@ def do_pankration(client, message_parts, message): |
1048 | 1050 | ||
1049 | """.format(message.author.mention())) | 1051 | """.format(message.author.mention())) |
1050 | 1052 | ||
1053 | def do_set_reflector_name(client, message_parts, message): | ||
1054 | member = data.db_get_member(message.author.id) | ||
1055 | |||
1056 | if len(message_parts) < 2: | ||
1057 | send_message(client, message.channel, 'You must provide the reflector number and the new name.') | ||
1058 | return | ||
1059 | |||
1060 | reflector_num = message_parts[0] | ||
1061 | new_name = ' '.join(message_parts[1:]) | ||
1062 | pankration_data = data.db_get_pankration_record(member['member_id']) | ||
1063 | if pankration_data and pankration_data['reflectors']: | ||
1064 | reflectors = pickle.loads(str(pankration_data['reflectors'])) | ||
1065 | |||
1066 | if not reflector_num.isdigit() or int(reflector_num) < 1 or int(reflector_num) > len(reflectors): | ||
1067 | send_message(client, message.channel, 'The requested reflector is invalid. Please provide the number from !listreflectors') | ||
1068 | return | ||
1069 | reflector_num = int(reflector_num) - 1 | ||
1070 | reflectors[reflector_num].set_monster_name(new_name) | ||
1071 | data.db_update_pankration_record(member['member_id'], 'reflectors', pickle.dumps(reflectors)) | ||
1072 | send_message(client, message.channel, 'The reflector (monster) name has been updated.') | ||
1073 | else: | ||
1074 | send_message(client, message.channel, 'Unable to find the reflector data.') | ||
1051 | 1075 | ||
1052 | def do_register_battle(client, message_parts, message): | 1076 | def do_register_battle(client, message_parts, message): |
1053 | member = data.db_get_member(message.author.id) | 1077 | member = data.db_get_member(message.author.id) |
... | @@ -1067,13 +1091,17 @@ def do_register_battle(client, message_parts, message): | ... | @@ -1067,13 +1091,17 @@ def do_register_battle(client, message_parts, message): |
1067 | reflector_num = int(reflector_num) - 1 | 1091 | reflector_num = int(reflector_num) - 1 |
1068 | 1092 | ||
1069 | if len(message_parts) > 1: | 1093 | if len(message_parts) > 1: |
1070 | user = ' '.join(message_parts[1:]) | 1094 | username = ' '.join(message_parts[1:]) |
1071 | 1095 | ||
1072 | data.db_register_battle(member['member_id'], reflectors[reflector_num], reflector_num, user) | 1096 | target_member = data.db_get_member(username=username) |
1073 | send_message(client, message.channel, "Your *{} level {}* has been registered for battle with {}. The battle will begin when the arena is availble with the next challenger".format(reflectors[reflector_num].monster_type, reflectors[reflector_num].level, user)) | 1097 | if target_member and 'member_id' in target_member: |
1098 | data.db_register_battle(member['member_id'], reflectors[reflector_num], reflector_num, target_member['member_id']) | ||
1099 | send_message(client, message.channel, "Your *{} level {}* has been registered for battle with {}. The battle will begin when the arena is availble with the next challenger".format(reflectors[reflector_num].get_monster_name(), reflectors[reflector_num].level, username)) | ||
1100 | else: | ||
1101 | send_message(client, message.channel, "There was a problem looking up that user.") | ||
1074 | else: | 1102 | else: |
1075 | data.db_register_battle(member['member_id'], reflectors[reflector_num], reflector_num) | 1103 | data.db_register_battle(member['member_id'], reflectors[reflector_num], reflector_num) |
1076 | send_message(client, message.channel, "Your *{} level {}* has been registered for battle. The battle will begin when the arena is availble with the next challenger".format(reflectors[reflector_num].monster_type, reflectors[reflector_num].level)) | 1104 | send_message(client, message.channel, "Your *{} level {}* has been registered for battle. The battle will begin when the arena is availble with the next challenger".format(reflectors[reflector_num].get_monster_name(), reflectors[reflector_num].level)) |
1077 | else: | 1105 | else: |
1078 | send_message(client, message.channel, 'You have no available reflectors. You can get reflectors by converting soul plates with !convertplate') | 1106 | send_message(client, message.channel, 'You have no available reflectors. You can get reflectors by converting soul plates with !convertplate') |
1079 | return | 1107 | return |
... | @@ -1221,15 +1249,15 @@ def check_arena(): | ... | @@ -1221,15 +1249,15 @@ def check_arena(): |
1221 | 1249 | ||
1222 | send_message(client, arena_channel, "Ladies and gentlemen!\nFor our next match...") | 1250 | send_message(client, arena_channel, "Ladies and gentlemen!\nFor our next match...") |
1223 | time.sleep(5) | 1251 | time.sleep(5) |
1224 | send_message(client, arena_channel, "In the red corner we have...\n **{}**!".format(monster.monster_type)) | 1252 | send_message(client, arena_channel, "In the red corner we have...\n **{}**!".format(monster.get_monster_name())) |
1225 | time.sleep(5) | 1253 | time.sleep(5) |
1226 | send_message(client, arena_channel, "Hmmm... This monster seems {} and {}.".format(monster.get_current_posture()["name"], monster.get_current_attitude()["name"])) | 1254 | send_message(client, arena_channel, "Hmmm... This monster seems {} and {}.".format(monster.get_current_posture()["name"], monster.get_current_attitude()["name"])) |
1227 | time.sleep(5) | 1255 | time.sleep(5) |
1228 | send_message(client, arena_channel, "And in the blue corner is...\n **{}**!".format(monster2.monster_type)) | 1256 | send_message(client, arena_channel, "And in the blue corner is...\n **{}**!".format(monster2.get_monster_name())) |
1229 | time.sleep(5) | 1257 | time.sleep(5) |
1230 | send_message(client, arena_channel, "Hmmm... This monster seems {} and {}.".format(monster2.get_current_posture()["name"], monster2.get_current_attitude()["name"])) | 1258 | send_message(client, arena_channel, "Hmmm... This monster seems {} and {}.".format(monster2.get_current_posture()["name"], monster2.get_current_attitude()["name"])) |
1231 | time.sleep(5) | 1259 | time.sleep(5) |
1232 | send_message(client, arena_channel, "Alright, Pankration fans, the match is about to begin!\n *Chaaaaaarge!*".format(monster2.monster_type)) | 1260 | send_message(client, arena_channel, "Alright, Pankration fans, the match is about to begin!\n *Chaaaaaarge!*".format(monster2.get_monster_name())) |
1233 | time.sleep(5) | 1261 | time.sleep(5) |
1234 | data.db_start_battle(battle['battle_id']) | 1262 | data.db_start_battle(battle['battle_id']) |
1235 | 1263 | ||
... | @@ -1244,12 +1272,12 @@ def check_arena(): | ... | @@ -1244,12 +1272,12 @@ def check_arena(): |
1244 | out_str = "" | 1272 | out_str = "" |
1245 | for action in actions: | 1273 | for action in actions: |
1246 | if isinstance(action, MissAction): | 1274 | if isinstance(action, MissAction): |
1247 | out_str += "{} {} {}.\n".format(action.attacker.monster_type, action.message, action.target.monster_type) | 1275 | out_str += "{} {} {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name()) |
1248 | if isinstance(action, AttackAction): | 1276 | if isinstance(action, AttackAction): |
1249 | out_str += "{} {} {} for {}.\n".format(action.attacker.monster_type, action.message, action.target.monster_type, int(action.damage)) | 1277 | out_str += "{} {} {} for {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name(), int(action.damage)) |
1250 | if isinstance(action, DefeatAction): | 1278 | if isinstance(action, DefeatAction): |
1251 | 1279 | ||
1252 | out_str += "\n\n**{}** {}. {} gains {} xp.\n\n".format(action.target.monster_type, action.message, action.attacker.monster_type, action.xp) | 1280 | out_str += "\n\n**{}** {}. {} gains {} xp.\n\n".format(action.target.get_monster_name(), action.message, action.attacker.get_monster_name(), action.xp) |
1253 | fighting = False | 1281 | fighting = False |
1254 | if action.attacker == monster: | 1282 | if action.attacker == monster: |
1255 | result, xp_msg = monster.add_xp(action.xp) | 1283 | result, xp_msg = monster.add_xp(action.xp) |
... | @@ -1266,7 +1294,7 @@ def check_arena(): | ... | @@ -1266,7 +1294,7 @@ def check_arena(): |
1266 | monster2.wins += 1 | 1294 | monster2.wins += 1 |
1267 | monster.losses += 1 | 1295 | monster.losses += 1 |
1268 | break | 1296 | break |
1269 | out_str += "\n{} {}% - {} {}%\n".format(monster.monster_type, monster.get_hp_percent(), monster2.monster_type, monster2.get_hp_percent()) | 1297 | out_str += "\n{} {}% - {} {}%\n".format(monster.get_monster_name(), monster.get_hp_percent(), monster2.get_monster_name(), monster2.get_hp_percent()) |
1270 | log(out_str) | 1298 | log(out_str) |
1271 | send_message(client, arena_channel, byteify(out_str)) | 1299 | send_message(client, arena_channel, byteify(out_str)) |
1272 | # Heal the monsters before they are returned to the player inventory | 1300 | # Heal the monsters before they are returned to the player inventory | ... | ... |
... | @@ -164,6 +164,10 @@ Families = { | ... | @@ -164,6 +164,10 @@ Families = { |
164 | 'agi_per_level': 0.76, | 164 | 'agi_per_level': 0.76, |
165 | 'base_dex': 10, | 165 | 'base_dex': 10, |
166 | 'dex_per_level': 0.76, | 166 | 'dex_per_level': 0.76, |
167 | 'base_mnd': 8, | ||
168 | 'mnd_per_level': 0.76, | ||
169 | 'base_int': 8, | ||
170 | 'int_per_level': 0.76, | ||
167 | 'temperament_attitude': { | 171 | 'temperament_attitude': { |
168 | 'initial_value': 4, | 172 | 'initial_value': 4, |
169 | 'actions': { | 173 | 'actions': { |
... | @@ -203,6 +207,10 @@ Families = { | ... | @@ -203,6 +207,10 @@ Families = { |
203 | 'agi_per_level': 0.88, | 207 | 'agi_per_level': 0.88, |
204 | 'base_dex': 10, | 208 | 'base_dex': 10, |
205 | 'dex_per_level': 0.714, | 209 | 'dex_per_level': 0.714, |
210 | 'base_mnd': 9, | ||
211 | 'mnd_per_level': 0.9066, | ||
212 | 'base_int': 9, | ||
213 | 'int_per_level': 0.9066, | ||
206 | 'temperament_attitude': { | 214 | 'temperament_attitude': { |
207 | 'initial_value': 4, | 215 | 'initial_value': 4, |
208 | 'actions': { | 216 | 'actions': { |
... | @@ -235,29 +243,97 @@ Monsters = { | ... | @@ -235,29 +243,97 @@ Monsters = { |
235 | 'family': 'ahriman', | 243 | 'family': 'ahriman', |
236 | 'zone': ['ranguemont pass'], | 244 | 'zone': ['ranguemont pass'], |
237 | 'hp': 15, | 245 | 'hp': 15, |
238 | 'weapon_base_damage': 15 | 246 | 'weapon_base_damage': 15, |
247 | 'image_url': 'http://vignette1.wikia.nocookie.net/ffxi/images/9/94/Floating_Eye.JPG/revision/latest?cb=20070704142439' | ||
239 | }, | 248 | }, |
240 | 'Bat Eye': { | 249 | 'Bat Eye': { |
241 | 'family': 'ahriman', | 250 | 'family': 'ahriman', |
242 | 'zone': ['ranguemont pass', 'beaucedine glacier'], | 251 | 'zone': ['ranguemont pass', 'beaucedine glacier'], |
243 | 'hp': 15, | 252 | 'hp': 15, |
244 | 'weapon_base_damage': 15 | 253 | 'weapon_base_damage': 15, |
254 | 'image_url': 'http://vignette3.wikia.nocookie.net/ffxi/images/4/40/Bat_Eye.jpg/revision/latest?cb=20060909124134', | ||
245 | }, | 255 | }, |
246 | 'Evil Eye': { | 256 | 'Evil Eye': { |
247 | 'family': 'ahriman', | 257 | 'family': 'ahriman', |
248 | 'zone': ['castle zvahl baileys', 'castle zvahl keep', 'xarcabard'], | 258 | 'zone': ['castle zvahl baileys', 'castle zvahl keep', 'xarcabard'], |
249 | 'hp': 15, | 259 | 'hp': 15, |
260 | 'weapon_base_damage': 15, | ||
261 | }, | ||
262 | 'Morbid Eye': { | ||
263 | 'family': 'ahriman', | ||
264 | 'zone': ['castle zvahl baileys', 'castle zvahl keep'], | ||
265 | 'hp': 15, | ||
266 | 'weapon_base_damage': 15 | ||
267 | }, | ||
268 | 'Deadly Iris': { | ||
269 | 'family': 'ahriman', | ||
270 | 'zone': ['castle zvahl keep'], | ||
271 | 'hp': 15, | ||
272 | 'weapon_base_damage': 15 | ||
273 | }, | ||
274 | 'Ahriman': { | ||
275 | 'family': 'ahriman', | ||
276 | 'zone': ['castle zvahl baileys'], | ||
277 | 'hp': 15, | ||
278 | 'weapon_base_damage': 15 | ||
279 | }, | ||
280 | 'Fachan': { | ||
281 | 'family': 'ahriman', | ||
282 | 'zone': ['uleguerand range'], | ||
283 | 'hp': 15, | ||
284 | 'weapon_base_damage': 15 | ||
285 | }, | ||
286 | 'Gawper': { | ||
287 | 'family': 'ahriman', | ||
288 | 'zone': ['beaucedine glacier (s)'], | ||
289 | 'hp': 15, | ||
290 | 'weapon_base_damage': 15 | ||
291 | }, | ||
292 | 'Menacing Eye': { | ||
293 | 'family': 'ahriman', | ||
294 | 'zone': ['xarcabard (s)'], | ||
295 | 'hp': 15, | ||
296 | 'weapon_base_damage': 15 | ||
297 | }, | ||
298 | 'Ogler': { | ||
299 | 'family': 'ahriman', | ||
300 | 'zone': ['castle zvahl keep (s)', 'castle zvahl baileys (s)'], | ||
301 | 'hp': 15, | ||
302 | 'weapon_base_damage': 15 | ||
303 | }, | ||
304 | 'Smolenkos': { | ||
305 | 'family': 'ahriman', | ||
306 | 'zone': ['uleguerand range'], | ||
307 | 'hp': 15, | ||
308 | 'weapon_base_damage': 15 | ||
309 | }, | ||
310 | 'Doom Lens': { | ||
311 | 'family': 'ahriman', | ||
312 | 'zone': ['castle zvahl keep (s)', 'castle zvahl baileys (s)'], | ||
313 | 'hp': 15, | ||
314 | 'weapon_base_damage': 15 | ||
315 | }, | ||
316 | 'Scowlenkos': { | ||
317 | 'family': 'ahriman', | ||
318 | 'zone': ['uleguerand range'], | ||
319 | 'hp': 15, | ||
250 | 'weapon_base_damage': 15 | 320 | 'weapon_base_damage': 15 |
251 | } | 321 | } |
322 | |||
252 | } | 323 | } |
253 | 324 | ||
254 | UnsortedZones = { | 325 | UnsortedZones = { |
255 | 'abyssea - uleguerand': {'cost': 10, 'find_percent': 50}, | 326 | 'abyssea - uleguerand': {'cost': 10, 'find_percent': 50}, |
256 | 'beaucedine glacier': {'cost': 10, 'find_percent': 50}, | 327 | 'beaucedine glacier': {'cost': 10, 'find_percent': 50}, |
328 | 'beaucedine glacier (s)': {'cost': 10, 'find_percent': 50}, | ||
257 | 'castle zvahl baileys': {'cost': 10, 'find_percent': 50}, | 329 | 'castle zvahl baileys': {'cost': 10, 'find_percent': 50}, |
330 | 'castle zvahl baileys (s)': {'cost': 10, 'find_percent': 50}, | ||
258 | 'castle zvahl keep': {'cost': 10, 'find_percent': 50}, | 331 | 'castle zvahl keep': {'cost': 10, 'find_percent': 50}, |
332 | 'castle zvahl keep (s)': {'cost': 10, 'find_percent': 50}, | ||
259 | 'ranguemont pass': {'cost': 10, 'find_percent': 50}, | 333 | 'ranguemont pass': {'cost': 10, 'find_percent': 50}, |
334 | 'uleguerand range': {'cost': 10, 'find_percent': 50}, | ||
260 | 'xarcabard': {'cost': 10, 'find_percent': 50}, | 335 | 'xarcabard': {'cost': 10, 'find_percent': 50}, |
336 | 'xarcabard (s)': {'cost': 10, 'find_percent': 50}, | ||
261 | } | 337 | } |
262 | 338 | ||
263 | Zones = collections.OrderedDict(sorted(UnsortedZones.items())) | 339 | Zones = collections.OrderedDict(sorted(UnsortedZones.items())) |
... | @@ -297,7 +373,7 @@ class Pankration: | ... | @@ -297,7 +373,7 @@ class Pankration: |
297 | monster_data = Monsters[monster_name] | 373 | monster_data = Monsters[monster_name] |
298 | hp = monster_data['hp'] | 374 | hp = monster_data['hp'] |
299 | weapon_base_damage = monster_data['weapon_base_damage'] | 375 | weapon_base_damage = monster_data['weapon_base_damage'] |
300 | print("Monster: {} Data: {}".format(monster_name, monster_data)) | 376 | log("Monster: {} Data: {}".format(monster_name, monster_data)) |
301 | family_name = monster_data['family'] | 377 | family_name = monster_data['family'] |
302 | family = Families[family_name] | 378 | family = Families[family_name] |
303 | level = 1 | 379 | level = 1 |
... | @@ -317,7 +393,10 @@ class Pankration: | ... | @@ -317,7 +393,10 @@ class Pankration: |
317 | 393 | ||
318 | monster = Monster(monster_name, family_name, family, hp, level, weapon_base_damage, main_job, support_job, feral_skills, | 394 | monster = Monster(monster_name, family_name, family, hp, level, weapon_base_damage, main_job, support_job, feral_skills, |
319 | [], dicipline_level) | 395 | [], dicipline_level) |
320 | return HuntResponse(HuntResponse.SUCCESS, "You captured a *{}*!".format(monster_name), | 396 | url = '' |
397 | if 'image_url' in monster_data: | ||
398 | url = monster_data['image_url'] | ||
399 | return HuntResponse(HuntResponse.SUCCESS, "You captured a *{}*!\n\n{}".format(monster_name, url), | ||
321 | monster) | 400 | monster) |
322 | else: | 401 | else: |
323 | return HuntResponse(HuntResponse.FAILURE, "You were unable to capture a monster's soul.", | 402 | return HuntResponse(HuntResponse.FAILURE, "You were unable to capture a monster's soul.", |
... | @@ -330,6 +409,7 @@ class Pankration: | ... | @@ -330,6 +409,7 @@ class Pankration: |
330 | class Monster: | 409 | class Monster: |
331 | def __init__(self, monster_type, family_name, family, base_hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills, | 410 | def __init__(self, monster_type, family_name, family, base_hp, level, weapon_base_damage, main_job, support_job, innate_feral_skills, |
332 | equipped_feral_skills, dicipline_level): | 411 | equipped_feral_skills, dicipline_level): |
412 | self.custom_name = None | ||
333 | self.monster_type = monster_type | 413 | self.monster_type = monster_type |
334 | self.family_name = family_name | 414 | self.family_name = family_name |
335 | self.family = family | 415 | self.family = family |
... | @@ -355,17 +435,31 @@ class Monster: | ... | @@ -355,17 +435,31 @@ class Monster: |
355 | self.agi_per_level = family['agi_per_level'] | 435 | self.agi_per_level = family['agi_per_level'] |
356 | self.base_dex = family['base_dex'] | 436 | self.base_dex = family['base_dex'] |
357 | self.dex_per_level = family['dex_per_level'] | 437 | self.dex_per_level = family['dex_per_level'] |
438 | self.base_mnd = family['base_mnd'] | ||
439 | self.mnd_per_level = family['mnd_per_level'] | ||
440 | self.base_int = family['base_int'] | ||
441 | self.int_per_level = family['int_per_level'] | ||
442 | self.tp = 0 | ||
358 | self.hp = self.get_hp() | 443 | self.hp = self.get_hp() |
359 | self.wins = 0 | 444 | self.wins = 0 |
360 | self.losses = 0 | 445 | self.losses = 0 |
361 | 446 | ||
362 | def __str__(self): | 447 | def __str__(self): |
363 | try: | 448 | try: |
364 | return "**{}**\n*Stats:*\nFamily: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nFeral Points: {}\n\nWins: {}\nLosses: {}".format(self.monster_type, self.family_name, self.level, Jobs().get_job_name(self.main_job), Jobs().get_job_name(self.support_job), ', '.join(self.innate_feral_skills), ', '.join(self.equipped_feral_skills), self.get_fp(), self.wins, self.losses) | 449 | return "**{}**\n*Stats:*\nFamily: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nFeral Points: {}\n\nWins: {}\nLosses: {}".format(self.get_monster_name(), self.family_name, self.level, Jobs().get_job_name(self.main_job), Jobs().get_job_name(self.support_job), ', '.join(self.innate_feral_skills), ', '.join(self.equipped_feral_skills), self.get_fp(), self.wins, self.losses) |
365 | except AttributeError: | 450 | except AttributeError: |
366 | return "Old Format monster, unable to display." | 451 | return "Old Format monster, unable to display." |
367 | #return "Family: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nDicipline Level: {}\nTemperament...".format(self.family, self.level, self.main_job, self.support_job, self.innate_feral_skills, self.equipped_feral_skills, self.discipline_level) | 452 | #return "Family: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nDicipline Level: {}\nTemperament...".format(self.family, self.level, self.main_job, self.support_job, self.innate_feral_skills, self.equipped_feral_skills, self.discipline_level) |
368 | 453 | ||
454 | def get_monster_name(self): | ||
455 | if self.custom_name: | ||
456 | return self.custom_name | ||
457 | else: | ||
458 | return self.monster_type | ||
459 | |||
460 | def set_monster_name(self, name): | ||
461 | self.custom_name = name | ||
462 | |||
369 | def get_soul_plate_description(self): | 463 | def get_soul_plate_description(self): |
370 | try: | 464 | try: |
371 | return "*Family:*\n**{}**\nJob Trait: {}\nFeral Points: {}".format(self.family_name, Jobs().get_job_name(self.main_job), self.get_fp()) | 465 | return "*Family:*\n**{}**\nJob Trait: {}\nFeral Points: {}".format(self.family_name, Jobs().get_job_name(self.main_job), self.get_fp()) |
... | @@ -375,7 +469,7 @@ class Monster: | ... | @@ -375,7 +469,7 @@ class Monster: |
375 | 469 | ||
376 | def get_reflector_description(self): | 470 | def get_reflector_description(self): |
377 | try: | 471 | try: |
378 | return "**{}**\n*Stats:*\nFamily: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nFeral Points: {}\n\nWins: {}\nLosses: {}".format(self.monster_type, self.family_name, self.level, Jobs().get_job_name(self.main_job), Jobs().get_job_name(self.support_job), ', '.join(self.innate_feral_skills), ', '.join(self.equipped_feral_skills), self.get_fp(), self.wins, self.losses) | 472 | return "**{}**\n*Stats:*\nFamily: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nFeral Points: {}\n\nWins: {}\nLosses: {}".format(self.get_monster_name(), self.family_name, self.level, Jobs().get_job_name(self.main_job), Jobs().get_job_name(self.support_job), ', '.join(self.innate_feral_skills), ', '.join(self.equipped_feral_skills), self.get_fp(), self.wins, self.losses) |
379 | except AttributeError: | 473 | except AttributeError: |
380 | return "Old Format monster, unable to display." | 474 | return "Old Format monster, unable to display." |
381 | #return "Family: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nDicipline Level: {}\nTemperament...".format(self.family, self.level, self.main_job, self.support_job, self.innate_feral_skills, self.equipped_feral_skills, self.discipline_level) | 475 | #return "Family: {}\nLevel: {}\nMain Job: {}\nSupport Job: {}\nInnate Feral Skills: {}\nEquipped Feral Skills: {}\nDicipline Level: {}\nTemperament...".format(self.family, self.level, self.main_job, self.support_job, self.innate_feral_skills, self.equipped_feral_skills, self.discipline_level) |
... | @@ -444,6 +538,12 @@ class Monster: | ... | @@ -444,6 +538,12 @@ class Monster: |
444 | def get_agility(self): | 538 | def get_agility(self): |
445 | return int(round(max(self.base_agi, self.level * self.agi_per_level))) | 539 | return int(round(max(self.base_agi, self.level * self.agi_per_level))) |
446 | 540 | ||
541 | def get_mind(self): | ||
542 | return int(round(max(self.base_mnd, self.level * self.mnd_per_level))) | ||
543 | |||
544 | def get_intelligence(self): | ||
545 | return int(round(max(self.base_int, self.level * self.int_per_level))) | ||
546 | |||
447 | def get_base_defense(self): | 547 | def get_base_defense(self): |
448 | return (math.floor(self.get_vitality()/2) + 8 + self.level) | 548 | return (math.floor(self.get_vitality()/2) + 8 + self.level) |
449 | 549 | ||
... | @@ -459,6 +559,41 @@ class Monster: | ... | @@ -459,6 +559,41 @@ class Monster: |
459 | rate = 95 | 559 | rate = 95 |
460 | return rate | 560 | return rate |
461 | 561 | ||
562 | def get_physical_ws_damage(self, base_damage, modifiers): | ||
563 | level_range_alpha = 1.01 - (math.floor(float(self.level) / 5.0) / 100.0) | ||
564 | wsc = 0 | ||
565 | for modifier in modifiers: | ||
566 | if modifier['stat'] == 'str': | ||
567 | wsc += (modifer['percent'] / 100) * self.get_strength() | ||
568 | elif modifiers['stat'] == 'vit': | ||
569 | wsc += (modifer['percent'] / 100) * self.get_vitality() | ||
570 | elif modifiers['stat'] == 'dex': | ||
571 | wsc += (modifer['percent'] / 100) * self.get_dexterity() | ||
572 | elif modifiers['stat'] == 'agi': | ||
573 | wsc += (modifer['percent'] / 100) * self.get_agility() | ||
574 | elif modifiers['stat'] == 'eva': | ||
575 | wsc += (modifer['percent'] / 100) * self.get_evasion() | ||
576 | elif modifiers['stat'] == 'int': | ||
577 | wsc += (modifer['percent'] / 100) * self.get_intelligence() | ||
578 | elif modifiers['stat'] == 'mnd': | ||
579 | wsc += (modifer['percent'] / 100) * self.get_mind() | ||
580 | wsc = (wsc * level_range_alpha) | ||
581 | |||
582 | bd = float(self.weapon_base_damage) | ||
583 | if attack_type == 'ranged': | ||
584 | bd += self.ammo_damage | ||
585 | |||
586 | fstr = ((self.get_strength() - enemy_vit)+4) / 4 | ||
587 | |||
588 | final_damage = bd + fstr + wsc | ||
589 | |||
590 | return final_damage | ||
591 | |||
592 | #TODO: Add fTP calculation and PDIF | ||
593 | #final_damage = (bd ) | ||
594 | #return final_damage | ||
595 | |||
596 | |||
462 | # Calculate the base damage against the provided defense | 597 | # Calculate the base damage against the provided defense |
463 | # attack_type can be 'ranged' or 'melee' | 598 | # attack_type can be 'ranged' or 'melee' |
464 | def get_physical_base_damage(self, defense, attack_type, level_difference, enemy_vit): | 599 | def get_physical_base_damage(self, defense, attack_type, level_difference, enemy_vit): |
... | @@ -520,15 +655,19 @@ class Monster: | ... | @@ -520,15 +655,19 @@ class Monster: |
520 | 655 | ||
521 | def attack(self, monster): | 656 | def attack(self, monster): |
522 | phy_damage = self.get_physical_base_damage(monster.get_base_defense(), 'melee', monster.level - self.level, monster.get_vitality()) | 657 | phy_damage = self.get_physical_base_damage(monster.get_base_defense(), 'melee', monster.level - self.level, monster.get_vitality()) |
658 | self.tp += 64 | ||
523 | return (phy_damage, 'hits') | 659 | return (phy_damage, 'hits') |
524 | 660 | ||
525 | def is_a_hit(self, monster): | 661 | def is_a_hit(self, monster): |
526 | hit_rate = self.get_hit_rate(monster.get_evasion(), monster.level - self.level) | 662 | hit_rate = self.get_hit_rate(monster.get_evasion(), monster.level - self.level) |
527 | return random.randint(1, 100) < hit_rate | 663 | return random.randint(1, 100) < hit_rate |
528 | 664 | ||
529 | def apply_damage(self, damage): | 665 | def apply_damage(self, damage, is_spell=False): |
530 | self.hp -= damage | 666 | self.hp -= damage |
531 | # Check life and return 'awesome', 'fucked up', 'dead' or something | 667 | if is_spell: |
668 | self.tp += 100 | ||
669 | else: | ||
670 | self.tp += 30 | ||
532 | 671 | ||
533 | # This should ONLY be executed at the start of battle. | 672 | # This should ONLY be executed at the start of battle. |
534 | def set_strategy(self, temperament_posture, temperament_attitude): | 673 | def set_strategy(self, temperament_posture, temperament_attitude): |
... | @@ -633,18 +772,21 @@ class Arena: | ... | @@ -633,18 +772,21 @@ class Arena: |
633 | if __name__ == "__main__": | 772 | if __name__ == "__main__": |
634 | #print Families | 773 | #print Families |
635 | 774 | ||
775 | hunt_response = None | ||
636 | p = Pankration() | 776 | p = Pankration() |
637 | print("Zones: \n\n{}".format('\n'.join(p.list_zones()))) | 777 | print("Zones: \n\n{}".format('\n'.join(p.list_zones()))) |
638 | hunt_zone = p.list_zones()[0] | 778 | hunt_zone = p.list_zones().keys()[0] |
639 | print("Hunting for monster in zone: {}\n".format(hunt_zone)) | 779 | print("Hunting for monster in zone: {}\n".format(hunt_zone)) |
640 | hunt_response = p.hunt_monster(hunt_zone) | 780 | while not hunt_response or (hasattr(hunt_response, 'result') and hunt_response.result != HuntResponse.SUCCESS): |
781 | hunt_response = p.hunt_monster(hunt_zone) | ||
641 | print("hunt_response") | 782 | print("hunt_response") |
642 | print(str(hunt_response.result)) | 783 | print(str(hunt_response.result)) |
643 | time.sleep(0.5) | 784 | time.sleep(0.5) |
644 | if hunt_response.result == HuntResponse.SUCCESS: | 785 | if hunt_response.result == HuntResponse.SUCCESS: |
645 | print(hunt_response.message) | 786 | print(hunt_response.message) |
646 | monster = hunt_response.monster | 787 | monster = hunt_response.monster |
647 | # print("The Soul Plate Shows: \n\n{}".format(monster)) | 788 | monster.set_monster_name('Kickass 1') |
789 | print("The Soul Plate Shows: \n\n{}".format(monster)) | ||
648 | # print(monster.set_strategy(4, 3)) | 790 | # print(monster.set_strategy(4, 3)) |
649 | # print(monster.set_strategy(1, 1)) | 791 | # print(monster.set_strategy(1, 1)) |
650 | # print(monster.set_strategy(1, 2)) | 792 | # print(monster.set_strategy(1, 2)) |
... | @@ -659,11 +801,16 @@ if __name__ == "__main__": | ... | @@ -659,11 +801,16 @@ if __name__ == "__main__": |
659 | else: | 801 | else: |
660 | print(hunt_response.message) | 802 | print(hunt_response.message) |
661 | 803 | ||
804 | hunt_response2 = None | ||
805 | hunt_zone = p.list_zones().keys()[1] | ||
806 | while not hunt_response2 or (hasattr(hunt_response2, 'result') and hunt_response2.result != HuntResponse.SUCCESS): | ||
807 | hunt_response2 = p.hunt_monster(hunt_zone) | ||
808 | if hunt_response2.result == HuntResponse.SUCCESS: | ||
809 | monster2 = hunt_response2.monster | ||
810 | monster2.set_monster_name('wreckbutt 2') | ||
811 | print("1 The Soul Plate Shows: \n\n{}".format(monster)) | ||
812 | print("2 The Soul Plate Shows: \n\n{}".format(monster2)) | ||
662 | 813 | ||
663 | hunt_zone = p.list_zones()[1] | ||
664 | hunt_response = p.hunt_monster(hunt_zone) | ||
665 | if hunt_response.result == HuntResponse.SUCCESS: | ||
666 | monster2 = hunt_response.monster | ||
667 | #monster2.add_xp(16900) | 814 | #monster2.add_xp(16900) |
668 | phy_damage = monster2.attack(monster) | 815 | phy_damage = monster2.attack(monster) |
669 | print("Phys Attack: {}".format(phy_damage)) | 816 | print("Phys Attack: {}".format(phy_damage)) |
... | @@ -682,17 +829,17 @@ if __name__ == "__main__": | ... | @@ -682,17 +829,17 @@ if __name__ == "__main__": |
682 | time.sleep(2) | 829 | time.sleep(2) |
683 | for action in actions: | 830 | for action in actions: |
684 | if isinstance(action, MissAction): | 831 | if isinstance(action, MissAction): |
685 | print("{} {} {}.".format(action.attacker.monster_type, action.message, action.target.monster_type)) | 832 | print("{} {} {}.".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name())) |
686 | if isinstance(action, AttackAction): | 833 | if isinstance(action, AttackAction): |
687 | print("{} {} {} for {}.".format(action.attacker.monster_type, action.message, action.target.monster_type, action.damage)) | 834 | print("{} {} {} for {}.".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name(), action.damage)) |
688 | if isinstance(action, DefeatAction): | 835 | if isinstance(action, DefeatAction): |
689 | print("{} {}. {} gains {} xp.".format(action.target.monster_type, action.message, action.attacker.monster_type, action.xp)) | 836 | print("{} {}. {} gains {} xp.".format(action.target.get_monster_name(), action.message, action.attacker.get_monster_name(), action.xp)) |
690 | action.attacker.hp = 500 | 837 | action.attacker.hp = 500 |
691 | print("{} {}".format(action.target.hp, action.attacker.hp)) | 838 | print("{} {}".format(action.target.hp, action.attacker.hp)) |
692 | fighting = False | 839 | fighting = False |
693 | break | 840 | break |
694 | print("\n\nhp: {} {}\n\n".format(monster.hp, monster2.hp)) | 841 | print("\n\nhp: {} {}\n\n".format(monster.hp, monster2.hp)) |
695 | print("\n{} {}% - {} {}%\n".format(monster.monster_type, monster.get_hp_percent(), monster2.monster_type, monster2.get_hp_percent())) | 842 | print("\n{} {}% - {} {}%\n".format(monster.get_monster_name(), monster.get_hp_percent(), monster2.get_monster_name(), monster2.get_hp_percent())) |
696 | 843 | ||
697 | 844 | ||
698 | 845 | ... | ... |
-
Please register or sign in to post a comment