Skip to content

Commit

Permalink
added plural methods and exclusive functions
Browse files Browse the repository at this point in the history
  • Loading branch information
KiloOscarSix committed Jul 5, 2023
1 parent e1d801a commit c227294
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions CharacterService_ren.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from typing import Iterable, Optional, TYPE_CHECKING
from game.characters.ICharacter_ren import ICharacter

from renpy import store
Expand Down Expand Up @@ -123,6 +123,19 @@ def get_profile_pictures(character_name: str) -> list[str]:
if file.startswith("characters/images/chloe")
]

@staticmethod
def is_exclusive_girlfriend(
character: ICharacter, target: Optional[ICharacter] = None
) -> bool:
if target is None:
target = mc

return any(
CharacterService.is_girlfriend(npc)
for npc in target.relationships
if npc != character
)

@staticmethod
def is_girlfriend(
character: ICharacter, target: Optional[ICharacter] = None
Expand All @@ -136,7 +149,7 @@ def is_girlfriend(

@staticmethod
def is_girlfriends(
characters: list[ICharacter], target: Optional[ICharacter] = None
characters: Iterable[ICharacter], target: Optional[ICharacter] = None
) -> bool:
if target is None:
target = mc
Expand All @@ -146,13 +159,35 @@ def is_girlfriends(
for character in characters
)

@staticmethod
def is_exclusive(
character: ICharacter, target: Optional[ICharacter] = None
) -> bool:
if target is None:
target = mc

return any(
CharacterService.is_girlfriend(npc) or CharacterService.is_fwb(npc)
for npc in target.relationships
if npc != character
)

@staticmethod
def is_fwb(character: ICharacter, target: Optional[ICharacter] = None) -> bool:
if target is None:
target = mc

return CharacterService.has_relationship(character, Relationship.FWB, target)

@staticmethod
def is_fwbs(characters: Iterable[ICharacter], target: Optional[ICharacter] = None):
if target is None:
target = mc

return all(
CharacterService.is_fwb(character, target) for character in characters
)

@staticmethod
def is_dating(character: ICharacter, target: Optional[ICharacter] = None) -> bool:
if target is None:
Expand All @@ -176,7 +211,7 @@ def is_friend(character: ICharacter, target: Optional[ICharacter] = None) -> boo

@staticmethod
def is_friends(
characters: list[ICharacter], target: Optional[ICharacter] = None
characters: Iterable[ICharacter], target: Optional[ICharacter] = None
) -> bool:
if target is None:
target = mc
Expand All @@ -192,6 +227,15 @@ def is_ex(character: ICharacter, target: Optional[ICharacter] = None) -> bool:

return CharacterService.has_relationship(character, Relationship.EX, target)

@staticmethod
def is_exs(characters: Iterable[ICharacter], target: Optional[ICharacter] = None):
if target is None:
target = mc

return all(
CharacterService.is_ex(character, target) for character in characters
)

@staticmethod
def is_mad(character: ICharacter) -> bool:
return CharacterService.has_mood(character, Moods.MAD)
Expand Down

0 comments on commit c227294

Please sign in to comment.