so its basicaly re-introducing the clamp "bug" where giving them flat value boosters leads to overpenalizing; ex. a value like... love is clamped to 100, she has 90 points and you give love potion (+20). she gets the additional 10 points love to 100, the other 10 vanish and once the serum runs out she got dropped by the full 20 to 80.
That's right. If selective amnesia is at the end of the list of traits in a serum, then the values stored in the effect_dict of that serum may disappear, and then the default values will be used, and they are quite high.
That's what I was suggesting:
# Original idea by divas72
import copy
from game.bugfix_additions.SerumTraitMod_ren import SerumTraitMod
from game.major_game_classes.character_related.Person_ren import Person, mc, list_of_instantiation_functions
from game.major_game_classes.serum_related.SerumDesign_ren import SerumDesign
from game.major_game_classes.serum_related.serums._serum_traits_T3_ren import mind_control_agent
"""renpy
init -1 python:
"""
list_of_instantiation_functions.append("init_amnesia_serum")
def amnesia_trait_on_apply(person: Person, serum: SerumDesign, add_to_log: bool):
# We need to find a serum with the Amnesia trait in the active person's serums and save it.
for design in person.serum_effects:
if id(design) != id(serum) and design.has_trait(amnesia_trait):
serum.effects_dict["precondition for a amnesia trait enhance crisis"] = design
serum.effects_dict["love"] = person.love
serum.effects_dict["obedience"] = person._obedience
serum.effects_dict["happiness"] = person.happiness
serum.effects_dict["sluttiness"] = person._sluttiness
serum.effects_dict["pregnant"] = person.is_pregnant
serum.effects_dict["broken_taboos"] = person.broken_taboos.copy()
serum.effects_dict["opinions"] = copy.deepcopy(person.opinions)
serum.effects_dict["sexy_opinions"] = copy.deepcopy(person.sexy_opinions)
serum.effects_dict["sex_record"] = person.sex_record.copy()
if add_to_log:
mc.log_event(f"{person.display_name}: now has selective amnesia", "float_text_red")
def amnesia_trait_on_remove(person: Person, serum: SerumDesign, add_to_log: bool):
# If the stored serum is no longer there, and it was, then the girl must remember what she shouldn't remember.
if (d:=serum.effects_dict.get("precondition for a amnesia trait enhance crisis", None)) and d not in person.serum_effects:
if not "amnesia trait enhance crisis" in mc.business.event_triggers_dict:
mc.business.event_triggers_dict["amnesia trait enhance crisis"] = True
turns = serum.duration * (serum.duration - 1) // 2 if self_generating_serum in serum.traits else serum.duration
xday = day + (turns - serum.duration_counter)//7 + 1
mc.business.add_mandatory_crisis(
Action("Сrisis Of Amnesia Trait With Precedent", amnesia_girl_crisis_requirement, "amnesia_girl_crisis_label",
args = person, requirement_args = [person, xday]))
person.love = serum.effects_dict["love"]
person._obedience = serum.effects_dict["obedience"]
person.happiness = serum.effects_dict["happiness"]
person._sluttiness = serum.effects_dict["sluttiness"]
person.broken_taboos = serum.effects_dict["broken_taboos"]
person.opinions = serum.effects_dict["opinions"]
person.sexy_opinions = serum.effects_dict["sexy_opinions"]
person.sex_record = serum.effects_dict["sex_record"]
if not serum.effects_dict.get("pregnant", True) and person.is_pregnant:
person.event_triggers_dict["preg_mc_father"] = False
person.event_triggers_dict["immaculate_conception"] = True #TODO: Complete the event where the girl tells you that she got pregnant in an impossible way with the opportunity to confess paternity.
if add_to_log:
mc.log_event(f"{person.display_name}: selective amnesia has faded", "float_text_red")
def amnesia_trait_enhanced_on_apply(person: Person, serum: SerumDesign, add_to_log: bool):
# We need to find a serum with the Amnesia trait in the active person's serums and save it.
pre_amnesia = serum
for design in person.serum_effects:
if id(design) != id(serum) and design.has_trait(amnesia_trait) or design.has_trait(enhanced_amnesia_trait):
pre_amnesia = design
# Instead of storing the current data in a "restore point", we retrieve data from an existing point:
# NOTE: For dicts and lists we use a direct link instead of creating a copy because when pre_amnesia expired its action and is deleted, these lists and dictionaries will still be in memory.
serum.effects_dict["love"] = pre_amnesia.effects_dict.get("love", None) or person.love
serum.effects_dict["obedience"] = pre_amnesia.effects_dict.get("obedience", None) or person._obedience
serum.effects_dict["happiness"] = pre_amnesia.effects_dict.get("happiness", None) or person.happiness
serum.effects_dict["sluttiness"] = pre_amnesia.effects_dict.get("sluttiness", None) or person._sluttiness
serum.effects_dict["pregnant"] = pre_amnesia.effects_dict.get("pregnant", None) or person.is_pregnant
serum.effects_dict["broken_taboos"] = pre_amnesia.effects_dict.get("broken_taboos", None) or person.broken_taboos.copy()
serum.effects_dict["opinions"] = pre_amnesia.effects_dict.get("opinions", None) or copy.deepcopy(person.opinions)
serum.effects_dict["sexy_opinions"] = pre_amnesia.effects_dict.get("sexy_opinions", None) or copy.deepcopy(person.sexy_opinions)
serum.effects_dict["sex_record"] = pre_amnesia.effects_dict.get("sex_record", None) or person.sex_record.copy()
if add_to_log:
mc.log_event(f"{person.display_name}: now has selective amnesia", "float_text_red")
def amnesia_girl_crisis_requirement(person, xday):
if mc.business.event_triggers_dict.get("amnesia trait enhance crisis", None) and day >= xday:
if person.is_employee: return mc.is_at_work
elif person.is_family: return mc.is_home
else: return not (mc.is_at_work or mc.is_home)
return False
def amnesia_trait_crisis_requirement():
return mc.business.event_triggers_dict.get("amnesia trait enhance crisis", None) and amnesia_trait.mastery_level > 3.0
def init_amnesia_serum():
amnesia_trait = SerumTraitMod(name = "Selective Amnesia",
desc = "As suggested, this trait blocks the person's ability to store experience from the short-term memory into the long-term memory, when the serum expires all primary stats and opinions will be restored to the values prior to taking the serum, including sex acts and how she got pregnant.",
positive_slug = "Blocks memories",
negative_slug = "Restores all major stats and opinions to the value before taking serum",
research_added = 1000,
base_side_effect_chance = 100,
on_apply = amnesia_trait_on_apply,
on_remove = amnesia_trait_on_remove,
tier = 3,
start_researched = False,
requires = [mind_control_agent],
research_needed = 2000,
clarity_cost = 1500,
mental_aspect = 7, physical_aspect = 1, sexual_aspect = 3, medical_aspect = 2, flaws_aspect = 0, attention = 5,
start_enabled = True)
enhanced_amnesia_trait = SerumTraitMod(name = "Selective Amnesia Enhanced",
desc = "This trait blocks the person's ability to store experience from the short-term memory into the long-term memory, when the serum expires all primary stats and opinions will be restored to the values prior to taking the serum, including sex acts and how she got pregnant.",
positive_slug = "Blocks memories",
negative_slug = "Restores all major stats and opinions to the value before taking serum",
research_added = 1000,
base_side_effect_chance = 100,
on_apply = amnesia_trait_enhanced_on_apply,
on_remove = amnesia_trait_on_remove,
tier = 3,
start_researched = False,
research_needed = 2000,
clarity_cost = 1500,
mental_aspect = 7, physical_aspect = 1, sexual_aspect = 3, medical_aspect = 2, flaws_aspect = 0, attention = 5,
start_enabled = False, allow_toggle = False)
mc.business.add_mandatory_crisis(
Action("Enhance Amnesia Trait Crisis", amnesia_trait_crisis_requirement, "amnesia_trait_crisis_label",
args = None, requirement_args = None))