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
ee933491
authored
2016-02-03 17:22:54 +0000
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added pankration changes for base damage calculation
1 parent
81ddab81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
2 deletions
db.sqlite3
pankration.py
db.sqlite3
View file @
ee93349
No preview for this file type
pankration.py
View file @
ee93349
...
...
@@ -156,7 +156,9 @@ class Pankration:
pass
def
start_battle
(
self
,
monster1
,
monster2
,
battle_type
):
pass
battle
=
Battle
(
monster1
,
monster2
,
battle_type
)
battle
.
start
()
return
battle
def
list_zones
(
self
):
zone_list
=
[]
...
...
@@ -202,6 +204,7 @@ class Pankration:
def
get_action
():
return
""
class
Monster
:
def
__init__
(
self
,
family
,
level
,
main_job
,
support_job
,
innate_feral_skills
,
equipped_feral_skills
,
dicipline_level
):
...
...
@@ -216,6 +219,9 @@ class Monster:
self
.
temperament_attitude
=
family
[
'temperament_attitude'
][
'initial_value'
]
self
.
pre_fight_command
=
{
"temperament_posture"
:
None
,
"temperament_attitude"
:
None
}
self
.
exp
=
exp_to_level
[
level
]
+
1
# TODO: Setup something more interesting for each monster.
self
.
weapon_base_damage
=
100
self
.
ammo_damage
=
0
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
)
...
...
@@ -254,6 +260,58 @@ class Monster:
else
:
return
"Obedient"
# 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
):
# 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
:
ratio
=
bd
/
float
(
defense
)
if
attack_type
==
'ranged'
:
cap
=
3.0
else
:
cap
=
2.25
if
ratio
>
cap
:
ratio
=
cap
# Get the level correction ratio
if
attack_type
==
'ranged'
:
cRatio
=
ratio
-
0.025
*
level_difference
else
:
cRatio
=
ratio
-
0.050
*
level_difference
if
cRatio
<
0
:
cRatio
=
0
if
cRatio
>
3.0
:
cRatio
=
3.0
# Calculate the pDif max as the max of our RNG
if
cRatio
<=
0.5
:
pDif_max
=
1
+
(
10
/
9
)
*
(
cRatio
-
0.5
)
elif
0.5
<=
cRatio
<=
float
(
3
/
4
):
pDif_max
=
1
elif
float
(
3
/
4
)
<=
cRatio
<=
cap
:
pDif_max
=
1
+
(
10
/
9
)
*
(
cRatio
-
float
(
3
/
4
))
# Calculate the pDif max as the max of our RNG
if
cRatio
<=
0.5
:
pDif_min
=
1
/
6
elif
0.5
<=
cRatio
<=
1.25
:
pDif_min
=
1
+
(
10
/
9
)
*
(
cRatio
-
1.25
)
elif
1.25
<=
cRatio
<=
1.5
:
pDif_min
=
1
elif
1.5
<=
cRatio
<=
cap
:
pDif_min
=
1
+
(
10
/
9
)
*
(
cRatio
-
1.5
)
print
(
pDif_min
)
# 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
)
return
final_damage
# This should ONLY be executed at the start of battle.
def
set_strategy
(
self
,
temperament_posture
,
temperament_attitude
):
distance_from_nature
=
abs
(
self
.
temperament_posture
-
temperament_posture
)
...
...
@@ -275,8 +333,16 @@ class Monster:
#if severe request then reduce dicipline_level
pass
class
Battle
:
pass
def
__init__
(
self
,
monster1
,
monster2
,
battle_type
):
self
.
monster1
=
monster1
self
.
monster2
=
monster2
self
.
battle_type
=
battle_type
def
perform_attack
():
base_damage
=
get_physical_base_damage
(
monster2
.
defense
,
'melee'
,
0
)
class
Arena
:
pass
...
...
@@ -299,6 +365,8 @@ if hunt_response.result == HuntResponse.SUCCESS:
print
(
monster
.
set_strategy
(
1
,
1
))
print
(
monster
.
set_strategy
(
1
,
2
))
monster
.
add_xp
(
2900
)
phy_damage
=
monster
.
get_physical_base_damage
(
100
,
'melee'
,
-
15
)
print
(
"Phys Attack: {}"
.
format
(
phy_damage
))
else
:
print
(
hunt_response
.
message
)
...
...
Please
register
or
sign in
to post a comment