code:
var CC_Mod = CC_Mod || {};
CC_Mod.Tweaks = CC_Mod.Tweaks || {};

//=============================================================================
 /*:
 * @plugindesc Various minor changes and tweaks
 * @author chainchariot/drchainchair/whatever random throwaway name I picked
 *  Current account on F95: https://f95zone.to/members/drchainchair2.2159881/
 *
 * @help
 * This is a free plugin.
 * If you want to redistribute it, leave this header intact.
 * Thanks to LOTD for his mod as looking at it let me figure some stuff out
 *
 */
//=============================================================================

// I never worked with js before, so this was a bit of a learning experience

// Mod Options & Variables
//////////////////////////////////////////////////////////////
// Set to true to enable, false to disable

// There are a bunch of limits imposed on the game which make getting
// some passives/titles impossible.  This removes the limits, but
// not everything past the limits might be fully implemented or balanced
const CCMod_removeKarrynLimits = true;
// Disable known serious issues with removing limits
// Currently: disable showEval for vaginal sex skill since it will freeze the game
//            skip learning empty passives
const CCMod_removeKarrynLimits_disableKnownProblems = true;

// Manual saves are always enabled, and making frequent saves to roll back
// to in case something breaks is always recommended
const CCMod_disableAutosave = true;

////////////////
// Cum, clothing, and toys not fixed after battles
// TODO: Use slut level to grant a % chance to remove a toy instead
const CCMod_postBattleCleanup_Enabled = true;
const CCMod_postBattleCleanup_numClothingStagesRestored = 1;
// If clothing max damage, chance to lose gloves/hat
const CCMod_postBattleCleanup_glovesHatLossChance = 0.33;
const CCMod_postBattleCleanup_stayNakedIfStripped = true;
const CCMod_clothingDurabilityMult = 1.50;
// If halberd defiled, can't restore clothing in battle
const CCMod_clothingRepairDisabledIfDefiled = true;

const CCMod_exhibitionistPassive_recordThresholdOne = 300;
const CCMod_exhibitionistPassive_recordThresholdTwo = 1000;
const CCMod_exhibitionistPassive_wakeUpNakedChance = 0.33;
// Base amount gained per update tick per clothing stage missing, depending on passives
const CCMod_exhibitionistPassive_fatiguePerTick = 0.16;
const CCMod_exhibitionistPassive_pleasurePerTick = 0.33;

////////////////
// Edict cost cheat
const CCMod_edictCostCheat_Enabled = true;
const CCMod_edictCostCheat_GoldCostRateMult = 0;
const CCMod_edictCostCheat_ExtraDailyEdictPoints = 200;
// Disable after x days, so you can get whatever you want on a new game then proceed normally after.  Set to 0 to always be active.
const CCMod_edictCostCheat_ActiveUntilDay = 10;
// If this is enabled and you have the EDICT_PROVIDE_OUTSOURCING edict, it will give you way too much gold, so adjust it here to effectively disable the edict if this cheat is enabled
const CCMod_edictCostCheat_AdjustIncome = true;
// If count is above this number assume modded and adjust income
const CCMod_edictCostCheat_EdictThreshold = 10;

////////////////
// Order cheat
const CCMod_orderCheat_Enabled = true;
const CCMod_orderCheat_MinOrder = 1;
const CCMod_orderCheat_MaxOrder = 100;
// Set to 1 to ignore.  Multiplier for negative control values
const CCMod_orderCheat_NegativeControlMult = 0.90;
const CCMod_orderCheat_preventAnarchyIncrease = false;
// Set to -1000 for default behavior
const CCMod_orderCheat_maxControlLossFromRiots = -30;
// Multiplier for riot buildup chance (this is added to base chance every day, so it eventually reaches 100).  Set to 1 for default behavior.
const CCMod_orderCheat_riotBuildupMult = 0.85;

////////////////
// Param adjustments

// Charm isn't impacted by slut level
const CCMod_paramTweak_Charm_NoSlutShaming = true;

////////////////
// TODO: This section still needs more research to work reliably. Currently not implemented.
// This is in addition to the base value, so at least 1 with a chance of +0~2
const CCMod_moreEjaculationStock_Enabled = true;
const CCMod_moreEjaculationStock_Min = 0;
const CCMod_moreEjaculationStock_Max = 2;
const CCMod_moreEjaculationStock_Chance = 0.3;

////////////////
// Set a minimum willpower cost, normally there is none
const CCMod_willpowerCost_Enabled = true;
const CCMod_willpowerCost_Min = 10;
// Optionally, set base min cost for only resist/suppress skills
const CCMod_willpowerCost_Min_ResistOnly = true;
// Lose willpower on orgasm.  Optionally, lose less depending on Mind edicts
const CCMod_willpowerLossOnOrgasm = true;
const CCMod_willpowerLossOnOrgasm_UseEdicts = true;
const CCMod_willpowerLossOnOrgasm_BaseLossMult = 0.67;
// Set to 0 to make all mind edicts count
const CCMod_willpowerLossOnOrgasm_MinLossMult = 0.10;

////////////////
// Side Jobs

// Prevent side jobs from decaying their level
const CCMod_sideJobDecay_Enabled = true;
// Grace period before decay added onto game base (2)
const CCMod_sideJobDecay_ExtraGracePeriod = 28;
// Minimum reputation level for side jobs
const CCMod_sideJobReputationMin_Waitress = 7;
const CCMod_sideJobReputationMin_Secretary = 7;
const CCMod_sideJobReputationMin_Glory = 0;
const CCMod_sideJobReputationMin_Stripper = 0;
// Build reputation faster, extra amount to add when increase is called
const CCMod_sideJobReputationExtra_Waitress = 2;
const CCMod_sideJobReputationExtra_Secretary = 2;
const CCMod_sideJobReputationExtra_Glory = 2;
const CCMod_sideJobReputationExtra_Stripper = 2;

// Cost for serving drinks, moving, and returning to bar
const CCMod_waitressStaminaCostMult = 1.350;
const CCMod_waitressStaminaCostMult_ReturnToBarExtra = 1.15;

// Value added in addition to every time the value is updated
// The base value is BAR_BASE_SPAWN_CHANCE 0.005
const CCMod_extraBarSpawnChance = 0.002;
// Rejection cost is now MaxWillpower * mult instead of fixed 15
const CCMod_alcoholRejectCostEnabled = true
const CCMod_alcoholRejectWillCostMult = 0.35;
// Minimum bar patience (they get angry when it's 0)
const CCMod_minimumBarPatience = 0;
// Instead of ignoring angry customers completely, add a forgiveness counter
// Each time a customer would get angry, this is reduced by 1 instead and the timer is reset
// Once this hits 0, a customer will get angry the next time their timer runs out and it will reset
// This is a global value, so if 2 would get angry at the same time, only 1 will
const CCMod_angryCustomerForgivenessCounterBase = 1;
// This will modify the patron's preferred drink to the strongest one available instead of random
// It isn't guaranteed to be picked but it has a very high chance
const CCMod_easierDrinkSelection = true;

const CCMod_receptionistBreatherStaminaRestoreMult = 2.60;
const CCMod_receptionistMoreGoblins_Enabled = true;
// This doesn't affect how many can be out at once
const CCMod_receptionistMoreGoblins_NumExtra = 999;
// Set to 1 for vanilla behavior, <1 is faster, >1 is slower
const CCMod_receptionistMoreGoblins_SpawnTimeMult = 0.7;
// Let more goblins be out at once easier
// Bonus of 10 is +1 point, breakpoints at 3 and 5 points
const CCMod_receptionistMoreGoblins_MaxGoblinsActiveBonus = 10;

// These conversions do not apply to 'wanted' visitors
// Chance to convert female spawns to male, 0 to disable
const CCMod_receptionistMorePerverts_femaleConvertChance = 0.5;
// Chance to convert spawn of non-pervert to pervert, 0 to disable
// Applied after femaleConvertChance so it can change those too
// Most male visitors have a chance to convert on their own if observing lewd actions while waiting in line already
const CCMod_receptionistMorePerverts_extraSpawnChance = 0.25;
// Multiplier to desire requirement to accept prev request, set to 1 for default behavior
const CCMod_receptionistMorePerverts_desireMult = 0.75;

////////////////
// Lose panties easier.  Normally requires passives
const CCMod_losePantiesEasier_Enabled = true;
const CCMod_losePantiesEasier_baseChance = 0.2;
const CCMod_losePantiesEasier_baseChanceWakeUp = 0.05;

////////////////
// Desire Modifiers

// Remove virginity penalty from creampie
const CCMod_easierCreampieCockDesireRequirements = true;
// Desire requirement multiplier for receptionist petting actions
const CCMod_easierReceptionistPettingActionsMult = 0.25;
const CCMod_easierSideJobDesirePenaltyMult = 0.85;
// Decrease pleasure enemies give themselves via jerkoff
const CCMod_enemyJerkingOffPleasureGainMult = 0.85;
// Additional multiplier added during side jobs
const CCMod_enemyJerkingOffPleasureGainMult_SideJobs = 0.7;
// This has the side-effect of lowering fatigue recovery if you just sleep
const CCMod_alwaysArousedForMasturbation = false;
const CCMod_easierKickCounterRequirements = true;
const CCMod_easierKickCounterRequirements_DesireMult = 0.4;
// Set to 0 to disable. Takes this percentage of fatigue and adds it to a desire multiplier to lower desire req
const CCMod_globalFatigueDesireMult = 0.35;

////////////////
// Defeat

// Give Up/Surrender always enabled instead of requiring passives
const CCMod_defeat_SurrenderSkillsAlwaysEnabled = true;
// Start defeat scenes at zero stam/energy, this disables player control
// until it gets restored if the scene lasts long enough
const CCMod_defeat_StartWithZeroStamEnergy = true;

//=============================================================================
//////////////////////////////////////////////////////////////
// Vars & Utility Functions

const CCMOD_VERSION_INIT = 100; // Absolutely never change this
const CCMOD_VERSION_4u = 101;
const CCMOD_VERSION_5e = 102;
const CCMOD_VERSION_6c = 103;
const CCMOD_VERSION_6h = 104;
const CCMOD_VERSION_6i = 105;
const CCMOD_VERSION_6i_2 = 106;
const CCMOD_VERSION_6n = 107;
const CCMOD_VERSION_6n_2 = 108;
const CCMOD_VERSION_LATEST = CCMOD_VERSION_6n_2;

CC_Mod.initialize = function() {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);

    if (typeof actor._CCMod_version === 'undefined') {
        actor._CCMod_version = CCMOD_VERSION_INIT;
    }

    CC_Mod.initializePregMod(actor);
    CC_Mod.initializeGyaruMod(actor);

    // Debug: Uncomment this to force re-init
    //actor._CCMod_version = CCMOD_VERSION_INIT;
    if (actor._CCMod_version < CCMOD_VERSION_4u) {
        // Empty
    }

    if (actor._CCMod_version < CCMOD_VERSION_5e) {
        actor._CCMod_defeatStripped = false;
    }

    if (actor._CCMod_version < CCMOD_VERSION_6c) {
        // Empty
    }

    if (actor._CCMod_version < CCMOD_VERSION_6h) {
        // Empty
    }

    if (actor._CCMod_version < CCMOD_VERSION_6i) {
        actor._CCMod_recordTimeSpentWanderingAroundNaked = 0;
    }

    if (actor._CCMod_version < CCMOD_VERSION_6i_2) {
       if (actor.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_ONE_ID)) {
           CC_Mod.setBedStripGameSwitch();
       }
    }

    if (actor._CCMod_version < CCMOD_VERSION_6n) {
        // Stuff that should be persistent in the save file
        actor._CCMod_sideJobDecay_GraceWaitress = CCMod_sideJobDecay_ExtraGracePeriod;
        actor._CCMod_sideJobDecay_GraceReceptionist = CCMod_sideJobDecay_ExtraGracePeriod;
        actor._CCMod_sideJobDecay_GraceGlory = CCMod_sideJobDecay_ExtraGracePeriod;
        actor._CCMod_sideJobDecay_GraceStripper = CCMod_sideJobDecay_ExtraGracePeriod;

        actor._CCMod_exhibitionistFatigueGranularity = 0;
    }

    // These don't need to be persistent in a save
    CC_Mod.CCMod_cleanupFunctionsSkipEnabled = false;
    CC_Mod.CCMod_angryCustomerForgivenessCounter = CCMod_angryCustomerForgivenessCounterBase;
    CC_Mod.CCMod_bonusReactionScoreEnabled = false;
    CC_Mod.CCMod_edictCostCheat_AdjustIncomeFlag = false;
    CC_Mod.CCMod_easierKickCounterRequirementsFlag = false;
    CC_Mod.CCMod_easierPervRequestFlag = false;

    CC_Mod.CCMod_removeLimits();
    CC_Mod.updateMapSprite(actor);

    actor._CCMod_version = CCMOD_VERSION_LATEST;
};

CC_Mod.Tweaks.Game_Party_loadGamePrison = Game_Party.prototype.loadGamePrison;
Game_Party.prototype.loadGamePrison = function() {
    CC_Mod.Tweaks.Game_Party_loadGamePrison.call(this);
    CC_Mod.initialize();
};

CC_Mod.setupModRecords = function(actor) {
    actor._CCMod_recordTimeSpentWanderingAroundNaked = 0;
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Don't clean up Karryn after battle
//////////////////////////////////////////////////////////////

// TODO in this section: only partial desire reset on battle end
// see: resetDesires setupDesires

CC_Mod.mapTemplateEvent_CleanUp = function() {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);
    CC_Mod.cleanAndRestoreKarryn(true);
    actor.emoteMapPose(false, false, true);
};

CC_Mod.mapTemplateEvent_Strip = function() {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);
    CC_Mod.stripKarryn();
    actor.emoteMapPose(false, false, true);
};

CC_Mod.setBedStripGameSwitch = function() {
    $gameSwitches.setValue(CCMOD_SWITCH_BED_STRIP_ID, true);
};

// Clean up and get dressed, use at any bed
CC_Mod.cleanAndRestoreKarryn = function(preserveWet = false) {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);

    let tempWet = actor._liquidPussyJuice;

    actor.removeAllToys();
    actor.cleanUpLiquids();
    actor.restoreClothingDurability();
    actor.putOnGlovesAndHat();

    if (preserveWet) {
        actor._liquidPussyJuice = tempWet;
    }
};

CC_Mod.stripKarryn = function(forceLosePanties = false) {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);
    actor.changeClothingToStage(actor._clothingMaxStage);
    if (actor.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID) || forceLosePanties) {
        actor.takeOffPanties();
        actor._lostPanties = true;
    } else {
        actor.passiveStripOffPanties_losePantiesEffect();
    }
};

CC_Mod.postBattleCleanup = function(actor) {
    if (actor.isClothingMaxDamaged() &&
        actor.isWearingGlovesAndHat() &&
        Math.random() < CCMod_postBattleCleanup_glovesHatLossChance) {
            actor.takeOffGlovesAndHat();
            actor.setWardenMapPose_Naked();
    }

    // Do not restore any clothing if stripped in defeat scene
    if (actor._CCMod_defeatStripped == true) {
        //return;
    }
    // Restore clothing by stage
    // Battle art doesn't support clothing but no gloves/hat, so just stay naked in that case
    else if (!(actor.isClothingMaxDamaged() && CCMod_postBattleCleanup_stayNakedIfStripped) && CCMod_postBattleCleanup_numClothingStagesRestored > 0 && actor.isWearingGlovesAndHat()) {
        actor.changeClothingToStage(actor._clothingStage - CCMod_postBattleCleanup_numClothingStagesRestored);
    }

    CC_Mod.updateMapSprite(actor);
};

// If weapon is defiled, also unable to fix clothes in battle
CC_Mod.Tweaks.Game_Actor_showEval_fixClothes = Game_Actor.prototype.showEval_fixClothes;
Game_Actor.prototype.showEval_fixClothes = function() {
    let result = CC_Mod.Tweaks.Game_Actor_showEval_fixClothes.call(this);
    if (this._halberdIsDefiled && CCMod_clothingRepairDisabledIfDefiled) {
        result = false;
    }
    return result;
};

// Swap sprite to closest match for standing image
CC_Mod.updateMapSprite = function(actor) {
	if(!$gameScreen.isMapMode()) {
		return;
	}

    // Sprites located in www\img\characters
    // 0 Nude NoHat
    // 1 Nude Hat Aroused
    // 2 Nude NoHat Aroused
    // 3 empty
    // 4 Warden Uniform
    // 5 Receptionist
    // 6 ?? basically empty
    // 7 Pirate&Cape?  Don't recall seeing this one used, is 7 even a valid ID?

    // There is no Nude Hat NotAroused variant, though it probably wouldn't be too hard to make

    let spriteID = 4;

    if (actor.isClothingMaxDamaged() || actor._hasNoClothesOn) {
        if (actor.isWearingGlovesAndHat()) {
            spriteID = 1;
        } else {
            if (actor.isAroused()) {
                spriteID = 2;
            } else {
                spriteID = 0;
            }
        }
    }

    if (actor._clothingType == CLOTHING_ID_WARDEN) {
        if (CCMod_alwaysArousedForMasturbation) {
            $gameSwitches.setValue(SWITCH_IS_AROUSED_ID, true);
        }
        actor.setCharacterImage("C_Karryn01", spriteID);
        $gamePlayer.refresh();
    }
    CC_Mod.exhibitionist_UpdateTick(actor);

};

// Extra hook to update sprite - it's also updated via CommonEvents post-battle after the last script call
// So we'll do it here instead
CC_Mod.Tweaks.Game_Actor_emoteMapPose = Game_Actor.prototype.emoteMapPose;
Game_Actor.prototype.emoteMapPose = function(goingToSleep, goingToOnani, calledFromCommons) {
    CC_Mod.Tweaks.Game_Actor_emoteMapPose.call(this, goingToSleep, goingToOnani, calledFromCommons);
    CC_Mod.updateMapSprite(this);
};

// These three functions -
//  restoreClothingDurability
//  removeAllToys
//  cleanUpLiquids
// need to get skipped in the postBattleCleanup call
CC_Mod.Tweaks.Game_Actor_restoreClothingDurability = Game_Actor.prototype.restoreClothingDurability;
Game_Actor.prototype.restoreClothingDurability = function() {
    if (!CC_Mod.CCMod_cleanupFunctionsSkipEnabled) {
        CC_Mod.Tweaks.Game_Actor_restoreClothingDurability.call(this);
        CC_Mod.updateMapSprite(this);
        // TODO: Debug this later
        //CC_Mod.maternityClothingEffects(this);
    }
};

CC_Mod.Tweaks.Game_Actor_removeAllToys = Game_Actor.prototype.removeAllToys;
Game_Actor.prototype.removeAllToys = function() {
    if (!CC_Mod.CCMod_cleanupFunctionsSkipEnabled) {
        CC_Mod.Tweaks.Game_Actor_removeAllToys.call(this);
    }
};

CC_Mod.Tweaks.Game_Actor_cleanUpLiquids = Game_Actor.prototype.cleanUpLiquids;
Game_Actor.prototype.cleanUpLiquids = function() {
    if (!CC_Mod.CCMod_cleanupFunctionsSkipEnabled) {
        CC_Mod.Tweaks.Game_Actor_cleanUpLiquids.call(this);
    }
};

// Set flag to skip execution of the above three functions and call the mod function too
CC_Mod.Tweaks.Game_Actor_postBattleCleanup = Game_Actor.prototype.postBattleCleanup;
Game_Actor.prototype.postBattleCleanup = function() {
    if (CCMod_postBattleCleanup_Enabled) {
        CC_Mod.CCMod_cleanupFunctionsSkipEnabled = true;
    }
    CC_Mod.Tweaks.Game_Actor_postBattleCleanup.call(this);
    if (CCMod_postBattleCleanup_Enabled) {
        CC_Mod.postBattleCleanup(this);
    }
    CC_Mod.CCMod_cleanupFunctionsSkipEnabled = false;
};

// Wrapper for defeat scenes
CC_Mod.Tweaks.Game_Party_postDefeat_preRest = Game_Party.prototype.postDefeat_preRest;
Game_Party.prototype.postDefeat_preRest = function() {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);

    // This will skip the cleanAndRestoreKarryn call in advanceNextDay
    // Flag is reset on every call of advanceNextDay
    actor._CCMod_defeatStripped = true;

    // This function calls postBattleCleanup which resets the normal postBattle skip flag
    CC_Mod.Tweaks.Game_Party_postDefeat_preRest.call(this);
    // So re-enable the skip flag here
    if (CCMod_postBattleCleanup_Enabled) {
        CC_Mod.CCMod_cleanupFunctionsSkipEnabled = true;
    }
};

CC_Mod.Tweaks.Game_Party_postDefeat_postRest = Game_Party.prototype.postDefeat_postRest;
Game_Party.prototype.postDefeat_postRest = function() {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);
    CC_Mod.CCMod_cleanupFunctionsSkipEnabled = false;

    CC_Mod.Tweaks.Game_Party_postDefeat_postRest.call(this);

    // Naked after defeat scene
    CC_Mod.stripKarryn(true);
};

// Masturbation scene, stay wet
CC_Mod.Tweaks.Game_Actor_setCouchOnaniMapPose = Game_Actor.prototype.setCouchOnaniMapPos;
Game_Actor.prototype.setCouchOnaniMapPose = function() {
    if (CCMod_postBattleCleanup_Enabled) {
        CC_Mod.CCMod_cleanupFunctionsSkipEnabled = true;
    }
    CC_Mod.Tweaks.Game_Actor_setCouchOnaniMapPose.call(this);
    CC_Mod.CCMod_cleanupFunctionsSkipEnabled = false;
    CC_Mod.cleanAndRestoreKarryn(true);
};

// Apply clothing durability multiplier, warden only
CC_Mod.Tweaks.Game_Actor_getClothingMaxDurability = Game_Actor.prototype.getClothingMaxDurability;
Game_Actor.prototype.getClothingMaxDurability = function() {
    let clothDura = CC_Mod.Tweaks.Game_Actor_getClothingMaxDurability.call(this);
    if (this._clothingType == CLOTHING_ID_WARDEN) {
        clothDura = Math.round(clothDura * CCMod_clothingDurabilityMult);
    }
    return clothDura;
};

// Game crashes if you start waitress with certain liquids active
// Some might not crash but they look wrong since the proper art assets don't exist for it
CC_Mod.Tweaks.Game_Party_preWaitressBattleSetup = Game_Party.prototype.preWaitressBattleSetup;
Game_Party.prototype.preWaitressBattleSetup = function() {
    CC_Mod.cleanAndRestoreKarryn(true);
    CC_Mod.Tweaks.Game_Party_preWaitressBattleSetup.call(this);
};

// Ran into an issue here once on receptionist so clean it up too
CC_Mod.Tweaks.Game_Party_preReceptionistBattleSetup = Game_Party.prototype.preReceptionistBattleSetup;
Game_Party.prototype.preReceptionistBattleSetup = function() {
    CC_Mod.cleanAndRestoreKarryn(true);
    CC_Mod.Tweaks.Game_Party_preReceptionistBattleSetup.call(this);
};

// Just putting this here for easy update in the future
CC_Mod.Tweaks.Game_Party_preGloryBattleSetup = Game_Party.prototype.preGloryBattleSetup;
Game_Party.prototype.preGloryBattleSetup = function() {
    // CC_Mod.cleanAndRestoreKarryn(true); // Probably shouldn't be needed given the nature of this side job
    CC_Mod.Tweaks.Game_Party_preGloryBattleSetup.call(this);
};

///////////////
// Exhibitionist Stuff
Game_Actor.prototype.CCMod_checkForNewExhibitionistPassives = function() {
    if (!this.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_ONE_ID) && this._CCMod_recordTimeSpentWanderingAroundNaked >= CCMod_exhibitionistPassive_recordThresholdOne) {
        this.learnNewPassive(CCMOD_PASSIVE_EXHIBITIONIST_ONE_ID);
        CC_Mod.setBedStripGameSwitch();
    }
    else if (!this.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID) && this._CCMod_recordTimeSpentWanderingAroundNaked >= CCMod_exhibitionistPassive_recordThresholdTwo) {
        this.learnNewPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID);
    }
};

CC_Mod.exhibitionist_UpdateTick = function(actor) {
    // I like the idea of having this effect strength based on nude vs partially stripped
    let value = CC_Mod.exhibitionist_GetClothingVisibility(actor);
    actor._CCMod_recordTimeSpentWanderingAroundNaked += value;

    if (actor.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID)) {
        // Gain pleasure from being naked
        value *= CCMod_exhibitionistPassive_pleasurePerTick;
        CC_Mod.exhibitionist_GainPleasure(actor, value);
    }
    else if (actor.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_ONE_ID)) {
        // Do nothing, neutral passive
    }
    else {
        // Gain fatigue from being naked
        value *= CCMod_exhibitionistPassive_fatiguePerTick;
        CC_Mod.exhibitionist_GainFatigue(actor, value);
    }

};

// Provided value needs to be converted from a percent to actual pleasure value
CC_Mod.exhibitionist_GainPleasure = function(actor, value) {
    let pleasureIncrease = Math.round(value * actor.orgasmPoint() / 100);
    actor.gainPleasure(pleasureIncrease);
};

CC_Mod.exhibitionist_GainFatigue = function(actor, value) {
    // This needs to have more precision than int when working with numbers around 1
    actor._CCMod_exhibitionistFatigueGranularity += value;
    let roundedValue = Math.round(actor._CCMod_exhibitionistFatigueGranularity);
    if (roundedValue >= 1) {
        actor.gainFatigue(roundedValue);
        actor._CCMod_exhibitionistFatigueGranularity -= roundedValue;
    }
};

CC_Mod.exhibitionist_GetClothingVisibility = function(actor) {
    let clothingVisibility = actor._clothingStage - 1;
    if (actor._lostPanties) {
        clothingVisibility += 2;
    }
    return clothingVisibility;
};

CC_Mod.exhibitionist_wakeUpNakedEffect = function(actor) {
    if(actor.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID)) {
        if (Math.random() < CCMod_exhibitionistPassive_wakeUpNakedChance) {
            CC_Mod.stripKarryn();
        }
    }
};

CC_Mod.CCMod_getExhibitionistPassiveLevel = function(actor) {
    let level = 0;
    if (actor.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID)) {
        level = 2;
    }
    else if (actor.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_ONE_ID)) {
        level = 1;
    }
    return level;
};

CC_Mod.CCMod_getExhibitionistStatusText = function(actor) {
    let statusText = "";
    // Fully clothed is 1
    // Naked is _clothingMaxStage
    let visibility = actor._clothingStage;
    let exhibLevel = CC_Mod.CCMod_getExhibitionistPassiveLevel(actor);
    if (visibility == 1) {
        statusText += "Karryn is fully clothed.";
        if (exhibLevel == 0) {
            statusText += " As it should be.";
        }
        else if (exhibLevel == 2) {
            statusText += " Boring!";
        }
    }
    else if (visibility == actor._clothingMaxStage) {
        if (exhibLevel == 0) {
            statusText += "Karryn is uncomfortable (\\C[2]Fatigue↑\\C[0])";
        }
        else if (exhibLevel == 2) {
            statusText += "Karryn loves showing off (\\C[1]Pleasure↑\\C[0])";
        }
        else {
            statusText += "Karryn is naked.";
        }
    }
    else {
        statusText += "Karryn's clothing is in disarray."
        if (exhibLevel == 0) {
            statusText += "(\\C[2]Fatigue↑\\C[0])";
        }
        else if (exhibLevel == 2) {
            statusText += "(\\C[1]Pleasure↑\\C[0])";
        }
    }

    return statusText;
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Edict Cost Cheat
//////////////////////////////////////////////////////////////

CC_Mod.edictCheatCostIsActive = function() {
    return (CCMod_edictCostCheat_Enabled && ((CCMod_edictCostCheat_ActiveUntilDay == 0) || (Prison.date < CCMod_edictCostCheat_ActiveUntilDay)));
};

CC_Mod.edictCostCheatAddPoints = function() {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);
    if (CC_Mod.edictCheatCostIsActive()) {
        actor._storedEdictPoints += CCMod_edictCostCheat_ExtraDailyEdictPoints;
    } else {
        // It should be impossible to have more than 10 (I think 4 is the max right now)
        // So reset points here
        if ((actor._storedEdictPoints + actor.stsAsp()) > CCMod_edictCostCheat_EdictThreshold) {
            actor._storedEdictPoints = 2;
        }
    }
};

CC_Mod.Tweaks.Game_Party_setDifficultyToEasy = Game_Party.prototype.setDifficultyToEasy;
Game_Party.prototype.setDifficultyToEasy = function() {
    CC_Mod.Tweaks.Game_Party_setDifficultyToEasy.call(this);
    CC_Mod.edictCostCheatAddPoints();
};

CC_Mod.Tweaks.Game_Party_setDifficultyToNormal = Game_Party.prototype.setDifficultyToNormal;
Game_Party.prototype.setDifficultyToNormal = function() {
    CC_Mod.Tweaks.Game_Party_setDifficultyToNormal.call(this);
    CC_Mod.edictCostCheatAddPoints();
};

CC_Mod.Tweaks.Game_Party_setDifficultyToHard = Game_Party.prototype.setDifficultyToHard
Game_Party.prototype.setDifficultyToHard = function() {
    CC_Mod.Tweaks.Game_Party_setDifficultyToHard.call(this);
    CC_Mod.edictCostCheatAddPoints();
};

CC_Mod.Tweaks.Game_Actor_getNewDayEdictPoints = Game_Actor.prototype.getNewDayEdictPoints;
Game_Actor.prototype.getNewDayEdictPoints = function() {
    CC_Mod.Tweaks.Game_Actor_getNewDayEdictPoints.call(this);
    CC_Mod.edictCostCheatAddPoints();
};

CC_Mod.Tweaks.Game_Actor_getEdictGoldRate = Game_Actor.prototype.getEdictGoldRate;
Game_Actor.prototype.getEdictGoldRate = function(skillID) {
    let rate = CC_Mod.Tweaks.Game_Actor_getEdictGoldRate.call(this, skillID);
    if (CC_Mod.edictCheatCostIsActive()) {
        rate = rate * CCMod_edictCostCheat_GoldCostRateMult;
    }
    return rate;
};

// Unfuck income here
// Just disable the effect of the edict while cheat is active
// This is a wrapper function to set flag to skip edict check
CC_Mod.Tweaks.Game_Actor_variablePrisonIncome = Game_Actor.prototype.variablePrisonIncome;
Game_Actor.prototype.variablePrisonIncome = function() {
    // this.stsAsp() is current edict points
    if (CCMod_edictCostCheat_AdjustIncome && (this._storedEdictPoints + this.stsAsp()) > CCMod_edictCostCheat_EdictThreshold) {
        CC_Mod.CCMod_edictCostCheat_AdjustIncomeFlag = true;
    }
    let income = CC_Mod.Tweaks.Game_Actor_variablePrisonIncome.call(this);
    CC_Mod.CCMod_edictCostCheat_AdjustIncomeFlag = false;
    return income;
};

// And here is where we return false on the edict if flag is set
CC_Mod.Tweaks.Game_Actor_hasEdict = Game_Actor.prototype.hasEdict;
Game_Actor.prototype.hasEdict = function(id) {
    if (id == EDICT_PROVIDE_OUTSOURCING && CC_Mod.CCMod_edictCostCheat_AdjustIncomeFlag) {
        return false;
    }
    return CC_Mod.Tweaks.Game_Actor_hasEdict.call(this, id);
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Param Tweaks
//////////////////////////////////////////////////////////////

// Charm isn't lowered by slut level (passive count)
// Copied formula should be checked on major version updates to make sure it's still the same
CC_Mod.Tweaks.Game_Actor_paramBase = Game_Actor.prototype.paramBase;
Game_Actor.prototype.paramBase = function(paramId) {
    let num = 0
    if (CCMod_paramTweak_Charm_NoSlutShaming && paramId === PARAM_CHARM_ID) {
        if(this.slutLvl <= 100) {
            num += Math.round(this.slutLvl * 0.05);
        }
        else if(this.slutLvl <= 200) {
            num += 5;
            num += Math.round((this.slutLvl - 100) * 0.08);
        }
        else {
            num += 13;
            num += Math.round((this.slutLvl - 200) * 0.1);
        }
    }
    return CC_Mod.Tweaks.Game_Actor_paramBase.call(this, paramId) + num;
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Enemy Ejaculation Stock
//////////////////////////////////////////////////////////////

// This section doesn't work consistently, disabled for now until
// I have more time to research on when enemies are setup
// Need to locate the moment the enemy entity is created
// And probably hook into how names adjust stats
// Note: ejaculation amount (and stock?) seems tied into enemy energy level somehow

// TODO: All enemies need to finish ejaculation before battle can end
//  when Karryn at 0 stamina/energy
//  see BattleManager.checkBattleEnd and isAllOutOfEjaculationStock()

// TODO in this section: also modify volume

CC_Mod.CCMod_modifyDataEjaculationStock = function(actor) {
    if (CCMod_moreEjaculationStock_Enabled) {
        if (true || Math.random() <= CCMod_moreEjaculationStock_Chance) {
            actor._ejaculationStock += Math.randomInt(CCMod_moreEjaculationStock_Max) + CCMod_moreEjaculationStock_Min;

            //actor.enemy().dataEjaculationStock += 1000;
            //actor.enemy().dataEjaculationAmt += 1000;

            actor._ejaculationStock += 1000;
        }
    }
    actor._ejaculationStock += 10000;
    actor._ejaculationVolume += 10000;
};
/*
(function(setupEjaculation) {
    Game_Enemy.prototype.setupEjaculation = function() {
        setupEjaculation.call(this);
        CC_Mod.CCMod_modifyDataEjaculationStock(this);
    };
}(Game_Enemy.prototype.setupEjaculation));
*/

CC_Mod.CCMod_modifyBaseDataEjaculationStock = function(group) {
	for (var n = 1; n < group.length; n++) {
		var obj = group[n];

        obj.dataEjaculationAmt += 1000;
        obj.dataEjaculationStock += 1000;
    }
};

/*
(function(processRemTMNotetags_RemtairyEnemy) {
    DataManager.processRemTMNotetags_RemtairyEnemy = function(group) {
        processRemTMNotetags_RemtairyEnemy.call(this, group);
        CC_Mod.CCMod_modifyBaseDataEjaculationStock(group);
    };
}(DataManager.processRemTMNotetags_RemtairyEnemy));
*/

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Willpower Min Cost and Loss on Orgasm
//////////////////////////////////////////////////////////////

// This is in addition to the base function
CC_Mod.CCMod_dmgFormula_basicFemaleOrgasm = function(actor) {
    if (!CCMod_willpowerLossOnOrgasm) {
        return;
    }

    let willpowerLossMult = CCMod_willpowerLossOnOrgasm_BaseLossMult;

    if (CCMod_willpowerLossOnOrgasm_UseEdicts) {
        // Specializations added in 0.6 add +2 to this count if chosen
        let edictCount = actor.karrynTrainingEdictsCount_Mind();
        if (edictCount > 0) {
            willpowerLossMult = willpowerLossMult * (1 / edictCount);
        }
        // Always lose at least this much, set MinLossMult to 0 to ignore
        if (willpowerLossMult < CCMod_willpowerLossOnOrgasm_MinLossMult) {
            willpowerLossMult = CCMod_willpowerLossOnOrgasm_MinLossMult;
        }
    }

    let willpowerLoss = actor.maxwill * willpowerLossMult;
    willpowerLoss = Math.round(willpowerLoss);
    if (actor.will < willpowerLoss) {
        willpowerLoss = actor.will;
    }

    actor.gainWill(-willpowerLoss);
};

CC_Mod.Tweaks.Game_Actor_dmgFormula_basicFemaleOrgasm = Game_Actor.prototype.dmgFormula_basicFemaleOrgasm;
Game_Actor.prototype.dmgFormula_basicFemaleOrgasm = function(orgasmSkillId) {
    CC_Mod.CCMod_dmgFormula_basicFemaleOrgasm(this);
    return CC_Mod.Tweaks.Game_Actor_dmgFormula_basicFemaleOrgasm.call(this, orgasmSkillId);
};

Game_Actor.prototype.CCMod_calculateWillSkillCost = function(baseCost, skill) {
	let count = this._willSkillsUsed;
	let cost = baseCost;

    // Force minimum cost here
    cost = Math.max(cost, CCMod_willpowerCost_Min);

	if (count != 0) {
		cost += 5 * count;
	}

	if(this.isHorny && this.hasPassive(PASSIVE_HORNY_COUNT_TWO_ID)) {
		let skillId = skill.id;
        if(skillId === SKILL_SUPPRESS_MOUTH_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_BOOBS_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_PUSSY_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_BUTT_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_COCK_DESIRE_ID) {
                cost += 10;
        }
	}

	return Math.round(cost * this.wsc);
};

CC_Mod.Tweaks.Game_Actor_calculateWillSkillCost = Game_Actor.prototype.calculateWillSkillCost;
Game_Actor.prototype.calculateWillSkillCost = function(baseCost, skill) {
    if (!CCMod_willpowerCost_Enabled) {
        return CC_Mod.Tweaks.Game_Actor_calculateWillSkillCost.call(this, baseCost, skill);
    }

    if (CCMod_willpowerCost_Min_ResistOnly) {
        let isSuppressSkill = false;
        let skillId = skill.id;
        if(skillId === SKILL_SUPPRESS_MOUTH_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_BOOBS_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_PUSSY_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_BUTT_DESIRE_ID ||
            skillId === SKILL_SUPPRESS_COCK_DESIRE_ID) {
                isSuppressSkill = true;
        }
        if (isSuppressSkill) {
            return this.CCMod_calculateWillSkillCost(baseCost, skill);
        } else {
            return CC_Mod.Tweaks.Game_Actor_calculateWillSkillCost.call(this, baseCost, skill);
        }
    }
    return this.CCMod_calculateWillSkillCost(baseCost, skill);
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Side jobs
//////////////////////////////////////////////////////////////

// Set minumum level of reputation

// Waitress
CC_Mod.Tweaks.Game_Party_setBarReputation = Game_Party.prototype.setBarReputation;
Game_Party.prototype.setBarReputation = function(value) {
    value = Math.max(CCMod_sideJobReputationMin_Waitress, value);
    if (value > this._barReputation) {
        value += CCMod_sideJobReputationExtra_Waitress;
    }
    CC_Mod.Tweaks.Game_Party_setBarReputation.call(this, value);
};

// Secretary has 3 stats
CC_Mod.Tweaks.Game_Party_setReceptionistSatisfaction = Game_Party.prototype.setReceptionistSatisfaction;
Game_Party.prototype.setReceptionistSatisfaction = function(value) {
    value = Math.max(CCMod_sideJobReputationMin_Secretary, value);
    if (value > this._receptionistSatisfaction) {
        value += CCMod_sideJobReputationExtra_Secretary;
    }
    CC_Mod.Tweaks.Game_Party_setReceptionistSatisfaction.call(this, value);
};

CC_Mod.Tweaks.Game_Party_setReceptionistFame = Game_Party.prototype.setReceptionistFame;
Game_Party.prototype.setReceptionistFame = function(value) {
    value = Math.max(CCMod_sideJobReputationMin_Secretary, value);
    if (value > this._receptionistFame) {
        value += CCMod_sideJobReputationExtra_Secretary;
    }
    CC_Mod.Tweaks.Game_Party_setReceptionistFame.call(this, value);
};

CC_Mod.Tweaks.Game_Party_setReceptionistNotoriety = Game_Party.prototype.setReceptionistNotoriety;
Game_Party.prototype.setReceptionistNotoriety = function(value) {
    value = Math.max(CCMod_sideJobReputationMin_Secretary, value);
    if (value > this._receptionistNotoriety) {
        value += CCMod_sideJobReputationExtra_Secretary;
    }
    CC_Mod.Tweaks.Game_Party_setReceptionistNotoriety.call(this, value);
};

CC_Mod.Tweaks.Game_Party_setGloryReputation = Game_Party.prototype.setGloryReputation;
Game_Party.prototype.setGloryReputation = function(value) {
    value = Math.max(CCMod_sideJobReputationMin_Glory, value);
    if (value > this._gloryReputation) {
        value += CCMod_sideJobReputationExtra_Glory;
    }
    CC_Mod.Tweaks.Game_Party_setGloryReputation.call(this, value);
};

// Extend grace period before job reputation begins to decay
CC_Mod.Tweaks.Game_Party_resetSpecialBattles = Game_Party.prototype.resetSpecialBattles;
Game_Party.prototype.resetSpecialBattles = function() {
    CC_Mod.Tweaks.Game_Party_resetSpecialBattles.call(this);

    if (CCMod_sideJobDecay_Enabled) {
        let actor = $gameActors.actor(ACTOR_KARRYN_ID);

        // Waitress
        if (this._daysWithoutDoingWaitressBar == 0) {
            actor._CCMod_sideJobDecay_GraceWaitress = CCMod_sideJobDecay_ExtraGracePeriod;
        } else {
            actor._CCMod_sideJobDecay_GraceWaitress--;
            if (actor._CCMod_sideJobDecay_GraceWaitress > 0) {
                this._daysWithoutDoingWaitressBar = 0;
            }
        }

        // Receptionist
        if (this._daysWithoutDoingVisitorReceptionist == 0) {
            actor._CCMod_sideJobDecay_GraceReceptionist = CCMod_sideJobDecay_ExtraGracePeriod;
        } else {
            actor._CCMod_sideJobDecay_GraceReceptionist--;
            if (actor._CCMod_sideJobDecay_GraceReceptionist > 0) {
                this._daysWithoutDoingVisitorReceptionist = 0;
            }
        }

        // Glory hole
        // Waiting on v7!
        if (this._daysWithoutVisitingGlory == 0) {
            actor._CCMod_sideJobDecay_GraceGlory = CCMod_sideJobDecay_ExtraGracePeriod;
        } else {
            actor._CCMod_sideJobDecay_GraceGlory--;
            if (actor._CCMod_sideJobDecay_GraceGlory > 0) {
                this._daysWithoutVisitingGlory = 0;
            }
        }

        // Stripper
        // Waiting on v8?

    }
};

//////////////////////////////////////////////////////////////
// Waitress Job Tweaks

// TODO in this section: change balance of asking for drinks vs flashing
//                       easier boob desire requirement for flashing by making drunk count more

// Basically never need to use Breather action in bar, so up the costs a bit
CC_Mod.Tweaks.Game_Actor_skillCost_waitressServeDrink = Game_Actor.prototype.skillCost_waitressServeDrink;
Game_Actor.prototype.skillCost_waitressServeDrink = function() {
    return CC_Mod.Tweaks.Game_Actor_skillCost_waitressServeDrink.call(this) * CCMod_waitressStaminaCostMult;
};

CC_Mod.Tweaks.Game_Actor_skillCost_moveToTable = Game_Actor.prototype.skillCost_moveToTable;
Game_Actor.prototype.skillCost_moveToTable = function() {
    return CC_Mod.Tweaks.Game_Actor_skillCost_moveToTable.call(this) * CCMod_waitressStaminaCostMult;
};

// The base cost for this one is 2x the moveToTable cost, which has the base mult already applied
CC_Mod.Tweaks.Game_Actor_skillCost_returnToBar = Game_Actor.prototype.skillCost_returnToBar;
Game_Actor.prototype.skillCost_returnToBar = function() {
    return CC_Mod.Tweaks.Game_Actor_skillCost_returnToBar.call(this) * CCMod_waitressStaminaCostMult_ReturnToBarExtra;
};

CC_Mod.Tweaks.Game_Troop_setupWaitressBattle = Game_Troop.prototype.setupWaitressBattle;
Game_Troop.prototype.setupWaitressBattle = function(troopId) {
    CC_Mod.Tweaks.Game_Troop_setupWaitressBattle.call(this, troopId);
    this._nextEnemySpawnChance += CCMod_extraBarSpawnChance;
};

CC_Mod.Tweaks.Game_Troop_onTurnEndSpecial_waitressBattle = Game_Troop.prototype.onTurnEndSpecial_waitressBattle;
Game_Troop.prototype.onTurnEndSpecial_waitressBattle = function(forceSpawn) {
    CC_Mod.Tweaks.Game_Troop_onTurnEndSpecial_waitressBattle.call(this, forceSpawn);
    this._nextEnemySpawnChance += CCMod_extraBarSpawnChance;
};

// waitressBattle_flashRequirementMet

// waitressBattle_getNewTimeLimit
// Instead of messing with time limit, change patience level to avoid angry
CC_Mod.Tweaks.Game_Enemy_enemyBattleAIWaitressServing = Game_Enemy.prototype.enemyBattleAIWaitressServing;
Game_Enemy.prototype.enemyBattleAIWaitressServing = function(target) {
    if (CCMod_minimumBarPatience > 0 && this._bar_patiences < CCMod_minimumBarPatience) {
        this._bar_patiences = CCMod_minimumBarPatience;
    }
    if (CC_Mod.CCMod_angryCustomerForgivenessCounter > 0 && this._bar_patiences <= 0) {
        CC_Mod.CCMod_angryCustomerForgivenessCounter -= 1;
        if (CC_Mod.CCMod_angryCustomerForgivenessCounter <= 0) {
            CC_Mod.CCMod_angryCustomerForgivenessCounter = CCMod_angryCustomerForgivenessCounterBase;
        }
        this._bar_patiences = 1;
    }
    CC_Mod.Tweaks.Game_Enemy_enemyBattleAIWaitressServing.call(this, target);
};

CC_Mod.CCMod_rejectAlcoholWillCost = function(actor) {
    let pleasureMod = 1 + (Karryn.currentPercentOfOrgasm() / 100);
    let fatigueMod = 1 + actor.getFatigueLevel() * 0.1
    // wsc is overall will skill cost multiplier
    let mult = CCMod_alcoholRejectWillCostMult * pleasureMod * fatigueMod * actor.wsc;

    let cost = Math.round(actor.maxwill * mult);
    if (cost > actor.maxwill) {
        cost = actor.maxwill;
    }
    return cost;
};

CC_Mod.Tweaks.Game_Actor_rejectAlcoholWillCost = Game_Actor.prototype.rejectAlcoholWillCost;
Game_Actor.prototype.rejectAlcoholWillCost = function() {
    if (!CCMod_alcoholRejectCostEnabled) {
        return CC_Mod.Tweaks.Game_Actor_rejectAlcoholWillCost.call(this);
    }
    return CC_Mod.CCMod_rejectAlcoholWillCost(this);
};

// To modify desired drink this function would require a full overwrite
// Game_Actor.prototype.afterEval_tableTakeOrder
// This will modify preferred drink which has a very high chance of being chosen with a simple addition
// Game_Enemy.prototype.setupForWaitressBattle

CC_Mod.Tweaks.Game_Enemy_setupForWaitressBattle = Game_Enemy.prototype.setupForWaitressBattle;
Game_Enemy.prototype.setupForWaitressBattle = function() {
    CC_Mod.Tweaks.Game_Enemy_setupForWaitressBattle.call(this);
    if (CCMod_easierDrinkSelection) {
        let prefDrink = ALCOHOL_TYPE_PALE_ALE;
        if(Karryn.hasEdict(EDICT_BAR_DRINK_MENU_I)) {
            prefDrink = ALCOHOL_TYPE_GOLD_RUM;
        }
        if(Karryn.hasEdict(EDICT_BAR_DRINK_MENU_II)) {
            prefDrink = ALCOHOL_TYPE_WHISKEY;
        }
        if(Karryn.hasEdict(EDICT_BAR_DRINK_MENU_III)) {
            prefDrink = ALCOHOL_TYPE_TEQUILA;
        }
        this._bar_preferredDrink = prefDrink;
    }
};

//////////////////////////////////////////////////////////////
// Receptionist Job Tweaks

// TODO: Shorter handshakes
// See setupForReceptionistBattle_fan and _fan_turnsUntilRequestFinished

CC_Mod.Tweaks.Game_Troop_setupReceptionistBattle = Game_Troop.prototype.setupReceptionistBattle;
Game_Troop.prototype.setupReceptionistBattle = function(troopId) {
    CC_Mod.Tweaks.Game_Troop_setupReceptionistBattle.call(this);

    if (CCMod_receptionistMoreGoblins_Enabled) {
        this._goblins_spawned_max += CCMod_receptionistMoreGoblins_NumExtra;
    }
};

CC_Mod.Tweaks.Game_Troop_receptionistBattle_nextGoblinSpawnTime = Game_Troop.prototype.receptionistBattle_nextGoblinSpawnTime;
Game_Troop.prototype.receptionistBattle_nextGoblinSpawnTime = function() {
    let spawnTimeMult = CC_Mod.Tweaks.Game_Troop_receptionistBattle_nextGoblinSpawnTime.call(this);
    spawnTimeMult *= CCMod_receptionistMoreGoblins_SpawnTimeMult;
    return spawnTimeMult;
};

// Add bonus points towards getting more goblins to spawn easier
// Wrapper function to set a flag
CC_Mod.Tweaks.Game_Troop_receptionistBattle_spawnGoblin = Game_Troop.prototype.receptionistBattle_spawnGoblin;
Game_Troop.prototype.receptionistBattle_spawnGoblin = function(forceSpawn) {
    if (CCMod_receptionistMoreGoblins_Enabled) {
        CC_Mod.CCMod_bonusReactionScoreEnabled = true;
    }
    let goblin = CC_Mod.Tweaks.Game_Troop_receptionistBattle_spawnGoblin.call(this, forceSpawn);
    CC_Mod.CCMod_bonusReactionScoreEnabled = false;
    return goblin;
};

// Add bonus reaction score only when called from above function
CC_Mod.Tweaks.Game_Actor_reactionScore_enemyGoblinPassive = Game_Actor.prototype.reactionScore_enemyGoblinPassive;
Game_Actor.prototype.reactionScore_enemyGoblinPassive = function() {
    let score = CC_Mod.Tweaks.Game_Actor_reactionScore_enemyGoblinPassive.call(this);
    if (CC_Mod.CCMod_bonusReactionScoreEnabled) {
        score += CCMod_receptionistMoreGoblins_MaxGoblinsActiveBonus;
    }
    return score;
};

// Add mult to stamina restored from breather
CC_Mod.Tweaks.Game_Actor_dmgFormula_receptionistBattle_Breather = Game_Actor.prototype.dmgFormula_receptionistBattle_Breather;
Game_Actor.prototype.dmgFormula_receptionistBattle_Breather = function() {
    let staminaRestored = CC_Mod.Tweaks.Game_Actor_dmgFormula_receptionistBattle_Breather.call(this);
    staminaRestored = Math.round(staminaRestored * CCMod_receptionistBreatherStaminaRestoreMult);
    return staminaRestored;
};

// Visitor to male/pervert conversions
CC_Mod.Tweaks.Game_Troop_receptionistBattle_validVisitorId = Game_Troop.prototype.receptionistBattle_validVisitorId;
Game_Troop.prototype.receptionistBattle_validVisitorId = function() {
    /*
        IDs
        162 Male Visitor Normal
        163 Female Visitor Normal
        164 Male Visitor Slow
        165 Female Visitor Slow
        166 Male Visitor Fast
        167 Female Visitor Fast
        168 Male Fan
        169 Female Fan
        170 Male Perv Slow
        171 Male Perv Normal
        172 Male Perv Fast
    */
    let maleId   = [ 162, 164, 166, 168 ];
    let femaleId = [ 163, 165, 167, 169 ];
    let pervId   = [ 170, 171, 172 ];

    let visitorId = CC_Mod.Tweaks.Game_Troop_receptionistBattle_validVisitorId.call(this);

    if (femaleId.includes(visitorId) && (Math.random() < CCMod_receptionistMorePerverts_femaleConvertChance)) {
        visitorId = maleId[Math.randomInt(maleId.length)];
    }

    if (!pervId.includes(visitorId) && (Math.random() < CCMod_receptionistMorePerverts_extraSpawnChance)) {
        visitorId = pervId[Math.randomInt(pervId.length)];
    }

    return visitorId;
};

// Modify desire requirement for pervert request
CC_Mod.Tweaks.Game_Actor_customReq_receptionistBattle_acceptRequest = Game_Actor.prototype.customReq_receptionistBattle_acceptRequest;
Game_Actor.prototype.customReq_receptionistBattle_acceptRequest = function() {
    CC_Mod.CCMod_easierPervRequestFlag = true;
    let meetConditions = CC_Mod.Tweaks.Game_Actor_customReq_receptionistBattle_acceptRequest.call(this);
    CC_Mod.CCMod_easierPervRequestFlag = false;
    return meetConditions;
};

CC_Mod.Tweaks.Game_Actor_boobsPettingBoobsDesireRequirement = Game_Actor.prototype.boobsPettingBoobsDesireRequirement;
Game_Actor.prototype.boobsPettingBoobsDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_boobsPettingBoobsDesireRequirement.call(this, karrynSkillUse);
    if (CC_Mod.CCMod_easierPervRequestFlag) {
        req *= CCMod_receptionistMorePerverts_desireMult;
    }
    return req;
};

CC_Mod.Tweaks.Game_Actor_kissingMouthDesireRequirement = Game_Actor.prototype.kissingMouthDesireRequirement;
Game_Actor.prototype.kissingMouthDesireRequirement = function(kissingLvl, karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_kissingMouthDesireRequirement.call(this, karrynSkillUse);
    if (CC_Mod.CCMod_easierPervRequestFlag) {
        req *= CCMod_receptionistMorePerverts_desireMult;
    }
    return req;
};

CC_Mod.Tweaks.Game_Actor_handjobCockDesireRequirement = Game_Actor.prototype.handjobCockDesireRequirement;
Game_Actor.prototype.handjobCockDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_handjobCockDesireRequirement.call(this, karrynSkillUse);
    if (CC_Mod.CCMod_easierPervRequestFlag) {
        req *= CCMod_receptionistMorePerverts_desireMult;
    }
    return req;
};

CC_Mod.Tweaks.Game_Actor_blowjobMouthDesireRequirement = Game_Actor.prototype.blowjobMouthDesireRequirement;
Game_Actor.prototype.blowjobMouthDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_blowjobMouthDesireRequirement.call(this, karrynSkillUse);
    if (CC_Mod.CCMod_easierPervRequestFlag) {
        req *= CCMod_receptionistMorePerverts_desireMult;
    }
    return req;
};

CC_Mod.Tweaks.Game_Actor_blowjobCockDesireRequirement = Game_Actor.prototype.blowjobCockDesireRequirement;
Game_Actor.prototype.blowjobCockDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_blowjobCockDesireRequirement.call(this, karrynSkillUse);
    if (CC_Mod.CCMod_easierPervRequestFlag) {
        req *= CCMod_receptionistMorePerverts_desireMult;
    }
    return req;
};

//////////////////////////////////////////////////////////////
// Glory Hole Job Tweaks

// Just some potentially interesting functions to look at in the future

// Game_Troop.prototype.calculateGloryGuestsSpawnLimit
// Game_Troop.prototype.gloryBattle_calculateChanceToSpawnGuest
// Game_Troop.prototype.gloryBattle_calculateChanceForSpawnedGuestIsHereForHole
// Game_Troop.prototype.gloryBattle_spawnGuest

// Game_Enemy.prototype.setupForGloryBattle_Guest
// Game_Enemy.prototype.gloryBattle_calculatePatience
// Game_Enemy.prototype.bonusPpt_gloryBattle

//////////////////////////////////////////////////////////////
// Stripper Job Tweaks

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Panty Loss Tweaks
//////////////////////////////////////////////////////////////

// This is the chance to lose panties after a battle is finished where Karryn was stripped
// Function Overwrite
CC_Mod.Tweaks.Game_Actor_passiveStripOffPanties_losePantiesEffect = Game_Actor.prototype.passiveStripOffPanties_losePantiesEffect;
Game_Actor.prototype.passiveStripOffPanties_losePantiesEffect = function() {
	let loseChance = 0;

    if (CCMod_losePantiesEasier_Enabled) {
        loseChance = CCMod_losePantiesEasier_baseChance;
    }

	if(this.hasPassive(PASSIVE_PANTIES_STRIPPED_ONE_ID)) loseChance += 0.1;
	if(this.hasPassive(PASSIVE_PANTIES_STRIPPED_TWO_ID)) loseChance += 0.15;

    if(this.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_ONE_ID)) loseChance += 0.15;
    if(this.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID)) loseChance += 0.20;

	if(Math.random() < loseChance)
		this._lostPanties = true;
};

// Chance to wake up with no panties
// Function Overwrite
CC_Mod.Tweaks.Game_Actor_passiveWakeUp_losePantiesEffect = Game_Actor.prototype.passiveWakeUp_losePantiesEffect;
Game_Actor.prototype.passiveWakeUp_losePantiesEffect = function() {
	let loseChance = 0;

    if (CCMod_losePantiesEasier_Enabled) {
        loseChance = CCMod_losePantiesEasier_baseChanceWakeUp;
    }

	if(this.hasPassive(PASSIVE_PANTIES_STRIPPED_THREE_ID)) loseChance += 0.25;

    if(this.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_ONE_ID)) loseChance += 0.10;
    if(this.hasPassive(CCMOD_PASSIVE_EXHIBITIONIST_TWO_ID)) loseChance += 0.20;

	if(Math.random() < loseChance) {
		this._lostPanties = true;
		this.takeOffPanties();
	}
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Desire Requirement Tweaks
//////////////////////////////////////////////////////////////

// Removes the effect of virginity on the requirement
CC_Mod.Tweaks.Game_Actor_pussyCreampieCockDesireRequirement = Game_Actor.prototype.pussyCreampieCockDesireRequirement;
Game_Actor.prototype.pussyCreampieCockDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_pussyCreampieCockDesireRequirement.call(this, karrynSkillUse);
    if (CCMod_easierCreampieCockDesireRequirements) {
        if (!this.hasPassive(PASSIVE_FIRST_SEX_ID)) {
            req -= 50;
        }
    }
    return req;
};

CC_Mod.Tweaks.Game_Actor_analCreampieCockDesireRequirement = Game_Actor.prototype.analCreampieCockDesireRequirement;
Game_Actor.prototype.analCreampieCockDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_analCreampieCockDesireRequirement.call(this, karrynSkillUse);
    if (CCMod_easierCreampieCockDesireRequirements) {
        if (!this.hasPassive(PASSIVE_FIRST_ANAL_ID)) {
            req -= 50;
        }
    }
    return req;
};

// Petting actions for receptionist
CC_Mod.Tweaks.Game_Actor_clitPettingPussyDesireRequirement = Game_Actor.prototype.clitPettingPussyDesireRequirement;
Game_Actor.prototype.clitPettingPussyDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_clitPettingPussyDesireRequirement.call(this, karrynSkillUse);

    if(this.isInReceptionistPose()) {
        req *= CCMod_easierReceptionistPettingActionsMult;
    }

    return req;
};

CC_Mod.Tweaks.Game_Actor_buttPettingButtDesireRequirement = Game_Actor.prototype.buttPettingButtDesireRequirement;
Game_Actor.prototype.buttPettingButtDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_buttPettingButtDesireRequirement.call(this, karrynSkillUse);

    if(this.isInReceptionistPose()) {
        req *= CCMod_easierReceptionistPettingActionsMult;
    }

    return req;
};

// Decrease side job penalty
CC_Mod.Tweaks.Game_Actor_jobDesireRequirementMultipler = Game_Actor.prototype.jobDesireRequirementMultipler;
Game_Actor.prototype.jobDesireRequirementMultipler = function() {
    let mult = CC_Mod.Tweaks.Game_Actor_jobDesireRequirementMultipler.call(this);

    if (this.isInJobPose()) {
        mult *= CCMod_easierSideJobDesirePenaltyMult;
    }

    return mult;
};

// Enemy jerkoff pleasure adjustment

CC_Mod.CCMod_jerkingOffPleasureAdjustment = function(target, jerkingOff) {
    if(!jerkingOff) jerkingOff = false;
    if (jerkingOff) {
        let result = target.result();
        let currentFeedback = result.pleasureFeedback;
        if (currentFeedback > 0) {
            currentFeedback *= CCMod_enemyJerkingOffPleasureGainMult;
            if (target.isInJobPose()) {
                currentFeedback *= CCMod_enemyJerkingOffPleasureGainMult_SideJobs;
            }
            currentFeedback = Math.round(currentFeedback);
        }
        result.pleasureFeedback = currentFeedback;
    }
};

CC_Mod.Tweaks.Game_Enemy_dmgFormula_basicTalk = Game_Enemy.prototype.dmgFormula_basicTalk;
Game_Enemy.prototype.dmgFormula_basicTalk = function(target, area, jerkingOff) {
    let dmg = CC_Mod.Tweaks.Game_Enemy_dmgFormula_basicTalk.call(this, target, area, jerkingOff);
    CC_Mod.CCMod_jerkingOffPleasureAdjustment(target, jerkingOff);
    return dmg;
};

CC_Mod.Tweaks.Game_Enemy_dmgFormula_basicSight = Game_Enemy.prototype.dmgFormula_basicSight;
Game_Enemy.prototype.dmgFormula_basicSight = function(target, sightType, jerkingOff) {
    let dmg = CC_Mod.Tweaks.Game_Enemy_dmgFormula_basicTalk.call(this, target, sightType, jerkingOff);
    CC_Mod.CCMod_jerkingOffPleasureAdjustment(target, jerkingOff);
    return dmg;
};

// Lower kick counter desire requirements
CC_Mod.Tweaks.Game_Enemy_counterCondition_kickCounter = Game_Enemy.prototype.counterCondition_kickCounter;
Game_Enemy.prototype.counterCondition_kickCounter = function(target, action) {
    if (CCMod_easierKickCounterRequirements) {
        CC_Mod.CCMod_easierKickCounterRequirementsFlag = true;
    }
    let chance = CC_Mod.Tweaks.Game_Enemy_counterCondition_kickCounter.call(this, target, action);
    CC_Mod.CCMod_easierKickCounterRequirementsFlag = false;
    return chance;
};

CC_Mod.Tweaks.Game_Actor_pussySexPussyDesireRequirement = Game_Actor.prototype.pussySexPussyDesireRequirement;
Game_Actor.prototype.pussySexPussyDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_pussySexPussyDesireRequirement.call(this, karrynSkillUse);

    if (CC_Mod.CCMod_easierKickCounterRequirementsFlag) {
        req *= CCMod_easierKickCounterRequirements_DesireMult;
    }

    return req;
};

CC_Mod.Tweaks.Game_Actor_pussySexCockDesireRequirement = Game_Actor.prototype.pussySexCockDesireRequirement;
Game_Actor.prototype.pussySexCockDesireRequirement = function(karrynSkillUse) {
    let req = CC_Mod.Tweaks.Game_Actor_pussySexCockDesireRequirement.call(this, karrynSkillUse);

    if (CC_Mod.CCMod_easierKickCounterRequirementsFlag) {
        req *= CCMod_easierKickCounterRequirements_DesireMult;
    }

    return req;
};

// Let fatigue globally lower desire requirements
CC_Mod.Tweaks.Game_Actor_vulnerabilityDesireRequirementMultipler = Game_Actor.prototype.vulnerabilityDesireRequirementMultipler;
Game_Actor.prototype.vulnerabilityDesireRequirementMultipler = function(karrynSkillUse) {
    let mult = CC_Mod.Tweaks.Game_Actor_vulnerabilityDesireRequirementMultipler.call(this, karrynSkillUse);

    mult *= Math.max(0, 1 - (this._fatigue / 100 * CCMod_globalFatigueDesireMult));

    return mult;
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Defeat Cheat
//////////////////////////////////////////////////////////////

CC_Mod.Tweaks.Game_Actor_showEval_giveUp = Game_Actor.prototype.showEval_giveUp;
Game_Actor.prototype.showEval_giveUp = function() {
    if (!CCMod_defeat_SurrenderSkillsAlwaysEnabled) {
        return CC_Mod.Tweaks.Game_Actor_showEval_giveUp.call(this);
    }
	return !this.isInJobPose() && !this.hasNoStamina();
};

// Function Overwrite
CC_Mod.Tweaks.Game_Actor_showEval_surrender = Game_Actor.prototype.showEval_surrender;
Game_Actor.prototype.showEval_surrender = function() {
    if (!CCMod_defeat_SurrenderSkillsAlwaysEnabled) {
        return CC_Mod.Tweaks.Game_Actor_showEval_surrender.call(this);
    }
	return !this.isInJobPose() && this.hasNoStamina();
};

CC_Mod.Tweaks.Game_Actor_preDefeatedBattleSetup = Game_Actor.prototype.preDefeatedBattleSetup;
Game_Actor.prototype.preDefeatedBattleSetup = function() {
    CC_Mod.Tweaks.Game_Actor_preDefeatedBattleSetup.call(this);

    if (CCMod_defeat_StartWithZeroStamEnergy) {
        this.setHp(0);
        this.setMp(0);
    }
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Mod: Order
//////////////////////////////////////////////////////////////
CC_Mod.Tweaks.Game_Party_setOrder = Game_Party.prototype.setOrder;
Game_Party.prototype.setOrder = function(value) {
    if (CCMod_orderCheat_Enabled) {
        value = Math.round(value.clamp(CCMod_orderCheat_MinOrder,CCMod_orderCheat_MaxOrder));
        Prison.order = value;
    }
    CC_Mod.Tweaks.Game_Party_setOrder.call(this, value);
};

CC_Mod.Tweaks.Game_Party_increaseDaysInAnarchy = Game_Party.prototype.increaseDaysInAnarchy;
Game_Party.prototype.increaseDaysInAnarchy = function() {
    if (CCMod_orderCheat_preventAnarchyIncrease) {
        return;
    }
    CC_Mod.Tweaks.Game_Party_increaseDaysInAnarchy.call(this);
};

// Cap negative control
CC_Mod.Tweaks.Game_Party_orderChangeRiotManager = Game_Party.prototype.orderChangeRiotManager;
Game_Party.prototype.orderChangeRiotManager = function() {
    let orderChange = CC_Mod.Tweaks.Game_Party_orderChangeRiotManager.call(this);
    orderChange = Math.max(orderChange, CCMod_orderCheat_maxControlLossFromRiots);
    return orderChange;
};

// Multiplier for negative control
CC_Mod.Tweaks.Game_Party_orderChangeValue = Game_Party.prototype.orderChangeValue;
Game_Party.prototype.orderChangeValue = function() {
    let control = CC_Mod.Tweaks.Game_Party_orderChangeValue.call(this);
    if (control < 0) {
        control = Math.round(control * CCMod_orderCheat_NegativeControlMult);
    }
    return control;
};

// Riot buildup
CC_Mod.Tweaks.Game_Party_prisonGlobalRiotChance = Game_Party.prototype.prisonGlobalRiotChance;
Game_Party.prototype.prisonGlobalRiotChance = function(useOnlyTodaysGoldForBankruptcyChance) {
    let chance = CC_Mod.Tweaks.Game_Party_prisonGlobalRiotChance.call(this, useOnlyTodaysGoldForBankruptcyChance);
    return chance;
};

CC_Mod.Tweaks.Game_Party_prisonLevelOneRiotChance = Game_Party.prototype.prisonLevelOneRiotChance;
Game_Party.prototype.prisonLevelOneRiotChance = function() {
    let chance = CC_Mod.Tweaks.Game_Party_prisonLevelOneRiotChance.call(this);
    chance *= CCMod_orderCheat_riotBuildupMult;
    return chance;
};

CC_Mod.Tweaks.Game_Party_prisonLevelTwoRiotChance = Game_Party.prototype.prisonLevelTwoRiotChance;
Game_Party.prototype.prisonLevelTwoRiotChance = function() {
    let chance = CC_Mod.Tweaks.Game_Party_prisonLevelTwoRiotChance.call(this);
    chance *= CCMod_orderCheat_riotBuildupMult;
    return chance;
};

CC_Mod.Tweaks.Game_Party_prisonLevelThreeRiotChance = Game_Party.prototype.prisonLevelThreeRiotChance;
Game_Party.prototype.prisonLevelThreeRiotChance = function() {
    let chance = CC_Mod.Tweaks.Game_Party_prisonLevelThreeRiotChance.call(this);
    chance *= CCMod_orderCheat_riotBuildupMult;
    return chance;
};

CC_Mod.Tweaks.Game_Party_prisonLevelFourRiotChance = Game_Party.prototype.prisonLevelFourRiotChance;
Game_Party.prototype.prisonLevelFourRiotChance = function() {
    let chance = CC_Mod.Tweaks.Game_Party_prisonLevelFourRiotChance.call(this);
    chance *= CCMod_orderCheat_riotBuildupMult;
    return chance;
};

CC_Mod.Tweaks.Game_Party_prisonLevelFiveRiotChance = Game_Party.prototype.prisonLevelFiveRiotChance;
Game_Party.prototype.prisonLevelFiveRiotChance = function() {
    let chance = CC_Mod.Tweaks.Game_Party_prisonLevelFiveRiotChance.call(this);
    chance *= CCMod_orderCheat_riotBuildupMult;
    return chance;
};

//=============================================================================
//////////////////////////////////////////////////////////////
// Utility Functions
//////////////////////////////////////////////////////////////
CC_Mod.CCMod_advanceNextDay = function(party) {
    let actor = $gameActors.actor(ACTOR_KARRYN_ID);
    CC_Mod.fertilityCycle_NextDay();
    CC_Mod.Gyaru_advanceNextDay(actor);

    if (actor._CCMod_defeatStripped == false) {
        CC_Mod.cleanAndRestoreKarryn();
        CC_Mod.exhibitionist_wakeUpNakedEffect(actor);
    }
    actor._CCMod_defeatStripped = false;
};

CC_Mod.Tweaks.Game_Party_advanceNextDay = Game_Party.prototype.advanceNextDay;
Game_Party.prototype.advanceNextDay = function() {
    // This skips the cleanUpLiquids call in the original function call
    // It is called at the end of CCMod_advanceNextDay instead
    CC_Mod.CCMod_cleanupFunctionsSkipEnabled = true;
    CC_Mod.Tweaks.Game_Party_advanceNextDay.call(this);
    CC_Mod.CCMod_cleanupFunctionsSkipEnabled = false;
    CC_Mod.CCMod_advanceNextDay(this);
};

// Always enable save
// Function Overwrite
Game_Party.prototype.canOpenSaveMenu = function() {
	return true;
};

CC_Mod.Tweaks.Game_Actor_setupRecords = Game_Actor.prototype.setupRecords;
Game_Actor.prototype.setupRecords = function() {
    CC_Mod.setupModRecords(this);
    CC_Mod.setupPregModRecords(this);
    CC_Mod.setupGyaruRecords(this);
    CC_Mod.Tweaks.Game_Actor_setupRecords.call(this);
};

// Disable autosave
CC_Mod.Tweaks.StorageManager_performAutosave = StorageManager.performAutosave;
StorageManager.performAutosave = function() {
    if (CCMod_disableAutosave) {
        return;
    }
    CC_Mod.Tweaks.StorageManager_performAutosave.call(this);
};

CC_Mod.Tweaks.Game_Actor_checkForNewPassives = Game_Actor.prototype.checkForNewPassives;
Game_Actor.prototype.checkForNewPassives = function() {
    this.CCMod_checkForNewExhibitionistPassives();
    this.CCMod_checkForNewBirthPassives();
    CC_Mod.Tweaks.Game_Actor_checkForNewPassives.call(this);
};

CC_Mod.CCMod_removeLimits = function() {
    if (!CCMod_removeKarrynLimits) {
        return;
    }

    LIMIT_ESCAPE_TOTAL_COUNT = 9999999;

    LIMIT_SUBDUED_ERECT_WITH_ATTACK_COUNT = 9999999;
    LIMIT_SUBDUED_ANGRY_COUNT = 9999999;
    LIMIT_SUBDUED_TOTAL_COUNT = 9999999;

    LIMIT_DEFEATED_TOTAL_COUNT = 9999999;
    LIMIT_DEFEATED_LEVEL_ONE_COUNT = 9999999;
    LIMIT_DEFEATED_LEVEL_TWO_COUNT = 9999999;
    LIMIT_DEFEATED_LEVEL_THREE_COUNT = 9999999;
    LIMIT_DEFEATED_LEVEL_FOUR_COUNT = 9999999;
    LIMIT_DEFEATED_LEVEL_FIVE_COUNT = 9999999;

    LIMIT_INVASION_BATTLE_TOTAL_COUNT = 9999999;
    LIMIT_INVASION_BATTLE_OFFICE_COUNT = 9999999;
    LIMIT_INVASION_BATTLE_LEVEL_ONE_COUNT = 9999999;
    LIMIT_INVASION_BATTLE_LEVEL_TWO_COUNT = 9999999;
    LIMIT_INVASION_BATTLE_LEVEL_THREE_COUNT = 9999999;
    LIMIT_INVASION_BATTLE_LEVEL_FOUR_COUNT = 9999999;
    LIMIT_INVASION_BATTLE_LEVEL_FIVE_COUNT = 9999999;

    LIMIT_MASTURBATED_OFFICE_COUNT = 9999999;
    LIMIT_MASTURBATED_GUARD_STATION_COUNT = 9999999;
    LIMIT_MASTURBATED_TOTAL_COUNT = 9999999;

    LIMIT_FIX_CLOTHES_USAGE_COUNT = 9999999;
    LIMIT_COCK_KICK_USAGE_COUNT = 9999999;
    LIMIT_KISS_USAGE_COUNT = 9999999;
    LIMIT_COCK_STARE_USAGE_COUNT = 9999999;
    LIMIT_COCK_PET_USAGE_COUNT = 9999999;
    LIMIT_HANDJOB_USAGE_COUNT = 9999999;
    LIMIT_BLOWJOB_USAGE_COUNT = 9999999;
    LIMIT_RIMJOB_USAGE_COUNT = 9999999;
    LIMIT_FOOTJOB_USAGE_COUNT = 9999999;
    LIMIT_TITTY_FUCK_USAGE_COUNT = 9999999;
    LIMIT_PUSSY_SEX_USAGE_COUNT = 9999999;
    LIMIT_ANAL_SEX_USAGE_COUNT = 9999999;

    LIMIT_CLOTHES_STRIPPED = 9999999;
    LIMIT_PANTIES_STRIPPED = 9999999;

    LIMIT_KISSED_COUNT = 9999999;
    LIMIT_HANDJOB_COUNT = 9999999;
    LIMIT_BLOWJOB_COUNT = 9999999;
    LIMIT_TITTYFUCK_COUNT = 9999999;
    LIMIT_PUSSYFUCKED_COUNT = 9999999;
    LIMIT_ANALFUCKED_COUNT = 9999999;
    LIMIT_BOOBS_PETTED_COUNT = 9999999;
    LIMIT_NIPPLES_PETTED_COUNT = 9999999;
    LIMIT_BUTT_PETTED_COUNT = 9999999;
    LIMIT_ANAL_PETTED_COUNT = 9999999;
    LIMIT_PUSSY_PETTED_COUNT = 9999999;
    LIMIT_CLIT_PETTED_COUNT = 9999999;
    LIMIT_JOB_PETTED_COUNT = 9999999;

    LIMIT_TALKED_AT_COUNT = 9999999;
    LIMIT_TALKED_COCK_COUNT = 9999999;
    LIMIT_SEEN_MOUTH_COUNT = 9999999;
    LIMIT_SEEN_BOOBS_COUNT = 9999999;
    LIMIT_SEEN_NIPPLES_COUNT = 9999999;
    LIMIT_SEEN_CLIT_COUNT = 9999999;
    LIMIT_SEEN_PUSSY_COUNT = 9999999;
    LIMIT_SEEN_BUTT_COUNT = 9999999;
    LIMIT_SEEN_ANAL_COUNT = 9999999;
    LIMIT_SEEN_ANAL_CREAMPIE_COUNT = 9999999;
    LIMIT_SEEN_PUSSY_CREAMPIE_COUNT = 9999999;
    LIMIT_SEEN_BUKKAKE_FACE_COUNT = 9999999;
    LIMIT_SEEN_BUKKAKE_BOOBS_COUNT = 9999999;
    LIMIT_SEEN_BUKKAKE_BUTT_COUNT = 9999999;
    LIMIT_SEEN_MOUTH_SWALLOW_COUNT = 9999999;
    LIMIT_SEEN_TOTAL_COUNT = 9999999;

    LIMIT_BUTTSPANKED_COUNT = 9999999;
    LIMIT_SEEJERKOFF_COUNT = 9999999;
    LIMIT_FINGERS_SUCKED_COUNT = 9999999;
    LIMIT_CUNNILINGUS_COUNT = 9999999;
    LIMIT_RIMJOB_COUNT = 9999999;
    LIMIT_FOOTJOB_COUNT = 9999999;
    LIMIT_COCK_PETTED_COUNT = 9999999;
    LIMIT_KARRYN_TAUNT_COUNT = 9999999;
    LIMIT_KARRYN_FLAUNT_COUNT = 9999999;
    LIMIT_KARRYN_DOGEZA_COUNT = 9999999;
    LIMIT_COCKINESS_MAX_COUNT = 9999999;
    LIMIT_COCKINESS_GAINED_COUNT = 9999999;

    LIMIT_HORNY_COUNT = 9999999;
    LIMIT_DEBUFF_OFF_BALANCED_COUNT = 9999999;
    LIMIT_DEBUFF_FALLEN_COUNT = 9999999;
    LIMIT_DEBUFF_DISARMED_COUNT = 9999999;
    LIMIT_DEBUFF_DOWN_STAMINA_COUNT = 9999999;

    LIMIT_KISSED_PEOPLE = 9999999;
    LIMIT_HANDJOB_PEOPLE = 9999999;
    LIMIT_BLOWJOB_PEOPLE = 9999999;
    LIMIT_TITTYFUCK_PEOPLE = 9999999;
    LIMIT_PUSSYFUCKED_PEOPLE = 9999999;
    LIMIT_ANALFUCKED_PEOPLE = 9999999;
    LIMIT_BUKKAKE_PEOPLE = 9999999;
    LIMIT_SWALLOW_PEOPLE = 9999999;
    LIMIT_PUSSYCREAMPIE_PEOPLE = 9999999;
    LIMIT_ANALCREAMPIE_PEOPLE = 9999999;
    LIMIT_ORGASMPRESENCE_PEOPLE = 9999999;
    LIMIT_CUNNILINGUS_PEOPLE = 9999999;
    LIMIT_RIMJOB_PEOPLE = 9999999;
    LIMIT_FOOTJOB_PEOPLE = 9999999;
    LIMIT_BUTTSPANKED_PEOPLE = 9999999;
    LIMIT_FINGERS_SUCKED_PEOPLE = 9999999;
    LIMIT_BOOBS_PETTED_PEOPLE = 9999999;
    LIMIT_NIPPLES_PETTED_PEOPLE = 9999999;
    LIMIT_CLIT_PETTED_PEOPLE = 9999999;
    LIMIT_PUSSY_PETTED_PEOPLE = 9999999;
    LIMIT_BUTT_PETTED_PEOPLE = 9999999;
    LIMIT_ANAL_PETTED_PEOPLE = 9999999;
    LIMIT_TALKED_AT_PEOPLE = 9999999;
    LIMIT_TALKED_COCK_PEOPLE = 9999999;
    LIMIT_SEEN_PEOPLE = 9999999;
    LIMIT_SEEJERKOFF_PEOPLE = 9999999;
    LIMIT_COCK_PETTED_PEOPLE = 9999999;
    LIMIT_KARRYN_TAUNT_PEOPLE = 9999999;
    LIMIT_KARRYN_FLAUNT_PEOPLE = 9999999;
    LIMIT_KARRYN_DOGEZA_PEOPLE = 9999999;
    LIMIT_KARRYN_TOYS_INSERTED_BY_ENEMY_PEOPLE = 9999999;

    LIMIT_MOUTH_PLEASURE = 9999999;
    LIMIT_BOOBS_PLEASURE = 9999999;
    LIMIT_NIPPLES_PLEASURE = 9999999;
    LIMIT_PUSSY_PLEASURE = 9999999;
    LIMIT_CLIT_PLEASURE = 9999999;
    LIMIT_BUTT_PLEASURE = 9999999;
    LIMIT_ANAL_PLEASURE = 9999999;
    LIMIT_FINGERS_PLEASURE = 9999999;
    LIMIT_TOYS_PLEASURE = 9999999;
    LIMIT_TALK_PLEASURE = 9999999;
    LIMIT_SIGHT_PLEASURE = 9999999;
    LIMIT_BUKKAKE_PLEASURE = 9999999;
    LIMIT_SWALLOW_PLEASURE = 9999999;
    LIMIT_PUSSYCREAMPIE_PLEASURE = 9999999;
    LIMIT_ANALCREAMPIE_PLEASURE = 9999999;
    LIMIT_MASOCHISM_PLEASURE = 9999999;
    LIMIT_SADISM_PLEASURE = 9999999;

    LIMIT_BUKKAKE_FACE_COUNT = 9999999;
    LIMIT_BUKKAKE_ARMS_COUNT = 9999999;
    LIMIT_BUKKAKE_BOOBS_COUNT = 9999999;
    LIMIT_BUKKAKE_BUTT_COUNT = 9999999;
    LIMIT_BUKKAKE_TOTAL_COUNT = 9999999;

    LIMIT_BUKKAKE_FACE_ML = 9999999;
    LIMIT_BUKKAKE_ARMS_ML = 9999999;
    LIMIT_BUKKAKE_LEGS_ML = 9999999;
    LIMIT_BUKKAKE_BOOBS_ML = 9999999;
    LIMIT_BUKKAKE_BUTT_ML = 9999999;
    LIMIT_BUKKAKE_TOTAL_ML = 9999999;

    LIMIT_SWALLOW_COUNT = 9999999;
    LIMIT_ANALCREAMPIE_COUNT = 9999999;
    LIMIT_PUSSYCREAMPIE_COUNT = 9999999;
    LIMIT_ALL_HOLES_CREAMED_COUNT = 9999999;

    LIMIT_SWALLOW_ML = 9999999;
    LIMIT_ANALCREAMPIE_ML = 9999999;
    LIMIT_PUSSYCREAMPIE_ML = 9999999;

    LIMIT_ORGASM_COUNT = 9999999;
    LIMIT_ORGASM_ML = 9999999;
    LIMIT_PUSSY_DRIP_TENTHML = 9999999;

    LIMIT_ORGASM_FROM_KISS = 9999999;
    LIMIT_ORGASM_FROM_TALK = 9999999;
    LIMIT_ORGASM_FROM_SIGHT = 9999999;
    LIMIT_ORGASM_FROM_PETTING = 9999999;
    LIMIT_ORGASM_FROM_CUNNILINGUS = 9999999;
    LIMIT_ORGASM_FROM_HANDJOB = 9999999;
    LIMIT_ORGASM_FROM_BLOWJOB = 9999999;
    LIMIT_ORGASM_FROM_TITTYFUCK = 9999999;
    LIMIT_ORGASM_FROM_PUSSYSEX = 9999999;
    LIMIT_ORGASM_FROM_ANALSEX = 9999999;
    LIMIT_ORGASM_FROM_CUMSWALLOW = 9999999;
    LIMIT_ORGASM_FROM_PUSSYCREAMPIE = 9999999;
    LIMIT_ORGASM_FROM_ANALCREAMPIE = 9999999;
    LIMIT_ORGASM_FROM_BUKKAKE = 9999999;
    LIMIT_ORGASM_FROM_SPANKING = 9999999;
    LIMIT_ORGASM_FROM_MASOCHISM = 9999999;
    LIMIT_ORGASM_FROM_SADISM = 9999999;
    LIMIT_ORGASM_FROM_MASTURBATION = 9999999;
    LIMIT_ORGASM_FROM_TOYS = 9999999;

    LIMIT_TOTAL_EJACULATION_COUNT = 9999999;
    LIMIT_TOTAL_EJACULATION_ML = 9999999;

    LIMIT_SEXUAL_PARTNERS_PRISONER = 9999999;
    LIMIT_SEXUAL_PARTNERS_GUARD = 9999999;
    LIMIT_SEXUAL_PARTNERS_ORC = 9999999;
    LIMIT_SEXUAL_PARTNERS_GOBLIN = 9999999;
    LIMIT_SEXUAL_PARTNERS_THUG = 9999999;
    LIMIT_SEXUAL_PARTNERS_SLIME = 9999999;
    LIMIT_SEXUAL_PARTNERS_NERD = 9999999;
    LIMIT_SEXUAL_PARTNERS_ROGUE = 9999999;
    LIMIT_SEXUAL_PARTNERS_LIZARDMAN = 9999999;
    LIMIT_SEXUAL_PARTNERS_ORC = 9999999;
    LIMIT_SEXUAL_PARTNERS_HOMELESS = 9999999;
    LIMIT_SEXUAL_PARTNERS_VISITOR = 9999999;

    LIMIT_VIRGINITIES_TAKEN_VIA_PUSSY = 9999999;
    LIMIT_VIRGINITIES_TAKEN_VIA_ANAL = 9999999;

    LIMIT_MAX_REACHED_MOUTH_DESIRE_COUNT = 9999999;
    LIMIT_MAX_REACHED_BOOBS_DESIRE_COUNT = 9999999;
    LIMIT_MAX_REACHED_PUSSY_DESIRE_COUNT = 9999999;
    LIMIT_MAX_REACHED_BUTT_DESIRE_COUNT = 9999999;
    LIMIT_MAX_REACHED_COCK_DESIRE_COUNT = 9999999;
    LIMIT_MAX_REACHED_ALL_DESIRE_COUNT = 9999999;

    LIMIT_KICK_COUNTER_SEX_COUNT = 9999999;
    LIMIT_DOUBLE_PENETRATION_COUNT = 9999999;
    LIMIT_TRIPLE_PENETRATION_COUNT = 9999999;
    LIMIT_BLOWBANG_COUNT = 9999999;
    LIMIT_URINAL_COUNT = 9999999;

    LIMIT_MANUALLY_REMOVED_CLIT_TOY_COUNT = 9999999;
    LIMIT_MANUALLY_REMOVED_PUSSY_TOY_COUNT = 9999999;
    LIMIT_MANUALLY_REMOVED_ANAL_TOY_COUNT = 9999999;

    LIMIT_CLIT_TOY_INSERTED_COUNT = 9999999;
    LIMIT_PUSSY_TOY_INSERTED_COUNT = 9999999;
    LIMIT_ANAL_TOY_INSERTED_COUNT = 9999999;

    LIMIT_CLIT_TOY_USED_BY_ENEMY_COUNT = 9999999;
    LIMIT_PUSSY_TOY_USED_BY_ENEMY_COUNT = 9999999;
    LIMIT_ANAL_TOY_USED_BY_ENEMY_COUNT = 9999999;
};

// Repair typo?
// Function Overwrite
CC_Mod.Tweaks.Game_Actor_damageClothing = Game_Actor.prototype.damageClothing;
Game_Actor.prototype.damageClothing = function(damage) {
	if(damage <= 0 || this.isClothingMaxDamaged() || !DEBUG_MODE) return;

	let minimum = this.minimumClothingDurabilityForCurrentStage();
    // Typo here? Didn't have underscore
	let outcome = this._clothingDurability - damage;

	if(outcome <= minimum) {
		outcome = minimum;
		this._clothingStage++;
		//todo: Play clothes breaking sound effect when new stage?
	}

	this._clothingDurability = outcome;

	if(this.isClothingMaxDamaged()) this.addToClothesStrippedRecord();
};

// Deal with some issues created by removing limits

// Prevent empty passives
CC_Mod.Tweaks.Game_Actor_learnNewPassive = Game_Actor.prototype.learnNewPassive;
Game_Actor.prototype.learnNewPassive = function(skillId) {
    let skill = $dataSkills[skillId];
    let name = skill.name;
    if (CCMod_removeKarrynLimits_disableKnownProblems && (name == "" || name == '')) {
        return;
    }
    CC_Mod.Tweaks.Game_Actor_learnNewPassive.call(this, skillId);
};

CC_Mod.Tweaks.Game_Actor_showEval_pussySexSkills = Game_Actor.prototype.showEval_pussySexSkills;
Game_Actor.prototype.showEval_pussySexSkills = function() {
    if (CCMod_removeKarrynLimits_disableKnownProblems) {
        return false;
    }
    return CC_Mod.Tweaks.Game_Actor_showEval_pussySexSkills.call(this);
};

CC_Mod.Tweaks.Game_Actor_showEval_cant_karrynPussySexSkill = Game_Actor.prototype.showEval_cant_karrynPussySexSkill;
Game_Actor.prototype.showEval_cant_karrynPussySexSkill = function() {
    if (CCMod_removeKarrynLimits_disableKnownProblems) {
        return false;
    }
    return CC_Mod.Tweaks.Game_Actor_showEval_cant_karrynPussySexSkill.call(this);
};