Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Barry
/
discordbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9ca4643d
authored
2016-02-14 11:19:26 +0000
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added a couple commands and fixed some pankration issues.
1 parent
6b1b3f46
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
78 deletions
db.sqlite3
hellsbot.py
pankration.py
db.sqlite3
View file @
9ca4643
No preview for this file type
hellsbot.py
View file @
9ca4643
...
...
@@ -27,6 +27,7 @@ import wolframalpha
import
sqlite3
from
blackjack
import
Blackjack
import
data
from
pankration
import
Pankration
,
HuntResponse
,
Jobs
VERSION
=
2.3
...
...
@@ -82,6 +83,8 @@ registered_commands = {'!help': 'do_help', '!commands': 'do_help',
'!squid'
:
'do_squid'
,
'!stars'
:
'do_stars'
,
'!rigged'
:
'do_rigged'
,
'!listzones'
:
'do_list_zones'
,
'!huntmonster'
:
'do_hunt_monster'
,
}
...
...
@@ -1008,6 +1011,22 @@ def do_rigged(client, message_parts, message):
send_message
(
client
,
message
.
channel
,
":musical_note: {} :musical_note:"
.
format
(
random
.
choice
(
lines
)))
return
def
do_hunt_monster
(
client
,
message_parts
,
message
):
p
=
Pankration
()
hunt_response
=
p
.
hunt_monster
(
' '
.
join
(
message_parts
))
str_out
=
hunt_response
.
message
if
hunt_response
.
result
==
HuntResponse
.
SUCCESS
:
monster
=
hunt_response
.
monster
str_out
+=
"
\n\n
**Stats:**
\n
Family: {}
\n
Level: {}
\n
Main Job: {}
\n
Support Job: {}"
.
format
(
monster
.
family_name
,
monster
.
level
,
Jobs
()
.
get_job_name
(
monster
.
main_job
),
Jobs
()
.
get_job_name
(
monster
.
support_job
))
send_message
(
client
,
message
.
channel
,
str_out
)
return
def
do_list_zones
(
client
,
message_parts
,
message
):
p
=
Pankration
()
send_message
(
client
,
message
.
channel
,
', '
.
join
(
p
.
list_zones
()))
return
def
start_timer
(
client
):
needs_loot
=
True
while
not
quitting
:
...
...
pankration.py
View file @
9ca4643
...
...
@@ -52,28 +52,32 @@ exp_table = {
-
15
:
40
,
}
class
Jobs
:
WAR
=
1
MNK
=
2
B
LM
=
3
WHM
=
4
THF
=
5
RDM
=
6
PLD
=
7
BLM
=
1
BLU
=
2
B
RD
=
3
BST
=
4
COR
=
5
DNC
=
6
DRG
=
7
DRK
=
8
BST
=
9
BRD
=
10
RNG
=
11
SAM
=
12
NIN
=
13
DRG
=
14
SMN
=
15
BLU
=
16
COR
=
17
PUP
=
18
DNC
=
19
SCH
=
20
GEO
=
21
RUN
=
22
GEO
=
9
MNK
=
10
NIN
=
11
PLD
=
12
PUP
=
13
RDM
=
14
RNG
=
15
RUN
=
16
SAM
=
17
SCH
=
18
SMN
=
19
THF
=
20
WAR
=
21
WHM
=
22
def
get_job_name
(
self
,
job
):
members
=
[
attr
for
attr
in
dir
(
Jobs
())
if
not
callable
(
attr
)
and
not
attr
.
startswith
(
"__"
)
and
not
attr
.
startswith
(
"get_job_name"
)]
return
members
[
job
-
1
]
TemperamentPosture
=
{
4
:
{
"name"
:
"Very Agressive"
,
"message"
:
"Show no mercy!"
,
"value"
:
4
},
...
...
@@ -232,10 +236,12 @@ class Pankration:
weapon_base_damage
=
monster_data
[
'weapon_base_damage'
]
print
(
"Monster: {} Data: {}"
.
format
(
monster_name
,
monster_data
))
family_name
=
monster_data
[
'family'
]
level
=
monster_data
[
'initial_level'
]
family
=
Families
[
family_name
]
level
=
monster_data
[
'initial_level'
]
main_job
=
random
.
choice
(
family
[
'available_main_job'
])
support_job
=
random
.
choice
(
family
[
'available_support_job'
])
while
support_job
==
main_job
:
support_job
=
random
.
choice
(
family
[
'available_support_job'
])
feral_skills
=
[]
skills
=
random
.
sample
(
family
[
'innate_feral_skills'
],
3
)
if
random
.
randint
(
1
,
100
)
<
SKILL_PERCENT
:
...
...
@@ -246,9 +252,9 @@ class Pankration:
feral_skills
.
append
(
skills
[
2
])
dicipline_level
=
1
monster
=
Monster
(
monster_name
,
family
,
hp
,
level
,
weapon_base_damage
,
main_job
,
support_job
,
feral_skills
,
monster
=
Monster
(
monster_name
,
family
_name
,
family
,
hp
,
level
,
weapon_base_damage
,
main_job
,
support_job
,
feral_skills
,
[],
dicipline_level
)
return
HuntResponse
(
HuntResponse
.
SUCCESS
,
"You captured
the monster!"
,
return
HuntResponse
(
HuntResponse
.
SUCCESS
,
"You captured
a *{}*!"
.
format
(
monster_name
)
,
monster
)
else
:
return
HuntResponse
(
HuntResponse
.
FAILURE
,
"You were unable to capture a monster's soul."
,
...
...
@@ -259,9 +265,10 @@ class Pankration:
class
Monster
:
def
__init__
(
self
,
monster_type
,
family
,
hp
,
level
,
weapon_base_damage
,
main_job
,
support_job
,
innate_feral_skills
,
def
__init__
(
self
,
monster_type
,
family
_name
,
family
,
hp
,
level
,
weapon_base_damage
,
main_job
,
support_job
,
innate_feral_skills
,
equipped_feral_skills
,
dicipline_level
):
self
.
monster_type
=
monster_type
self
.
family_name
=
family_name
self
.
family
=
family
self
.
max_hp
=
hp
self
.
hp
=
hp
...
...
@@ -483,59 +490,60 @@ class Arena:
return
actions
#print Families
p
=
Pankration
()
print
(
"Zones:
\n\n
{}"
.
format
(
'
\n
'
.
join
(
p
.
list_zones
())))
hunt_zone
=
p
.
list_zones
()[
0
]
print
(
"Hunting for monster in zone: {}
\n
"
.
format
(
hunt_zone
))
hunt_response
=
p
.
hunt_monster
(
hunt_zone
)
print
(
"hunt_response"
)
print
(
str
(
hunt_response
.
result
))
time
.
sleep
(
0.5
)
if
hunt_response
.
result
==
HuntResponse
.
SUCCESS
:
print
(
hunt_response
.
message
)
monster
=
hunt_response
.
monster
# print("The Soul Plate Shows: \n\n{}".format(monster))
# print(monster.set_strategy(4, 3))
# print(monster.set_strategy(1, 1))
# print(monster.set_strategy(1, 2))
#monster.add_xp(22900)
# phy_damage = monster.get_physical_base_damage(100, 'melee', -15)
# print("Phys Attack: {}".format(phy_damage))
# print(monster.get_base_defense())
# monster.add_xp(22900)
# print(monster.get_base_defense())
# monster.add_xp(222900)
# print(monster.get_base_defense())
else
:
print
(
hunt_response
.
message
)
hunt_zone
=
p
.
list_zones
()[
1
]
hunt_response
=
p
.
hunt_monster
(
hunt_zone
)
if
hunt_response
.
result
==
HuntResponse
.
SUCCESS
:
monster2
=
hunt_response
.
monster
monster2
.
add_xp
(
16900
)
phy_damage
=
monster2
.
attack
(
monster
)
print
(
"Phys Attack: {}"
.
format
(
phy_damage
))
battle_arena
=
p
.
start_battle
(
monster
,
monster2
,
"derp"
)
fighting
=
True
while
fighting
:
actions
=
battle_arena
.
step
()
time
.
sleep
(
2
)
for
action
in
actions
:
if
isinstance
(
action
,
AttackAction
):
print
(
"{} {} {} for {}."
.
format
(
action
.
attacker
.
monster_type
,
action
.
message
,
action
.
target
.
monster_type
,
action
.
damage
))
if
isinstance
(
action
,
DefeatAction
):
print
(
"{} {}. {} gains {} xp."
.
format
(
action
.
target
.
monster_type
,
action
.
message
,
action
.
attacker
.
monster_type
,
action
.
xp
))
fighting
=
False
break
print
(
"
\n
{} {}
% -
{} {}
%
\n
"
.
format
(
monster
.
monster_type
,
monster
.
get_hp_percent
(),
monster2
.
monster_type
,
monster2
.
get_hp_percent
()))
if
__name__
==
"__main__"
:
#print Families
p
=
Pankration
()
print
(
"Zones:
\n\n
{}"
.
format
(
'
\n
'
.
join
(
p
.
list_zones
())))
hunt_zone
=
p
.
list_zones
()[
0
]
print
(
"Hunting for monster in zone: {}
\n
"
.
format
(
hunt_zone
))
hunt_response
=
p
.
hunt_monster
(
hunt_zone
)
print
(
"hunt_response"
)
print
(
str
(
hunt_response
.
result
))
time
.
sleep
(
0.5
)
if
hunt_response
.
result
==
HuntResponse
.
SUCCESS
:
print
(
hunt_response
.
message
)
monster
=
hunt_response
.
monster
# print("The Soul Plate Shows: \n\n{}".format(monster))
# print(monster.set_strategy(4, 3))
# print(monster.set_strategy(1, 1))
# print(monster.set_strategy(1, 2))
#monster.add_xp(22900)
# phy_damage = monster.get_physical_base_damage(100, 'melee', -15)
# print("Phys Attack: {}".format(phy_damage))
# print(monster.get_base_defense())
# monster.add_xp(22900)
# print(monster.get_base_defense())
# monster.add_xp(222900)
# print(monster.get_base_defense())
else
:
print
(
hunt_response
.
message
)
hunt_zone
=
p
.
list_zones
()[
1
]
hunt_response
=
p
.
hunt_monster
(
hunt_zone
)
if
hunt_response
.
result
==
HuntResponse
.
SUCCESS
:
monster2
=
hunt_response
.
monster
monster2
.
add_xp
(
16900
)
phy_damage
=
monster2
.
attack
(
monster
)
print
(
"Phys Attack: {}"
.
format
(
phy_damage
))
battle_arena
=
p
.
start_battle
(
monster
,
monster2
,
"derp"
)
fighting
=
True
while
fighting
:
actions
=
battle_arena
.
step
()
time
.
sleep
(
2
)
for
action
in
actions
:
if
isinstance
(
action
,
AttackAction
):
print
(
"{} {} {} for {}."
.
format
(
action
.
attacker
.
monster_type
,
action
.
message
,
action
.
target
.
monster_type
,
action
.
damage
))
if
isinstance
(
action
,
DefeatAction
):
print
(
"{} {}. {} gains {} xp."
.
format
(
action
.
target
.
monster_type
,
action
.
message
,
action
.
attacker
.
monster_type
,
action
.
xp
))
fighting
=
False
break
print
(
"
\n
{} {}
% -
{} {}
%
\n
"
.
format
(
monster
.
monster_type
,
monster
.
get_hp_percent
(),
monster2
.
monster_type
,
monster2
.
get_hp_percent
()))
...
...
Please
register
or
sign in
to post a comment