-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
113 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rules: [] | ||
labels: [] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
rules: | ||
- group: rpg.health | ||
match: | ||
type: character | ||
rule: | | ||
"health" in attributes and attributes&.health <= 0 | ||
set: | ||
active: false | ||
dead: true | ||
|
||
- group: rpg.health | ||
match: | ||
type: character | ||
rule: | | ||
"bleeding" in attributes and attributes&.bleeding > 0 | ||
chance: 0.5 | ||
trigger: [taleweave.systems.rpg.health.triggers:character_bleeding] | ||
|
||
labels: | ||
- match: | ||
type: character | ||
dead: true | ||
backstory: You are dead. | ||
description: They are dead. | ||
- match: | ||
type: character | ||
bleeding: true | ||
backstory: You are bleeding. | ||
description: They are bleeding. | ||
- match: | ||
type: room | ||
bloody: true | ||
description: The room is covered in blood. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from logging import getLogger | ||
from random import randint | ||
|
||
from taleweave.context import get_current_world | ||
from taleweave.models.entity import Character, WorldEntity | ||
from taleweave.utils.attribute import subtract_attribute | ||
from taleweave.utils.search import find_containing_room | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
def character_bleeding(entity: WorldEntity) -> None: | ||
world = get_current_world() | ||
if not world: | ||
raise ValueError("no world found") | ||
|
||
if not isinstance(entity, Character): | ||
raise ValueError("bleeding entity must be a character") | ||
|
||
# remove bleeding from health, then reduce bleeding | ||
amount = int(entity.attributes.get("bleeding", 0)) | ||
subtract_attribute(entity.attributes, "health", amount) | ||
|
||
if amount > 0 and randint(0, 1): | ||
subtract_attribute(entity.attributes, "bleeding", 1) | ||
|
||
# leave blood in the room | ||
room = find_containing_room(world, entity) | ||
if room: | ||
room.attributes["bloody"] = True | ||
logger.info(f"{entity.name} bleeds in {room.name}") | ||
else: | ||
logger.warning(f"{entity.name} not found in any room") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.