Skip to content

Commit

Permalink
Merge pull request #9260 from Booplicate/NoU
Browse files Browse the repository at this point in the history
NOU fixes
  • Loading branch information
ThePotatoGuy committed Jun 22, 2022
2 parents 1b71c15 + 844591c commit 277444f
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 19 deletions.
4 changes: 4 additions & 0 deletions Monika After Story/game/definitions.rpy
Expand Up @@ -4,8 +4,12 @@ define config.developer = False
# define persistent.steam = "steamapps" in config.basedir.lower()

python early:
# We want these to be available globally, please don't remove
# Add more as needed
import io
import os
import datetime
import random
import traceback
from collections import defaultdict # this will be availalable anywhere now

Expand Down
13 changes: 9 additions & 4 deletions Monika After Story/game/event-handler.rpy
Expand Up @@ -2772,6 +2772,14 @@ init python:


def seen_event(event_label):
"""
Please use mas_seenEvent, this function hasn't been deprecated
only because it's used a lot in event conditionals
and I don't want to update them all
"""
return mas_seenEvent(event_label)

def mas_seenEvent(event_label):
"""
This checks if an event has either been seen or is already in the
event list.
Expand All @@ -2782,10 +2790,7 @@ init python:
ASSUMES:
persistent.event_list
"""
if renpy.seen_label(event_label) or mas_inEVL(event_label):
return True
else:
return False
return renpy.seen_label(event_label) or mas_inEVL(event_label)


def mas_findEVL(event_label):
Expand Down
Binary file modified Monika After Story/game/mod_assets/games/nou/pen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions Monika After Story/game/script-story-events.rpy
Expand Up @@ -2623,3 +2623,67 @@ label mas_islands_reset:
m 3hua "If you're fine with how they are right now, then I am too.{w=0.2} I'll see what I can do with them as they are~"

return "no_unlock"

init 5 python:
addEvent(
Event(
persistent.event_database,
eventlabel="mas_gift_hint_noudeck",
conditional="store.mas_xp.level() >= 8 and not mas_seenEvent('mas_reaction_gift_noudeck')",
action=EV_ACT_QUEUE,
aff_range=(mas_aff.AFFECTIONATE, None),
show_in_idle=True,
rules={
"skip alert": None,
"keep_idle_exp": None,
"skip_pause": None
}
)
)

label mas_gift_hint_noudeck:
# If you somehow gifted while getting this event, abort this
if mas_seenEvent("mas_reaction_gift_noudeck"):
return
# The idea is next time the player visits the folder, they will find a new note and probably read it
# This is NOT to guarantee anything, but rather "best effort" to give this hint
python hide:
def write_and_hide():
import time

note_path = os.path.join(renpy.config.basedir, renpy.substitute("characters/Hey, I have something for you, [player]!.txt"))
note_text = renpy.substitute("""\
Hi [player]!
I see you're making Monika really happy and I want to help any way I can!
I added a new deck of cards that you can give to Monika. I'm sure you two can figure out how to play the game.
To give it to her, create a new file 'noudeck.gift' in the 'characters' folder.
Keep up being a good [boy] and good luck with Monika!
P.S: Don't tell her about me!\
""")

mas_utils.trywrite(note_path, note_text, log=True)
time.sleep(20)
renpy.hide("chibika 3")

renpy.invoke_in_thread(write_and_hide)
# We can show chibi to give another hint something is happening
show chibika 3:
subpixel True
rotate_pad True
zoom 0.5
anchor (0.5, 0.5)
pos (0.4, 1.15)
around (0.475, 0.9)

parallel:
linear 15.0 pos (1.15, 0.55) clockwise circles 0
parallel:
rotate 0
linear 5.0 rotate 360
repeat

return "pause: 30"
47 changes: 33 additions & 14 deletions Monika After Story/game/zz_cardgames.rpy
Expand Up @@ -786,30 +786,36 @@ init 5 python in mas_nou:
self.__load_card_asset(card)
self.drawpile.append(card)

def __update_drawpile(self):
def __update_drawpile(self, smooth=True):
"""
Moves all - except the top one - cards from the discardpile
onto the drawpile, then shuffles drawpile
"""
renpy.pause(0.5, hard=True)
if smooth:
renpy.pause(0.5, hard=True)

while len(self.discardpile) > 1:
card = self.discardpile[1]
card = self.discardpile[0]

# Reset wild cards
if card.type == "wild":
card.color = None

self.table.set_faceup(card, False)
self.table.set_rotate(card, 0)
self.table.get_card(card).set_offset(0, 0)

self.drawpile.append(card)

renpy.pause(0.2, hard=True)
if smooth:
renpy.pause(0.2, hard=True)

# align the last card
last_card = self.table.get_card(self.discardpile[0])
self.table.set_rotate(last_card.value, 90)
last_card.set_offset(0, 0)

self.shuffle_drawpile()
self.shuffle_drawpile(smooth=smooth)

def __update_game_log(self, current_player, next_player):
"""
Expand Down Expand Up @@ -1092,16 +1098,19 @@ init 5 python in mas_nou:
amount = self.HAND_CARDS_LIMIT - player_cards

for i in range(amount):
player.hand.append(self.drawpile[-1])
card = self.drawpile[-1]
player.hand.append(card)

if player.isAI:
self.table.set_rotate(player.hand[-1], -180)
self.table.set_rotate(card, -180)
faceup = False
offset = self.MONIKA_CARDS_OFFSET

else:
self.table.set_faceup(player.hand[-1], True)
faceup = True
offset = self.PLAYER_CARDS_OFFSET

self.table.set_faceup(card, faceup)
self.__update_cards_positions(player, offset)

if smooth:
Expand Down Expand Up @@ -1138,6 +1147,10 @@ init 5 python in mas_nou:
if player.should_draw_cards:
player.should_draw_cards -= amount

if drawpile_cards == amount:
# TODO: might need to use new context here
self.__update_drawpile(smooth=smooth)

# there're not enough cards
else:
# deal as much as we can
Expand All @@ -1147,7 +1160,7 @@ init 5 python in mas_nou:
if player.should_draw_cards:
player.should_draw_cards -= drawpile_cards

self.__update_drawpile()
self.__update_drawpile(smooth=smooth)
drawpile_cards = len(self.drawpile)

# we should never get here, but just in case
Expand Down Expand Up @@ -1477,7 +1490,7 @@ init 5 python in mas_nou:
"""
return self.table.sensitive

def shuffle_drawpile(self):
def shuffle_drawpile(self, smooth=True):
"""
Shuffles the drawpile and animates cards shuffling
Expand All @@ -1492,7 +1505,8 @@ init 5 python in mas_nou:
k = renpy.random.randint(0, 9)
# we want to shuffle a bit faster than doing other card interactions
self.table.springback = 0.2
renpy.pause(0.2, hard=True)
if smooth:
renpy.pause(0.2, hard=True)

for i in range(7):
card_id = renpy.random.randint(0, total_cards - 2)
Expand All @@ -1508,19 +1522,22 @@ init 5 python in mas_nou:

card.set_offset(x_offset, y_offset)
card.springback()
renpy.pause(0.15, hard=True)
if smooth:
renpy.pause(0.15, hard=True)

self.drawpile.insert(insert_id, card.value)

card.set_offset(0, 0)
card.springback()
renpy.pause(0.15, hard=True)
if smooth:
renpy.pause(0.15, hard=True)

# reset speed
self.table.springback = 0.3

self.drawpile.shuffle()
renpy.pause(0.2, hard=True)
if smooth:
renpy.pause(0.2, hard=True)

def handle_nou_logic(self, player):
"""
Expand All @@ -1537,6 +1554,7 @@ init 5 python in mas_nou:
the player didn't start to play their turn
"""
self.set_sensitive(False)

if player == "monika":
if self.monika.yelled_nou:
self.__say_quip(self.QUIPS_MONIKA_ALREADY_YELLED_NOU, new_context=True)
Expand Down Expand Up @@ -1569,6 +1587,7 @@ init 5 python in mas_nou:
self.player.yelled_nou = True
self.player.should_play_card = True
self.player.nou_reminder_timeout = 0

self.set_sensitive(True)

class __Card(object):
Expand Down
2 changes: 1 addition & 1 deletion Monika After Story/game/zz_reactions.rpy
Expand Up @@ -2790,7 +2790,7 @@ label mas_reaction_gift_clothes_mocca_bun_blackandwhitestripedpullover:

init 5 python:
# TODO: Add a way to generalize this
if not renpy.seen_label("mas_reaction_gift_noudeck"):
if not mas_seenEvent("mas_reaction_gift_noudeck"):
addReaction("mas_reaction_gift_noudeck", "noudeck", is_good=True)

label mas_reaction_gift_noudeck:
Expand Down

0 comments on commit 277444f

Please sign in to comment.