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
91bd9972
authored
2016-02-15 12:09:05 +0000
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fix for msg to handle days
Updates to pankration adding acc, dex
1 parent
9ca4643d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
30 deletions
db.sqlite3
hellsbot.py
pankration.py
db.sqlite3
View file @
91bd997
No preview for this file type
hellsbot.py
View file @
91bd997
...
...
@@ -839,6 +839,9 @@ def do_msg(client, message_parts, message):
elif
message_bits
[
4
]
.
startswith
(
'hour'
):
msg_datetime
=
msg_datetime
+
datetime
.
timedelta
(
hours
=
time
)
msg_idx
=
5
elif
message_bits
[
4
]
.
startswith
(
'day'
):
msg_datetime
=
msg_datetime
+
datetime
.
timedelta
(
days
=
time
)
msg_idx
=
5
else
:
# minutes by default
msg_datetime
=
msg_datetime
+
datetime
.
timedelta
(
minutes
=
time
)
msg_idx
=
5
...
...
@@ -1014,10 +1017,10 @@ def do_rigged(client, message_parts, message):
def
do_hunt_monster
(
client
,
message_parts
,
message
):
p
=
Pankration
()
hunt_response
=
p
.
hunt_monster
(
' '
.
join
(
message_parts
))
str_out
=
hunt_response
.
message
str_out
=
hunt_response
.
message
+
"
\n\n
"
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
)
)
str_out
+=
str
(
monster
)
send_message
(
client
,
message
.
channel
,
str_out
)
return
...
...
pankration.py
View file @
91bd997
...
...
@@ -49,7 +49,7 @@ exp_table = {
-
12
:
40
,
-
13
:
40
,
-
14
:
40
,
-
15
:
4
0
,
-
15
:
2
0
,
}
class
Jobs
:
BLM
=
1
...
...
@@ -114,7 +114,7 @@ Families = {
'acrolith'
:
{
'base_fp'
:
50
,
'fp_per_level'
:
0.1
,
'max_fp'
:
55
,
'max_fp'
:
55
,
'available_main_job'
:
[
Jobs
.
WAR
,
Jobs
.
DRG
,
Jobs
.
DRK
,
Jobs
.
PLD
],
'available_support_job'
:
[
Jobs
.
WAR
,
Jobs
.
DRG
,
Jobs
.
DRK
,
Jobs
.
PLD
],
'innate_feral_skills'
:
[
'Sinker Drill'
,
'Dire Straight'
,
'Dismemberment'
,
'Earthshatter'
],
...
...
@@ -129,6 +129,8 @@ Families = {
'str_per_level'
:
0.8934
,
'base_agi'
:
7
,
'agi_per_level'
:
0.76
,
'base_dex'
:
10
,
'dex_per_level'
:
0.76
,
'temperament_attitude'
:
{
'initial_value'
:
4
,
'actions'
:
{
...
...
@@ -166,6 +168,8 @@ Families = {
'str_per_level'
:
0.8534
,
'base_agi'
:
9
,
'agi_per_level'
:
0.88
,
'base_dex'
:
10
,
'dex_per_level'
:
0.714
,
'temperament_attitude'
:
{
'initial_value'
:
4
,
'actions'
:
{
...
...
@@ -192,15 +196,15 @@ Monsters = {
'initial_level'
:
9
,
'family'
:
'acrolith'
,
'zone'
:
'Abyssea - Uleguerand'
,
'hp'
:
100
0
,
'weapon_base_damage'
:
40
'hp'
:
2
0
,
'weapon_base_damage'
:
14
},
'Floating Eye'
:
{
'initial_level'
:
3
,
'initial_level'
:
10
,
'family'
:
'ahriman'
,
'zone'
:
'Ranguemont Pass'
,
'hp'
:
1
000
,
'weapon_base_damage'
:
1
20
'hp'
:
1
5
,
'weapon_base_damage'
:
1
5
}
}
...
...
@@ -265,13 +269,12 @@ class Pankration:
class
Monster
:
def
__init__
(
self
,
monster_type
,
family_name
,
family
,
hp
,
level
,
weapon_base_damage
,
main_job
,
support_job
,
innate_feral_skills
,
def
__init__
(
self
,
monster_type
,
family_name
,
family
,
base_
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
self
.
base_hp
=
base_hp
self
.
level
=
level
self
.
main_job
=
main_job
self
.
support_job
=
support_job
...
...
@@ -291,12 +294,20 @@ class Monster:
self
.
str_per_level
=
family
[
'str_per_level'
]
self
.
base_agi
=
family
[
'base_agi'
]
self
.
agi_per_level
=
family
[
'agi_per_level'
]
self
.
base_dex
=
family
[
'base_dex'
]
self
.
dex_per_level
=
family
[
'dex_per_level'
]
self
.
hp
=
self
.
get_hp
()
def
__str__
(
self
):
return
"Family: {}
\n
Level: {}
\n
Main Job: {}
\n
Support Job: {}
\n
Innate Feral Skills: {}
\n
Equipped Feral Skills: {}
\n
Dicipline Level: {}
\n
Temperament..."
.
format
(
self
.
family
,
self
.
level
,
self
.
main_job
,
self
.
support_job
,
self
.
innate_feral_skills
,
self
.
equipped_feral_skills
,
self
.
discipline_level
)
return
"**Stats:**
\n
Family: {}
\n
Level: {}
\n
Main Job: {}
\n
Support Job: {}
\n
Innate Feral Skills: {}
\n
Equipped Feral Skills: {}
\n
Feral Points: {}"
.
format
(
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
())
#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)
def
get_hp
(
self
):
#this is a bit dumb but it's close enough.
return
int
((
self
.
level
*
20
)
+
self
.
base_hp
)
def
get_fp
(
self
):
return
int
(
self
.
level
/
self
.
family
[
'fp_per_level'
])
return
int
(
self
.
level
/
self
.
family
[
'fp_per_level'
]
+
self
.
family
[
'base_fp'
]
)
def
add_xp
(
self
,
exp_to_add
):
self
.
exp
+=
exp_to_add
...
...
@@ -306,13 +317,8 @@ class Monster:
# We leveled up!
self
.
level
=
i
#print("Start level: {} New Level: {}".format(self.level, i))
else
:
pass
#print("Just another brick in the wall...")
else
:
break
# calc level based on xp
# stop at 50
pass
def
get_current_posture
(
self
):
return
TemperamentPosture
(
self
.
temperament_posture
)
...
...
@@ -330,6 +336,12 @@ class Monster:
else
:
return
"Obedient"
def
get_dexterity
(
self
):
return
int
(
round
(
max
(
self
.
base_dex
,
self
.
level
*
self
.
dex_per_level
)))
def
get_accuracy
(
self
):
return
int
(
math
.
floor
(
3
*
self
.
get_dexterity
()
/
4
)
+
100
)
def
get_vitality
(
self
):
return
int
(
round
(
max
(
self
.
base_vit
,
self
.
level
*
self
.
vit_per_level
)))
...
...
@@ -343,17 +355,18 @@ class Monster:
return
(
math
.
floor
(
self
.
get_vitality
()
/
2
)
+
8
+
self
.
level
)
def
get_hp_percent
(
self
):
return
max
(
0
,
int
(
round
((
self
.
hp
/
self
.
max_hp
)
*
100
)))
print
(
self
.
hp
)
return
max
(
0
,
int
(
round
((
self
.
hp
/
self
.
get_hp
())
*
100
)))
# Calculate the base damage against the provided defense
# attack_type can be 'ranged' or 'melee'
def
get_physical_base_damage
(
self
,
defense
,
attack_type
,
level_difference
):
def
get_physical_base_damage
(
self
,
defense
,
attack_type
,
level_difference
,
enemy_vit
):
#print("Defense: {} Type: {} Level diff: {}".format(defense, attack_type, level_difference))
# Calculate the attack/defense ratio
bd
=
float
(
self
.
weapon_base_damage
)
if
attack_type
==
'ranged'
:
bd
+=
self
.
ammo_damage
# NOTE: We are not using fStr1 or fStr2 since we are not keeping str / vit as data
if
defense
==
0
:
ratio
=
99
else
:
...
...
@@ -398,11 +411,14 @@ class Monster:
# Some fuckery since python doesn't let you do a rand between decimals
pDif_rand
=
float
(
random
.
randint
(
int
(
pDif_min
*
100000
),
int
(
pDif_max
*
100000
)))
/
100000.0
final_damage
=
bd
*
(
pDif_rand
*
cRatio
)
fstr
=
((
self
.
get_strength
()
-
enemy_vit
)
+
4
)
/
4
print
(
"Str: {} Vit: {} fstr: {}"
.
format
(
self
.
get_strength
(),
enemy_vit
,
fstr
))
bd
=
bd
+
fstr
final_damage
=
(
bd
*
(
pDif_rand
*
cRatio
))
return
final_damage
def
attack
(
self
,
monster
):
phy_damage
=
self
.
get_physical_base_damage
(
monster
.
get_base_defense
(),
'melee'
,
monster
.
level
-
self
.
level
)
phy_damage
=
self
.
get_physical_base_damage
(
monster
.
get_base_defense
(),
'melee'
,
monster
.
level
-
self
.
level
,
monster
.
get_vitality
()
)
return
(
phy_damage
,
'hits'
)
...
...
@@ -477,15 +493,21 @@ class Arena:
secondary
.
apply_damage
(
result1
[
0
])
actions
.
append
(
AttackAction
(
primary
,
secondary
,
result1
[
0
],
result1
[
1
]))
if
secondary
.
hp
<=
0
:
xp
=
200
+
(
20
*
(
primary
.
level
-
secondary
.
level
))
actions
.
append
(
DefeatAction
(
secondary
,
primary
,
'was defeated'
,
xp
))
level_difference
=
secondary
.
level
-
primary
.
level
if
level_difference
in
exp_table
:
xp
=
exp_table
[
level_difference
]
elif
level_difference
>
15
:
xp
=
exp_table
[
15
]
else
:
xp
=
0
actions
.
append
(
DefeatAction
(
primary
,
secondary
,
'was defeated'
,
xp
))
return
actions
result2
=
secondary
.
attack
(
primary
)
primary
.
apply_damage
(
result2
[
0
])
actions
.
append
(
AttackAction
(
secondary
,
primary
,
result2
[
0
],
result2
[
1
]))
if
primary
.
hp
<=
0
:
xp
=
200
+
(
20
*
(
secondary
.
level
-
prim
ary
.
level
))
actions
.
append
(
DefeatAction
(
primary
,
second
ary
,
'was defeated'
,
xp
))
xp
=
200
+
(
20
*
(
primary
.
level
-
second
ary
.
level
))
actions
.
append
(
DefeatAction
(
secondary
,
prim
ary
,
'was defeated'
,
xp
))
return
actions
return
actions
...
...
@@ -524,12 +546,13 @@ if __name__ == "__main__":
hunt_response
=
p
.
hunt_monster
(
hunt_zone
)
if
hunt_response
.
result
==
HuntResponse
.
SUCCESS
:
monster2
=
hunt_response
.
monster
monster2
.
add_xp
(
16900
)
#
monster2.add_xp(16900)
phy_damage
=
monster2
.
attack
(
monster
)
print
(
"Phys Attack: {}"
.
format
(
phy_damage
))
print
(
"Acc: {}"
.
format
(
monster
.
get_accuracy
()))
print
(
"Acc: {}"
.
format
(
monster2
.
get_accuracy
()))
battle_arena
=
p
.
start_battle
(
monster
,
monster2
,
"derp"
)
fighting
=
True
...
...
Please
register
or
sign in
to post a comment