Skip to content

Commit

Permalink
updated imports and typing
Browse files Browse the repository at this point in the history
  • Loading branch information
KiloOscarSix committed May 6, 2023
1 parent a8acfd2 commit 97c62b4
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 31 deletions.
21 changes: 10 additions & 11 deletions CharacterService_ren.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from __future__ import annotations
from typing import Optional, TYPE_CHECKING

from renpy import store
import renpy.exports as renpy

from game.characters.Relationship_ren import Relationship
from game.characters.Moods_ren import Moods

if TYPE_CHECKING:
from game.characters.NonPlayableCharacter_ren import NonPlayableCharacter
from game.characters.PlayableCharacters_ren import PlayableCharacter
from game.characters.PlayableCharacters_ren import PlayableCharacter, mc

"""renpy
init python:
Expand All @@ -22,7 +21,7 @@ def get_relationship(
character: NonPlayableCharacter, target: Optional[PlayableCharacter] = None
) -> Relationship:
if target is None:
target = store.mc
target = mc

if not hasattr(character, "relationships"):
character.relationships = {}
Expand All @@ -36,7 +35,7 @@ def has_relationship(
target: Optional[PlayableCharacter] = None,
) -> bool:
if target is None:
target = store.mc
target = mc

return CharacterService.get_relationship(character, target) == relationship

Expand All @@ -47,7 +46,7 @@ def set_relationship(
target: Optional[PlayableCharacter] = None,
) -> None:
if target is None:
target = store.mc
target = mc

if not hasattr(character, "relationships"):
character.relationships = {}
Expand Down Expand Up @@ -116,7 +115,7 @@ def is_girlfriend(
character: NonPlayableCharacter, target: Optional[PlayableCharacter] = None
) -> bool:
if target is None:
target = store.mc
target = mc

return CharacterService.has_relationship(
character, Relationship.GIRLFRIEND, target
Expand All @@ -127,7 +126,7 @@ def is_fwb(
character: NonPlayableCharacter, target: Optional[PlayableCharacter] = None
) -> bool:
if target is None:
target = store.mc
target = mc

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

Expand All @@ -136,7 +135,7 @@ def is_dating(
character: NonPlayableCharacter, target: Optional[PlayableCharacter] = None
) -> bool:
if target is None:
target = store.mc
target = mc

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

Expand All @@ -145,7 +144,7 @@ def is_kissed(
character: NonPlayableCharacter, target: Optional[PlayableCharacter] = None
) -> bool:
if target is None:
target = store.mc
target = mc

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

Expand All @@ -154,7 +153,7 @@ def is_friend(
character: NonPlayableCharacter, target: Optional[PlayableCharacter] = None
) -> bool:
if target is None:
target = store.mc
target = mc

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

Expand All @@ -163,7 +162,7 @@ def is_ex(
character: NonPlayableCharacter, target: Optional[PlayableCharacter] = None
) -> bool:
if target is None:
target = store.mc
target = mc

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

Expand Down
49 changes: 49 additions & 0 deletions NonPlayableCharacter_ren.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,52 @@ def __repr__(self) -> str:

def __str__(self) -> str:
return self.name


aaron: NonPlayableCharacter
adam: NonPlayableCharacter
amber: NonPlayableCharacter
aryssa: NonPlayableCharacter
aubrey: NonPlayableCharacter
autumn: NonPlayableCharacter
beth: NonPlayableCharacter
buyer: NonPlayableCharacter
caleb: NonPlayableCharacter
cameron: NonPlayableCharacter
candy: NonPlayableCharacter
charli: NonPlayableCharacter
chloe: NonPlayableCharacter
chris: NonPlayableCharacter
dean: NonPlayableCharacter
elijah: NonPlayableCharacter
emily: NonPlayableCharacter
emmy: NonPlayableCharacter
evelyn: NonPlayableCharacter
grayson: NonPlayableCharacter
imre: NonPlayableCharacter
iris: NonPlayableCharacter
jenny: NonPlayableCharacter
josh: NonPlayableCharacter
julia: NonPlayableCharacter
kai: NonPlayableCharacter
kim: NonPlayableCharacter
kourtney: NonPlayableCharacter
lauren: NonPlayableCharacter
lews_official: NonPlayableCharacter
lindsey: NonPlayableCharacter
mason: NonPlayableCharacter
mr_lee: NonPlayableCharacter
ms_rose: NonPlayableCharacter
naomi: NonPlayableCharacter
nora: NonPlayableCharacter
parker: NonPlayableCharacter
penelope: NonPlayableCharacter
polly: NonPlayableCharacter
riley: NonPlayableCharacter
ryan: NonPlayableCharacter
samantha: NonPlayableCharacter
satin: NonPlayableCharacter
sebastian: NonPlayableCharacter
tom: NonPlayableCharacter
trainer: NonPlayableCharacter
wolf: NonPlayableCharacter
8 changes: 6 additions & 2 deletions PlayableCharacters_ren.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from dataclasses import dataclass, field
from typing import Optional, TYPE_CHECKING

from renpy import store
import renpy.exports as renpy

from game.characters.Frat_ren import Frat
Expand All @@ -12,6 +11,8 @@
if TYPE_CHECKING:
from game.detective.Detective_ren import Detective

name: str

"""renpy
init python:
"""
Expand All @@ -31,7 +32,7 @@ class PlayableCharacter:

def __post_init__(self) -> None:
if not self.name:
self.name = store.name
self.name = name

if not self.username:
self.username = self.name
Expand All @@ -53,3 +54,6 @@ def profile_picture(self) -> str:
# @fighter.setter
# def fighter(self, value: BasePlayer):
# self._fighter = value


mc: PlayableCharacter
50 changes: 32 additions & 18 deletions after_default_ren.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,51 @@
from renpy import config, store
from renpy import config

from game.characters.NonPlayableCharacter_ren import (
chloe,
amber,
riley,
lindsey,
nora,
aubrey,
ryan,
imre,
charli,
josh,
chris,
)

"""renpy
init python:
"""


def npc_setup() -> None:
store.chloe.is_competitive = True
store.chloe.vindictive_characters = (store.nora,)
chloe.is_competitive = True
chloe.vindictive_characters = (nora,)

store.amber.is_competitive = True
store.amber.is_talkative = True
store.amber.vindictive_characters = (store.riley,)
amber.is_competitive = True
amber.is_talkative = True
amber.vindictive_characters = (riley,)

store.riley.is_competitive = True
store.riley.is_talkative = True
riley.is_competitive = True
riley.is_talkative = True

store.lindsey.is_competitive = True
store.lindsey.is_talkative = True
store.lindsey.vindictive_characters = (store.chloe,)
lindsey.is_competitive = True
lindsey.is_talkative = True
lindsey.vindictive_characters = (chloe,)

store.nora.is_talkative = True
store.nora.vindictive_characters = (store.chris, store.chloe)
nora.is_talkative = True
nora.vindictive_characters = (chris, chloe)

store.aubrey.is_competitive = True
aubrey.is_competitive = True

store.ryan.vindictive_characters = (store.imre,)
ryan.vindictive_characters = (imre,)

store.imre.vindictive_characters = (store.ryan,)
imre.vindictive_characters = (ryan,)

store.charli.is_competitive = True
charli.is_competitive = True

store.josh.is_competitive = True
josh.is_competitive = True


config.after_default_callbacks.append(npc_setup)

0 comments on commit 97c62b4

Please sign in to comment.