Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #156 from Pluviolithic/dev
Browse files Browse the repository at this point in the history
Add keep legendaries upgrade
  • Loading branch information
Pluviolithic authored Feb 4, 2024
2 parents 290cac4 + d929a58 commit a40770a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/client/UI/Combat/WorkoutUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ playerStatePromise:andThen(function()
local currentRequiredFear = selectors.getStat(newState, player.Name, "RequiredFear")
local requiredFearChanged = currentRequiredFear ~= selectors.getStat(oldState, player.Name, "RequiredFear")

if requiredFearChanged then
if requiredFearChanged and WorkoutUI:FindFirstChild "Background" then
formatter.tweenFormattedTextNumber(WorkoutUI.Background.FearCost, {
previousRequiredFear,
currentRequiredFear,
Expand Down
4 changes: 3 additions & 1 deletion src/client/UI/Inventories/PetInventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ function PetInventory:Refresh()
--PopupUI "You Can Not Unlock This Pet!"
return
end
self._focusedTemplateDetails.Locked = false
if self._focusedTemplateDetails then
self._focusedTemplateDetails.Locked = false
end
Remotes.Client:Get("UnlockPet"):SendToServer(petName)
end)

Expand Down
1 change: 1 addition & 0 deletions src/client/UI/TutorialUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ tutorialFunctions = {
function() -- step 1
local kills = selectors.getStat(store:getState(), player.Name, "Kills")
if kills < 2 then
TutorialUI:WaitForChild "TutorialText"
rolloutTutorialText(`Defeat enemies to gain Fear! ({kills}/2)`)

if not workspace.Beams.TutorialEnemy.Beam.Attachment1 and not deletedEnemyBeam then
Expand Down
2 changes: 1 addition & 1 deletion src/server/Combat/Enemies/ApplyPlayerAnimations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ return function(player, enemy, info, janitor)
end
task.delay(1, function()
weaponAccessory:Destroy()
if not findFirstChildWithTag(player.Character, "WeaponAccessory") then
if player.Character and not findFirstChildWithTag(player.Character, "WeaponAccessory") then
player.Character.Humanoid:AddAccessory(equippedWeaponAccessory:Clone())
end
end)
Expand Down
19 changes: 11 additions & 8 deletions src/server/Exchange/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,20 @@ local function handlePunchingBag(bag: any)
loadedIdleAnimation:Play()

local newWorkoutSpeed = workoutSpeed
local rebirthBuff = selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "WorkoutSpeed")
* 0.05

newWorkoutSpeed *= (1 - rebirthBuff)
if selectors.isPlayerLoaded(store:getState(), player.Name) then
local rebirthBuff = selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "WorkoutSpeed")
* 0.05

if selectors.hasGamepass(store:getState(), player.Name, tripleWorkoutSpeedPassID) then
newWorkoutSpeed /= 3
end
newWorkoutSpeed *= (1 - rebirthBuff)

if selectors.hasGamepass(store:getState(), player.Name, tripleWorkoutSpeedPassID) then
newWorkoutSpeed /= 3
end

if selectors.getActiveBoosts(store:getState(), player.Name)["WorkoutBoost"] then
newWorkoutSpeed /= 3
if selectors.getActiveBoosts(store:getState(), player.Name)["WorkoutBoost"] then
newWorkoutSpeed /= 3
end
end

task.wait(newWorkoutSpeed)
Expand Down
18 changes: 17 additions & 1 deletion src/server/Leveling/Rebirths.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local Remotes = require(ReplicatedStorage.Common.Remotes)
local store = require(ServerScriptService.Server.State.Store)
local actions = require(ServerScriptService.Server.State.Actions)
local selectors = require(ReplicatedStorage.Common.State.selectors)
local petUtils = require(ReplicatedStorage.Common.Utils.Player.PetUtils)
local defaultStates = require(ReplicatedStorage.Common.State.DefaultStates)

local upgrades = ReplicatedStorage.Config.Rebirth.Upgrades
Expand All @@ -24,7 +25,22 @@ Remotes.Server:Get("Rebirth"):Connect(function(player)
store:dispatch(actions.unequipPlayerPets(player.Name, selectors.getEquippedPets(store:getState(), player.Name)))

local ownedPets = table.clone(selectors.getOwnedPets(store:getState(), player.Name))
local lockedPets = selectors.getLockedPets(store:getState(), player.Name)
local lockedPets = table.clone(selectors.getLockedPets(store:getState(), player.Name))

local bestPets = petUtils.getBestPetNames(ownedPets, math.huge)
local legendaryKeepLimit = selectors.getRebirthUpgradeLevel(store:getState(), player.Name, "KeepLegendaries")

for _, petName in bestPets do
if legendaryKeepLimit < 1 then
break
end
local pet = petUtils.getPet(petName)
if pet.RarityName.Value == "Legendary" and not pet:FindFirstChild "PermaLock" then
legendaryKeepLimit -= 1
lockedPets[petName] = (lockedPets[petName] or 0) + 1
end
end

for petName, count in ownedPets do
ownedPets[petName] = count - (lockedPets[petName] or 0)
end
Expand Down
1 change: 1 addition & 0 deletions src/server/PlayerManager/ProfileTemplate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ return {
MoreStrength = 0,
Sprint = 0,
WorkoutSpeed = 0,
KeepLegendaries = 0,
},
},

Expand Down
13 changes: 13 additions & 0 deletions src/server/State/Middleware/ApplyMultipliersMiddleware.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ return function(nextDispatch, store)
local multiplierData = selectors.getMultiplierData(store:getState(), action.playerName)
if not multiplierData or action.skipMultipliers then
nextDispatch(action)
local endMaxFearMeter = nil
if action.playerName and selectors.isPlayerLoaded(store:getState(), action.playerName) then
endMaxFearMeter = rankUtils.getMaxFearMeterFromRank(
selectors.getStat(store:getState(), action.playerName, "Rank")
)
end
if endMaxFearMeter and initialMaxFearMeter ~= endMaxFearMeter then
local multiplier = selectors.getMultiplierData(store:getState(), action.playerName).MaxFearMeterMultiplier
or 1
store:dispatch(
actions.setPlayerStat(action.playerName, "MaxFearMeter", endMaxFearMeter * multiplier)
)
end
return
end
local multiplier = multiplierData[action.statName .. "Multiplier"] or 0
Expand Down
1 change: 1 addition & 0 deletions src/shared/State/DefaultStates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ return {
MoreStrength = 0,
Sprint = 0,
WorkoutSpeed = 0,
KeepLegendaries = 0,
},
},

Expand Down

0 comments on commit a40770a

Please sign in to comment.