From 8b7a7a046b72900d14a5514cd97f1cf3d9946734 Mon Sep 17 00:00:00 2001 From: Roms1383 Date: Fri, 9 Feb 2024 17:20:24 +0700 Subject: [PATCH 1/6] :see_no_evil: update ignored files order --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ef55d16d..c29064b9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ **/.DS_Store /book/site -!scripts/ scripts/* +!scripts/Addicted /archives/**/*.cpmodproj /archives/**/*.zip /archives/**/layout.xml From e0caff4a4abc0a3de9d6ef6bb4562f388ea6ee51 Mon Sep 17 00:00:00 2001 From: Roms1383 Date: Fri, 9 Feb 2024 17:21:27 +0700 Subject: [PATCH 2/6] :sparkles: faster consumption --- scripts/Addicted/Attunement.reds | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 scripts/Addicted/Attunement.reds diff --git a/scripts/Addicted/Attunement.reds b/scripts/Addicted/Attunement.reds new file mode 100644 index 00000000..77862f84 --- /dev/null +++ b/scripts/Addicted/Attunement.reds @@ -0,0 +1,50 @@ +module Addicted + +import Addicted.System.AddictedSystem +import Addicted.Helpers.Generic + +@wrapMethod(ConsumableTransitions) +protected final func ChangeConsumableAnimFeature(stateContext: ref, scriptInterface: ref, newState: Bool) -> Void { + let item: ItemID; + let id: TweakDBID; + let addictive: Bool; + let consumable: Consumable; + let threshold: Threshold; + let player: ref; + let system: ref; + wrappedMethod(stateContext, scriptInterface, newState); + item = this.GetItemIDFromWrapperPermanentParameter(stateContext, n"consumable"); + id = ItemID.GetTDBID(item); + addictive = Generic.IsAddictive(id); + if addictive { + player = scriptInterface.GetPlayerSystem().GetLocalPlayerMainGameObject() as PlayerPuppet; + system = AddictedSystem.GetInstance(player.GetGame()); + consumable = Generic.Consumable(id); + threshold = system.Threshold(consumable); + if EnumInt(threshold) >= EnumInt(Threshold.Severely) { + let itemType: gamedataItemType = TweakDBInterface.GetItemRecord(id).ItemType().Type(); + let inCombat: Bool = (scriptInterface.GetPlayerSystem().GetLocalPlayerMainGameObject() as PlayerPuppet).IsInCombat(); + let isPerkFasterHealingUnlocked: Bool = PlayerDevelopmentSystem.GetData(scriptInterface.executionOwner).IsNewPerkBought(gamedataNewPerkType.Tech_Left_Perk_2_3) > 0; + let consumableAnimFeature: ref = new AnimFeature_ConsumableAnimation(); + consumableAnimFeature.useConsumable = false; + switch itemType { + case gamedataItemType.Con_Injector: + consumableAnimFeature.consumableType = 0; + if inCombat && isPerkFasterHealingUnlocked { + consumableAnimFeature.animationScale = 1.65 + 0.15; + } else { + consumableAnimFeature.animationScale = 1.15 + 0.3; + }; + break; + case gamedataItemType.Con_Inhaler: + consumableAnimFeature.consumableType = 1; + if inCombat && isPerkFasterHealingUnlocked { + consumableAnimFeature.animationScale = 1.50 + 0.1; + } else { + consumableAnimFeature.animationScale = 1.15 + 0.2; + }; + }; + scriptInterface.SetAnimationParameterFeature(n"ConsumableFeature", consumableAnimFeature, scriptInterface.executionOwner); + } + } +} \ No newline at end of file From 9fe6c534a51f45c24b55d89aa4fc3690b4c469fb Mon Sep 17 00:00:00 2001 From: Roms1383 Date: Sat, 10 Feb 2024 11:20:24 +0700 Subject: [PATCH 3/6] :sparkles: ono hints now slightly increase audio stim range --- scripts/Addicted/managers/AudioManager.reds | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/Addicted/managers/AudioManager.reds b/scripts/Addicted/managers/AudioManager.reds index e9b3054a..10eac6e0 100644 --- a/scripts/Addicted/managers/AudioManager.reds +++ b/scripts/Addicted/managers/AudioManager.reds @@ -56,8 +56,12 @@ public class AudioManager extends IScriptable { private let callbackID: DelayID; + private let audioStimMultiplier: ref; + private let audioStimMultiplierActive: Bool = false; + public func Register(player: ref) -> Void { E(s"register audio manager"); + this.audioStimMultiplier = RPGManager.CreateStatModifier(gamedataStatType.AudioStimRangeMultiplier, gameStatModifierType.Additive, 0.2); let board: ref; if player != null { this.owner = player; @@ -168,6 +172,10 @@ public class AudioManager extends IScriptable { } public func Play(tracked: ref) -> Void { + let ongoing = !tracked.got.IsLoop(); + if ongoing && !this.audioStimMultiplierActive { + this.ToggleAudioStims(true); + } let policy = this.ToPolicy(); E(s"-----------------------------------------------"); E(s"play"); @@ -189,6 +197,10 @@ public class AudioManager extends IScriptable { public func Stop(sound: CName) -> Void { GameInstance.GetAudioSystem(this.owner.GetGame()) .Stop(sound, this.owner.GetEntityID(), n"Addicted"); + let finished = ArraySize(this.oneshot) == 0; + if finished && this.audioStimMultiplierActive { + this.ToggleAudioStims(false); + } } public func StopAll() -> Void { @@ -403,4 +415,14 @@ public class AudioManager extends IScriptable { this.InvalidateState(); } } + + private func ToggleAudioStims(active: Bool) -> Void { + let stats: ref = GameInstance.GetStatsSystem(this.owner.GetGame()); + if active { + stats.AddModifier(Cast(this.owner.GetEntityID()), this.audioStimMultiplier); + } else { + stats.RemoveModifier(Cast(this.owner.GetEntityID()), this.audioStimMultiplier); + } + this.audioStimMultiplierActive = active; + } } \ No newline at end of file From 7188db6ea1160e5f01ced52483948ffee5aadaf8 Mon Sep 17 00:00:00 2001 From: Roms1383 Date: Sun, 11 Feb 2024 15:37:09 +0700 Subject: [PATCH 4/6] :wrench: fix incorrect tweak definition for black market health booster --- tweaks/Addicted/healers.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tweaks/Addicted/healers.yml b/tweaks/Addicted/healers.yml index e403c279..35d1e616 100644 --- a/tweaks/Addicted/healers.yml +++ b/tweaks/Addicted/healers.yml @@ -92,7 +92,7 @@ BaseStatusEffect.$(threshold)WeakenedHealthBooster: $instances: - { threshold: Notably, modifier: 1.07, modifiers: 7 } - { threshold: Severely, modifier: 1.03, modifiers: 3 } - $base: BaseStatusEffect.$(prefix)HealthBooster + $base: BaseStatusEffect.HealthBooster packages: - $base: BaseStatusEffect.HealthBooster_inline0 stats: @@ -109,7 +109,7 @@ BaseStatusEffect.$(threshold)WeakenedBlackmarket_HealthBooster: $instances: - { threshold: Notably, modifier: 1.15, modifiers: 15, malus: -0.6, maluses: 60 } - { threshold: Severely, modifier: 1.1, modifiers: 10, malus: -0.7, maluses: 70 } - $base: BaseStatusEffect.$(prefix)HealthBooster + $base: BaseStatusEffect.Blackmarket_HealthBooster packages: - $base: BaseStatusEffect.Blackmarket_HealthBooster_inline0 stats: @@ -122,7 +122,7 @@ BaseStatusEffect.$(threshold)WeakenedBlackmarket_HealthBooster: statType: BaseStats.StaminaRegenRateMult value: $(malus) uiData: - $base: BaseStatusEffect.$(prefix)HealthBooster_inline$(inline) + $base: BaseStatusEffect.Blackmarket_HealthBooster_inline3 iconPath: $(threshold)WeakenedHealthBooster intValues: [ $(modifiers), $(maluses) ] From 3364ecfd9ea43f5c938b04d45b37ccc03774f9e0 Mon Sep 17 00:00:00 2001 From: Roms1383 Date: Sun, 11 Feb 2024 21:11:21 +0700 Subject: [PATCH 5/6] :construction: add additional addiction variant --- scripts/Addicted/Definitions.reds | 4 +++- scripts/Addicted/Helper.reds | 2 ++ scripts/Addicted/helpers/Generic.reds | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/Addicted/Definitions.reds b/scripts/Addicted/Definitions.reds index 2d15f53e..04069de6 100644 --- a/scripts/Addicted/Definitions.reds +++ b/scripts/Addicted/Definitions.reds @@ -384,6 +384,7 @@ enum Addiction { Anabolics = 1, Neuros = 2, BlackLace = 3, + Alcohol = 4, } public static func Addictions() -> array { @@ -391,7 +392,8 @@ public static func Addictions() -> array { Addiction.Healers, Addiction.Anabolics, Addiction.Neuros, - Addiction.BlackLace + Addiction.BlackLace, + Addiction.Alcohol ]; } diff --git a/scripts/Addicted/Helper.reds b/scripts/Addicted/Helper.reds index a48e68bc..a2f9ecb0 100644 --- a/scripts/Addicted/Helper.reds +++ b/scripts/Addicted/Helper.reds @@ -56,6 +56,8 @@ public class Helper { return [Consumable.MemoryBooster, Consumable.NeuroBlocker]; case Addiction.BlackLace: return [Consumable.BlackLace]; + case Addiction.Alcohol: + return [Consumable.Alcohol]; default: break; } diff --git a/scripts/Addicted/helpers/Generic.reds b/scripts/Addicted/helpers/Generic.reds index dbadb79c..824282f3 100644 --- a/scripts/Addicted/helpers/Generic.reds +++ b/scripts/Addicted/helpers/Generic.reds @@ -33,6 +33,8 @@ public class Generic { return Addiction.Neuros; case Consumable.BlackLace: return Addiction.BlackLace; + case Consumable.Alcohol: + return Addiction.Alcohol; default: break; } From 2486d071862763d622eda2b66ac4b90d0b3ccba5 Mon Sep 17 00:00:00 2001 From: Roms1383 Date: Sun, 11 Feb 2024 21:14:06 +0700 Subject: [PATCH 6/6] :sparkles: decrease healing charge duration when seriously addict --- scripts/Addicted/Definitions.reds | 12 ++++++++++++ scripts/Addicted/System.reds | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/scripts/Addicted/Definitions.reds b/scripts/Addicted/Definitions.reds index 04069de6..2688b8a5 100644 --- a/scripts/Addicted/Definitions.reds +++ b/scripts/Addicted/Definitions.reds @@ -224,6 +224,18 @@ public class Consumptions { } return highest; } + public func HighestThreshold(addiction: Addiction) -> Threshold { + let consumables = Helper.Consumables(addiction); + let highest: Threshold = Threshold.Clean; + let current: Threshold; + for consumable in consumables { + current = this.Threshold(consumable); + if EnumInt(current) > EnumInt(highest) { + highest = current; + } + } + return highest; + } /// total consumption for a given consumable /// each consumable can have one or many versions (e.g maxdoc and bounceback have 3+ versions each) public func TotalConsumption(consumable: Consumable) -> Int32 { diff --git a/scripts/Addicted/System.reds b/scripts/Addicted/System.reds index 6e3920f8..1422483d 100644 --- a/scripts/Addicted/System.reds +++ b/scripts/Addicted/System.reds @@ -40,7 +40,7 @@ public class AddictedSystem extends ScriptableSystem { private persistent let warnings: Uint32 = 0u; private let updateSymtomsID: DelayID; - + private let healingRechargeDurationModifier: ref; private final func OnPlayerAttach(request: ref) -> Void { let player: ref = GetPlayer(this.GetGameInstance()); @@ -184,11 +184,27 @@ public class AddictedSystem extends ScriptableSystem { this.Hint(id); } if NotEquals(EnumInt(before), EnumInt(after)) { + if Generic.IsHealer(id) { this.UpdateHealingChargeDuration(this.player); } this.Warn(before, after); } } } + // HealingItemsRecharge - HealingItemsRechargeDuration (on consumption) + private func UpdateHealingChargeDuration(player: ref) -> Void { + let system = AddictedSystem.GetInstance(player.GetGame()); + let threshold = system.Threshold(Addiction.Healers); + let serious = Helper.IsSerious(threshold); + let stats: ref = GameInstance.GetStatsSystem(player.GetGame()); + if serious && !IsDefined(this.healingRechargeDurationModifier) { + this.healingRechargeDurationModifier = RPGManager.CreateStatModifier(gamedataStatType.HealingItemsRechargeDuration, gameStatModifierType.Multiplier, 0.8); + stats.AddModifier(Cast(player.GetEntityID()), this.healingRechargeDurationModifier); + } else if !serious && IsDefined(this.healingRechargeDurationModifier) { + stats.RemoveModifier(Cast(player.GetEntityID()), this.healingRechargeDurationModifier); + this.healingRechargeDurationModifier = null; + } + } + public func OnDissipated(id: TweakDBID) -> Void { this.Hint(id); }