Refactoring difficulty checks

This commit is contained in:
LoafyLemon 2024-04-25 20:10:46 +01:00
parent 8aba361ea9
commit cc6fe6909c
12 changed files with 31 additions and 31 deletions

View File

@ -274,7 +274,7 @@ label hg_pf_strip_T4_snape:
her @ cheeks blush "......" ("annoyed", "narrow", "worried", "down") her @ cheeks blush "......" ("annoyed", "narrow", "worried", "down")
sna "............." ("snape_13") sna "............." ("snape_13")
"-Unleash your rage {size=-2}(Hardcore){/size}-" if game.difficulty >= 3: #Hardcore difficulty dialogue. "-Unleash your rage {size=-2}(Hardcore){/size}-" if states.env.difficulty >= 3: #Hardcore difficulty dialogue.
$ states.her.mood += 18 $ states.her.mood += 18
gen "Both of you..." ("base", xpos="far_left", ypos="head") gen "Both of you..." ("base", xpos="far_left", ypos="head")
stop music stop music

View File

@ -74,9 +74,9 @@ label snape_hangout:
# Rain puts him in a good mood. # Rain puts him in a good mood.
$ states.sna.level += 1 $ states.sna.level += 1
if game.difficulty == 1: if states.env.difficulty == 1:
$ states.sna.level += 5 $ states.sna.level += 5
elif game.difficulty == 2: elif states.env.difficulty == 2:
$ states.sna.level += 4 $ states.sna.level += 4
else: else:
$ states.sna.level += 3 $ states.sna.level += 3

View File

@ -65,9 +65,9 @@ label tonks_hangout:
if states.fireplace_started: # Tonks is feeling hot. if states.fireplace_started: # Tonks is feeling hot.
$ states.ton.level += 2 $ states.ton.level += 2
if game.difficulty < 2: #Easy difficulty if states.env.difficulty < 2: #Easy difficulty
$ states.ton.level += 5 $ states.ton.level += 5
elif game.difficulty == 2: #Normal elif states.env.difficulty == 2: #Normal
$ states.ton.level += 4 $ states.ton.level += 4
else: #Hardcore else: #Hardcore
$ states.ton.level += 3 $ states.ton.level += 3

View File

@ -65,11 +65,11 @@ label day_start:
states.sus.busy = bool(sb_summon_pause) states.sus.busy = bool(sb_summon_pause)
# Improve Mood # Improve Mood
if game.difficulty == 1: # Easy difficulty if states.env.difficulty == 1: # Easy difficulty
val = 3 val = 3
elif game.difficulty == 2: # Normal difficulty elif states.env.difficulty == 2: # Normal difficulty
val = 2 val = 2
elif game.difficulty == 3: # Hardcore difficulty elif states.env.difficulty == 3: # Hardcore difficulty
val = 1 val = 1
states.ton.mood = max(states.ton.mood-val, 0) states.ton.mood = max(states.ton.mood-val, 0)

View File

@ -11,13 +11,13 @@ label start_wt:
menu: menu:
"Difficulty" "How difficult do you want the game to be?" "Difficulty" "How difficult do you want the game to be?"
"-Easy-{size=-8}\nIncreased gold, item drop rate and Slytherin-points gains.\nMood will improve faster.\nCheats are available.{/size}": "-Easy-{size=-8}\nIncreased gold, item drop rate and Slytherin-points gains.\nMood will improve faster.\nCheats are available.{/size}":
$ game.difficulty = 1 $ states.env.difficulty = 1
$ game.cheats = True $ game.cheats = True
"-Normal-{size=-8}\nBalanced gold, item drop rate and Slytherin-points gains.\nMood will improve normally.\nCheats are available.{/size}": "-Normal-{size=-8}\nBalanced gold, item drop rate and Slytherin-points gains.\nMood will improve normally.\nCheats are available.{/size}":
$ game.difficulty = 2 $ states.env.difficulty = 2
$ game.cheats = True $ game.cheats = True
"-Hardcore-{size=-8}\nReduced gold, item drop rate and Slytherin-points gains.\nMood will not improve over time.\nNo cheats.{/size}": "-Hardcore-{size=-8}\nReduced gold, item drop rate and Slytherin-points gains.\nMood will not improve over time.\nNo cheats.{/size}":
$ game.difficulty = 3 $ states.env.difficulty = 3
$ game.cheats = False $ game.cheats = False
if persistent.game_complete: if persistent.game_complete:

View File

@ -47,9 +47,9 @@ init python:
reports_gold = states.paperwork_reports * (int(progress_factor * max(random_gold, progress_flat)) + progress_flat) reports_gold = states.paperwork_reports * (int(progress_factor * max(random_gold, progress_flat)) + progress_flat)
if game.difficulty <= 1: # Easy if states.env.difficulty <= 1: # Easy
reports_gold = int(reports_gold * 1.2) reports_gold = int(reports_gold * 1.2)
elif game.difficulty == 2: # Normal elif states.env.difficulty == 2: # Normal
pass pass
else: # Hardcore else: # Hardcore
reports_gold = int(reports_gold * 0.9) reports_gold = int(reports_gold * 0.9)

View File

@ -212,7 +212,7 @@ screen ui_menu():
ypos 15 ypos 15
textbutton "Save" action ShowMenu("save") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] textbutton "Save" action ShowMenu("save") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
textbutton "Load" action ShowMenu("load") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] textbutton "Load" action ShowMenu("load") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
if game.cheats and game.difficulty <= 2 and game.day > 1: if game.cheats and states.env.difficulty <= 2 and game.day > 1:
textbutton "Cheats" action [SetScreenVariable("toggle_menu", False), Jump("cheats")] background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] textbutton "Cheats" action [SetScreenVariable("toggle_menu", False), Jump("cheats")] background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]
if game.day > 1 and renpy.android: if game.day > 1 and renpy.android:
textbutton "Preferences" action ShowMenu("preferences") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ] textbutton "Preferences" action ShowMenu("preferences") background None xalign 0.5 text_outlines [ (2, "#00000080", 1, 0) ]

View File

@ -235,10 +235,10 @@ label genie_attack:
if pentogram: if pentogram:
hide screen duel_damage hide screen duel_damage
if game.difficulty <= 1: #Easy if states.env.difficulty <= 1: #Easy
show screen duel_damage(500) show screen duel_damage(500)
$ snape_hp -= 500 $ snape_hp -= 500
elif game.difficulty == 2: #Normal elif states.env.difficulty == 2: #Normal
show screen duel_damage(500) show screen duel_damage(500)
$ snape_hp -= 500 $ snape_hp -= 500
else: #Hardcore else: #Hardcore
@ -246,10 +246,10 @@ label genie_attack:
$ snape_hp -= 500 $ snape_hp -= 500
else: else:
hide screen duel_damage hide screen duel_damage
if game.difficulty <= 1: #Easy if states.env.difficulty <= 1: #Easy
show screen duel_damage(300) show screen duel_damage(300)
$ snape_hp -= 300 $ snape_hp -= 300
elif game.difficulty == 2: #Normal elif states.env.difficulty == 2: #Normal
show screen duel_damage(200) show screen duel_damage(200)
$ snape_hp -= 200 $ snape_hp -= 200
else: #Hardcore else: #Hardcore
@ -287,9 +287,9 @@ label snapes_turn:
$ duel_OBJ.snape = "" $ duel_OBJ.snape = ""
hide screen duel_damage hide screen duel_damage
if game.difficulty <= 1: #Easy if states.env.difficulty <= 1: #Easy
show screen duel_damage(0, False) show screen duel_damage(0, False)
elif game.difficulty == 2: #Normal elif states.env.difficulty == 2: #Normal
show screen duel_damage(100, False) show screen duel_damage(100, False)
$ genie_hp -= 100 $ genie_hp -= 100
else: #Hardcore #Shouldn't increase the penalty if you blocked correctly... else: #Hardcore #Shouldn't increase the penalty if you blocked correctly...
@ -314,10 +314,10 @@ label snapes_turn:
$ duel_OBJ.snape = "" $ duel_OBJ.snape = ""
hide screen duel_damage hide screen duel_damage
if game.difficulty <= 1: #Easy if states.env.difficulty <= 1: #Easy
show screen duel_damage(300, False) show screen duel_damage(300, False)
$ genie_hp -= 300 $ genie_hp -= 300
elif game.difficulty == 2: #Normal elif states.env.difficulty == 2: #Normal
show screen duel_damage(400, False) show screen duel_damage(400, False)
$ genie_hp -= 400 $ genie_hp -= 400
else: #Hardcore else: #Hardcore
@ -393,10 +393,10 @@ label snape_attack:
$ duel_OBJ.snape = "" $ duel_OBJ.snape = ""
hide screen duel_damage hide screen duel_damage
if game.difficulty <= 1: #Easy if states.env.difficulty <= 1: #Easy
show screen duel_damage(100, False) show screen duel_damage(100, False)
$ genie_hp -= 100 $ genie_hp -= 100
elif game.difficulty == 2: #Normal elif states.env.difficulty == 2: #Normal
show screen duel_damage(100, False) show screen duel_damage(100, False)
$ genie_hp -= 100 $ genie_hp -= 100
else: #Hardcore else: #Hardcore

View File

@ -39,7 +39,7 @@ screen puzzle_minigame():
zorder 30 zorder 30
default tries = 0 default tries = 0
default tiles = generate_puzzle(grid=4, difficulty=game.difficulty, blank=15) default tiles = generate_puzzle(grid=4, difficulty=states.env.difficulty, blank=15)
default hint = False default hint = False
$ score = 0 $ score = 0

View File

@ -112,7 +112,7 @@ init python:
elif wine_ITEM.owned < 1: elif wine_ITEM.owned < 1:
return wine_ITEM return wine_ITEM
if game.difficulty == 1: if states.env.difficulty == 1:
# Easy # Easy
# Soft diminishing returns, more rubber banding. Guaranteed item drop. # Soft diminishing returns, more rubber banding. Guaranteed item drop.
if game.gold < int(170 * math.log(game.day)) and random_percent <= 56 - dr: if game.gold < int(170 * math.log(game.day)) and random_percent <= 56 - dr:
@ -122,7 +122,7 @@ init python:
random_item = renpy.random.choice(filtered_list or drop_list) random_item = renpy.random.choice(filtered_list or drop_list)
return random_item return random_item
elif game.difficulty == 2: elif states.env.difficulty == 2:
# Normal # Normal
# Fair diminishing returns, soft rubber banding. High chance for item drop. (Recommended) # Fair diminishing returns, soft rubber banding. High chance for item drop. (Recommended)
if game.gold < int(120 * math.log(game.day)) and random_percent <= 38 - dr: if game.gold < int(120 * math.log(game.day)) and random_percent <= 38 - dr:
@ -143,7 +143,7 @@ init python:
else: else:
return "nothing" return "nothing"
elif game.difficulty == 3: elif states.env.difficulty == 3:
# Hard # Hard
# Harsh diminishing returns, no rubber banding. Chance for item drop. # Harsh diminishing returns, no rubber banding. Chance for item drop.
if game.gold < int(90 * math.log(game.day)) and random_percent <= 33 - dr: if game.gold < int(90 * math.log(game.day)) and random_percent <= 33 - dr:

View File

@ -11,7 +11,7 @@ label start:
label start_quick: label start_quick:
python: python:
version = version_float() version = version_float()
game.difficulty = 2 states.env.difficulty = 2
states.ton.level = 5 states.ton.level = 5
states.sna.level = 5 states.sna.level = 5
states.map.unlocked = True states.map.unlocked = True
@ -27,7 +27,7 @@ label start_quick:
label start_dev: label start_dev:
python: python:
version = version_float() version = version_float()
game.difficulty = 2 states.env.difficulty = 2
game.cheats = True game.cheats = True
game.gold = 100000 game.gold = 100000
states.map.unlocked = True states.map.unlocked = True

View File

@ -154,7 +154,7 @@ init -1 python:
word_list = {"tonks": "friendship", "astoria": "affection", "susan": "confidence", "luna": "corruption", "cho": "recklessness", "hermione": "whoring"} word_list = {"tonks": "friendship", "astoria": "affection", "susan": "confidence", "luna": "corruption", "cho": "recklessness", "hermione": "whoring"}
word = word_list.get(states.active_girl, "whoring") word = word_list.get(states.active_girl, "whoring")
if game.cheats or game.difficulty <= 2: if game.cheats or states.env.difficulty <= 2:
renpy.show_screen("blktone") renpy.show_screen("blktone")
renpy.with_statement(d3) renpy.with_statement(d3)
renpy.say(None, "{size=+6}> Try again at "+word+" level {color=#7a0000}"+str(value)+"{/color}.{/size}") renpy.say(None, "{size=+6}> Try again at "+word+" level {color=#7a0000}"+str(value)+"{/color}.{/size}")