Most of the magic system is now in place.
Showing
4 changed files
with
14 additions
and
6 deletions
... | @@ -67,6 +67,7 @@ def db_buy_ticket(member_id, amount): | ... | @@ -67,6 +67,7 @@ def db_buy_ticket(member_id, amount): |
67 | return True, int(credits[1]) + int(amount) | 67 | return True, int(credits[1]) + int(amount) |
68 | except Exception as e: | 68 | except Exception as e: |
69 | log(e) | 69 | log(e) |
70 | |||
70 | def db_update_credit(member_id, amount): | 71 | def db_update_credit(member_id, amount): |
71 | conn = sqlite3.connect('db.sqlite3') | 72 | conn = sqlite3.connect('db.sqlite3') |
72 | c = conn.cursor() | 73 | c = conn.cursor() |
... | @@ -168,7 +169,6 @@ def db_get_fortune(): | ... | @@ -168,7 +169,6 @@ def db_get_fortune(): |
168 | try: | 169 | try: |
169 | conn = sqlite3.connect('db.sqlite3') | 170 | conn = sqlite3.connect('db.sqlite3') |
170 | c = conn.cursor() | 171 | c = conn.cursor() |
171 | # TODO: Move this shit to data | ||
172 | return c.execute("SELECT fortune FROM fortunes ORDER BY RANDOM() LIMIT 1;").fetchone()[0] | 172 | return c.execute("SELECT fortune FROM fortunes ORDER BY RANDOM() LIMIT 1;").fetchone()[0] |
173 | finally: | 173 | finally: |
174 | conn.close() | 174 | conn.close() |
... | @@ -192,7 +192,6 @@ def db_get_fortune(): | ... | @@ -192,7 +192,6 @@ def db_get_fortune(): |
192 | try: | 192 | try: |
193 | conn = sqlite3.connect('db.sqlite3') | 193 | conn = sqlite3.connect('db.sqlite3') |
194 | c = conn.cursor() | 194 | c = conn.cursor() |
195 | # TODO: Move this shit to data | ||
196 | return c.execute("SELECT fortune FROM fortunes ORDER BY RANDOM() LIMIT 1;").fetchone()[0] | 195 | return c.execute("SELECT fortune FROM fortunes ORDER BY RANDOM() LIMIT 1;").fetchone()[0] |
197 | finally: | 196 | finally: |
198 | conn.close() | 197 | conn.close() | ... | ... |
No preview for this file type
... | @@ -27,7 +27,7 @@ import wolframalpha | ... | @@ -27,7 +27,7 @@ import wolframalpha |
27 | import sqlite3 | 27 | import sqlite3 |
28 | from blackjack import Blackjack | 28 | from blackjack import Blackjack |
29 | import data | 29 | import data |
30 | from pankration import Pankration, HuntResponse, Jobs, Action, MissAction, AttackAction, DefeatAction, TemperamentPosture, TemperamentAttitude | 30 | from pankration import Pankration, HuntResponse, Jobs, Action, MagicResistAction, MissAction, AttackAction, DefeatAction, TemperamentPosture, TemperamentAttitude |
31 | 31 | ||
32 | VERSION = 2.3 | 32 | VERSION = 2.3 |
33 | 33 | ||
... | @@ -1203,7 +1203,7 @@ def do_hunt_monster(client, message_parts, message): | ... | @@ -1203,7 +1203,7 @@ def do_hunt_monster(client, message_parts, message): |
1203 | if not result: | 1203 | if not result: |
1204 | send_message(client, message.author, error_message) | 1204 | send_message(client, message.author, error_message) |
1205 | return | 1205 | return |
1206 | send_message(client, message.channel, 'Soul Plate purchased for {} credits\n Hunting in {}'.format(cost, zone)) | 1206 | send_message(client, message.channel, '{} Soul Plate purchased for {} credits\n Hunting in {}'.format(message.author.name, cost, zone)) |
1207 | time.sleep(3) | 1207 | time.sleep(3) |
1208 | hunt_response = p.hunt_monster(' '.join(message_parts)) | 1208 | hunt_response = p.hunt_monster(' '.join(message_parts)) |
1209 | str_out = hunt_response.message + "\n\n" | 1209 | str_out = hunt_response.message + "\n\n" |
... | @@ -1212,7 +1212,7 @@ def do_hunt_monster(client, message_parts, message): | ... | @@ -1212,7 +1212,7 @@ def do_hunt_monster(client, message_parts, message): |
1212 | member = data.db_get_member(message.author.id) | 1212 | member = data.db_get_member(message.author.id) |
1213 | data.db_add_soul_plate(member['member_id'], soul_plate) | 1213 | data.db_add_soul_plate(member['member_id'], soul_plate) |
1214 | str_out += str(soul_plate.get_soul_plate_description()) | 1214 | str_out += str(soul_plate.get_soul_plate_description()) |
1215 | send_message(client, message.channel, str_out) | 1215 | send_message(client, message.channel, "{} {}".format(message.author.name, str_out)) |
1216 | 1216 | ||
1217 | 1217 | ||
1218 | def do_list_zones(client, message_parts, message): | 1218 | def do_list_zones(client, message_parts, message): |
... | @@ -1271,12 +1271,20 @@ def check_arena(): | ... | @@ -1271,12 +1271,20 @@ def check_arena(): |
1271 | time.sleep(4) | 1271 | time.sleep(4) |
1272 | out_str = "" | 1272 | out_str = "" |
1273 | for action in actions: | 1273 | for action in actions: |
1274 | # TODO: Decide if I should merge magicresistaction with miss action | ||
1275 | if isinstance(action, MagicResistAction): | ||
1276 | out_str += "{} {} {} while casting {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name(), action.spell) | ||
1274 | if isinstance(action, MissAction): | 1277 | if isinstance(action, MissAction): |
1278 | if action.spell: | ||
1279 | out_str += "{} {} {} while casting {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name(), action.spell) | ||
1280 | else: | ||
1275 | out_str += "{} {} {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name()) | 1281 | out_str += "{} {} {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name()) |
1276 | if isinstance(action, AttackAction): | 1282 | if isinstance(action, AttackAction): |
1283 | if action.spell: | ||
1284 | out_str += "{} {} {} against {} for {}.\n".format(action.attacker.get_monster_name(), action.message, action.spell, action.target.get_monster_name(), int(action.damage)) | ||
1285 | else: | ||
1277 | out_str += "{} {} {} for {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name(), int(action.damage)) | 1286 | out_str += "{} {} {} for {}.\n".format(action.attacker.get_monster_name(), action.message, action.target.get_monster_name(), int(action.damage)) |
1278 | if isinstance(action, DefeatAction): | 1287 | if isinstance(action, DefeatAction): |
1279 | |||
1280 | out_str += "\n\n**{}** {}. {} gains {} xp.\n\n".format(action.target.get_monster_name(), action.message, action.attacker.get_monster_name(), action.xp) | 1288 | out_str += "\n\n**{}** {}. {} gains {} xp.\n\n".format(action.target.get_monster_name(), action.message, action.attacker.get_monster_name(), action.xp) |
1281 | fighting = False | 1289 | fighting = False |
1282 | if action.attacker == monster: | 1290 | if action.attacker == monster: |
... | @@ -1294,6 +1302,7 @@ def check_arena(): | ... | @@ -1294,6 +1302,7 @@ def check_arena(): |
1294 | monster2.wins += 1 | 1302 | monster2.wins += 1 |
1295 | monster.losses += 1 | 1303 | monster.losses += 1 |
1296 | break | 1304 | break |
1305 | if fighting: | ||
1297 | out_str += "\n{} {}% - {} {}%\n".format(monster.get_monster_name(), monster.get_hp_percent(), monster2.get_monster_name(), monster2.get_hp_percent()) | 1306 | out_str += "\n{} {}% - {} {}%\n".format(monster.get_monster_name(), monster.get_hp_percent(), monster2.get_monster_name(), monster2.get_hp_percent()) |
1298 | log(out_str) | 1307 | log(out_str) |
1299 | send_message(client, arena_channel, byteify(out_str)) | 1308 | send_message(client, arena_channel, byteify(out_str)) | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment