Skip to content

Commit

Permalink
resync
Browse files Browse the repository at this point in the history
  • Loading branch information
asahala authored Nov 24, 2021
1 parent 7937a6b commit 8045539
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
10 changes: 7 additions & 3 deletions abilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def __init__(self, damage, damage_type, duration=None, **kwargs):
def use(self, source, target, total_damage=0, crit_multipiler=1):

messages.IO.reset()
messages.IO.log += "{source} on-hit effect on {target}.".format(source=source.name, target=target.name)

messages.IO.log += f"{source.name} on-hit effect on {target.name}."
save_success = R.roll_save(target, self.save, self.dc)

if self.damage is not None:
Expand Down Expand Up @@ -183,6 +183,10 @@ class Stomach:

""" Stomach for creatures that can swallow other creatures """

## handle swallowing creatures that have swallowed other creatures
## regurgitation also spawns creatures to the same coordinates with
## the swallower!

def __init__(self, name, damage, damage_type, breakout_dmg, breakout_dc):
self.name = name
self.contents = []
Expand Down Expand Up @@ -218,7 +222,7 @@ def check_status(self, source):


""" ================================================================ """
""" ======================= PASSIvE ABILITIES ====================== """
""" ======================= PASSIVE ABILITIES ====================== """
""" ================================================================ """

class FrightfulPresence(Ability):
Expand Down
4 changes: 2 additions & 2 deletions creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,14 +784,14 @@ def get_teams(self, other, creature):
return other, self

def combine_and_sort_by(self, other, value="name", strongest_first=True):
""" Reorder creatures in two parties by given creature variable """
""" Reorder creatures in two parties by a given creature variable """
all_creatures = self.members + other.members
return sorted(all_creatures,
key=operator.attrgetter(value),
reverse=strongest_first)

def sort_by(self, value="name", strongest_first=True):
""" Reorder party by given creature variable """
""" Reorder party by a given creature variable """
self.members.sort(key=operator.attrgetter(value),
reverse=strongest_first)

Expand Down
27 changes: 25 additions & 2 deletions definitions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
import behavior
from abilities import *
from creature import BaseCreature
Expand Down Expand Up @@ -67,6 +68,9 @@
""" ================================================================ """
""" ========================== WEAPONS ============================= """
""" ================================================================ """
""" Note that you should use copy.deepcopy(weapon) for ranged weapons
to prevent them using same ammo pool!
"""

greatclub = Weapon(name='greatclub', damage=["3d8+6"],
damage_type=[bludgeoning], reach=15, to_hit=9)
Expand Down Expand Up @@ -323,6 +327,25 @@ class Creatures:
to_hit=5,
uses_per_turn=1)]})

bugbear = BaseCreature(name='bugbear', cr=1, ac=16, hp=27, speed=30,
size=medium,
category=humanoid,
ai=behavior.Standard,
# Surprise attack undefined
# Brute hardcoded into weapon
scores={'str': 15, 'dex': 14, 'con': 13,
'int': 8, 'wis': 11, 'cha': 9},
melee_attacks={'basic': [
Weapon(name='morningstar', damage=["2d8+2"],
damage_type=[piercing], reach=5,
to_hit=4)]},
ranged_attacks={'basic': [
Weapon(name='javelin', damage=["1d6+2"],
damage_type=[piercing], reach=30,
ranged=True,
ammo=5,
to_hit=4)]})

crocodile = BaseCreature(name='crocodile', cr=0.5, ac=12, hp=19, speed=20,
size=large,
category=beast,
Expand Down Expand Up @@ -394,7 +417,7 @@ class Creatures:
Weapon(name='scimitar', damage=["1d6+2"],
damage_type=[slashing], reach=5,
to_hit=4)]},
ranged_attacks={'basic': [shortbow]})
ranged_attacks={'basic': [copy.deepcopy(shortbow)]})

kobold = BaseCreature(name='kobold', cr=0.125, ac=12, hp=5, speed=30,
size=small,
Expand Down Expand Up @@ -595,7 +618,7 @@ class Creatures:
damage_type=[slashing],
reach=5,
to_hit=4)]},
ranged_attacks={'basic': [shortbow]})
ranged_attacks={'basic': [copy.deepcopy(shortbow)]})

stone_giant = BaseCreature(name='stone giant', cr=7, ac=17, hp=126, speed=40,
size=large,
Expand Down
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from definitions import Creatures as npc
from definitions import PlayerCharacters as pc

__version__ = "2021-11-23"
__version__ = "2021-11-24"

DIV = '='*64

Expand Down Expand Up @@ -225,6 +225,6 @@ def tabulate(header, data, creatures, team):
if __name__ == "__main__":
#list_creatures()
simulate(matches=100,
verbose=1,
team_a=[pc.ogno],
team_b=[npc.kobold, npc.goblin, npc.skeleton])
verbose=0,
team_a=[npc.troll]*2,
team_b=[pc.ogno])

0 comments on commit 8045539

Please sign in to comment.