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

Commit

Permalink
Fix remaining known boost bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Nov 28, 2023
1 parent d0b1996 commit d25e928
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/client/Jumpscare.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ playerStatePromise:andThen(function()
lastEnemyFought = selectors.getCurrentTarget(newState, player.Name)
end
if isScared(newState) and not isScared(oldState) and (os.time() - lastJumpscared) > jumpscareGap then
jumpscarePlayer(lastEnemyFought.Name)
jumpscarePlayer(if lastEnemyFought then lastEnemyFought.Name else "Evil Clown")
end
end)
end)
Expand Down
6 changes: 5 additions & 1 deletion src/client/UI/BillboardShops/EggShop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ local function handleShop(shop): ()

table.insert(rarityListeners, function(luck: number): ()
if luck == 0 then
for _, petUI in shop.Background.Pets:GetChildren() do
petUI.RarityText.Text =
string.format("%.1f%%", ReplicatedStorage.Pets[areaName][petUI.Name].Rarity.Value)
end
return
end

Expand Down Expand Up @@ -484,7 +488,7 @@ playerStatePromise:andThen(function()
if
selectors.getStat(newState, player.Name, "Luck") ~= selectors.getStat(oldState, player.Name, "Luck")
or selectors.getActiveBoosts(newState, player.Name)["LuckBoost"]
and not selectors.getActiveBoosts(oldState, player.Name)["LuckBoost"]
~= selectors.getActiveBoosts(oldState, player.Name)["LuckBoost"]
then
updateRarityListeners(selectors.getStat(newState, player.Name, "Luck"))
end
Expand Down
40 changes: 33 additions & 7 deletions src/client/UI/BuffsUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local playerStatePromise = require(StarterPlayer.StarterPlayerScripts.Client.Sta
local player = Players.LocalPlayer

local buffTray = player.PlayerGui:WaitForChild "Buffs"
local productIDs = ReplicatedStorage.Config.DevProductData.IDs
local gamepassIDs = ReplicatedStorage.Config.GamepassData.IDs

local function isScared(state)
if selectors.getActiveBoosts(state, player.Name)["FearlessBoost"] then
Expand Down Expand Up @@ -49,13 +49,22 @@ local function updateBuffTray(state)
end
end

buffTray.Frame.DamageDebuff.Activated:Connect(function()
MarketplaceService:PromptProductPurchase(player, productIDs["2xAttackSpeed"].Value)
end)
local currentOpenDescription, countdownActive
local lastDescriptionTapped = -1

buffTray.Frame.SpeedDebuff.Activated:Connect(function()
MarketplaceService:PromptProductPurchase(player, productIDs["2xSpeed"].Value)
end)
local function countdownDescriptionDisplayTime()
lastDescriptionTapped = os.time()
if countdownActive then
return
end
countdownActive = true
while lastDescriptionTapped + 10 > os.time() do
task.wait(0.25)
end
currentOpenDescription.Visible = false
currentOpenDescription = nil
countdownActive = false
end

for _, buffDisplay in buffTray.Frame:GetChildren() do
if not buffDisplay:IsA "GuiButton" then
Expand All @@ -76,6 +85,15 @@ for _, buffDisplay in buffTray.Frame:GetChildren() do
buffDisplay.Description.Visible = false
end)

buffDisplay.TouchTap:Connect(function()
if currentOpenDescription and currentOpenDescription ~= buffDisplay.Description then
currentOpenDescription.Visible = false
buffDisplay.Description.Visible = true
end
currentOpenDescription = buffDisplay.Description
countdownDescriptionDisplayTime()
end)

if not buffDisplay.Name:match "Boost" then
continue
end
Expand All @@ -84,6 +102,14 @@ for _, buffDisplay in buffTray.Frame:GetChildren() do
end)
end

buffTray.Frame.DamageDebuff.Activated:Connect(function()
MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["2xAttackSpeed"].Value)
end)

buffTray.Frame.SpeedDebuff.Activated:Connect(function()
MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["2xSpeed"].Value)
end)

playerStatePromise:andThen(function()
updateBuffTray(store:getState())
store.changed:connect(updateBuffTray)
Expand Down
16 changes: 8 additions & 8 deletions src/client/UI/Combat/FearMeter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ playerStatePromise:andThen(function()
end

local function revealFearMeter()
if selectors.getActiveBoosts(store:getState(), player.Name)["FearlessBoost"] then
fearMeter.Fear.Visible = false
fearMeter.Fearless.Visible = true
else
fearMeter.Fear.Visible = true
fearMeter.Fearless.Visible = false
end

fearMeter.Icon.Visible = true
fearMeter.Image.Visible = true
fearMeter.Enable.Visible = false
Expand All @@ -84,6 +76,14 @@ playerStatePromise:andThen(function()
local currentTarget = selectors.getCurrentTarget(newState, player.Name)
local previousTarget = selectors.getCurrentTarget(oldState, player.Name)

if selectors.getActiveBoosts(newState, player.Name)["FearlessBoost"] then
fearMeter.Fear.Visible = false
fearMeter.Fearless.Visible = true
else
fearMeter.Fear.Visible = true
fearMeter.Fearless.Visible = false
end

if currentTarget ~= previousTarget and currentTarget then
if
selectors.getStat(newState, player.Name, "CurrentFearMeter")
Expand Down
8 changes: 4 additions & 4 deletions src/server/Combat/Enemies/ApplyDamageToEnemy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ return function(player, enemy, info, janitor)
local weaponName = selectors.getEquippedWeapon(store:getState(), player.Name)
local damageMultiplier = if weaponName == "Fists" then 1 else weapons[weaponName].Damage.Value

janitor:Add(function()
enabled = false
end, true)

store:dispatch(actions.combatBegan(player.Name))

if weaponName ~= "Fists" then
Expand Down Expand Up @@ -56,8 +60,4 @@ return function(player, enemy, info, janitor)
janitor:Destroy()
end
end)

janitor:Add(function()
enabled = false
end, true)
end
1 change: 1 addition & 0 deletions src/server/Combat/FearEffects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local function isScared(playerName, state)
end
if selectors.getActiveBoosts(state, playerName)["FearlessBoost"] then
if selectors.getStat(state, playerName, "CurrentFearMeter") ~= 0 then
store:dispatch(actions.setPlayerStat(playerName, "LastScaredTimestamp", -1))
store:dispatch(actions.setPlayerStat(playerName, "CurrentFearMeter", 0))
end
return false
Expand Down
8 changes: 2 additions & 6 deletions src/server/State/Middleware/ApplyMultipliersMiddleware.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ return function(nextDispatch, store)

local boostData =
selectors.getActiveBoosts(store:getState(), action.playerName)[action.statName .. "Boost"]
if boostData then
multiplier += 2
multiplierCount += 1
end

if multiplierCount < 1 then
action.incrementAmount *= (1 + multiplier)
action.incrementAmount *= (1 + multiplier) * (boostData and 2 or 1)
else
action.incrementAmount *= multiplier
action.incrementAmount *= multiplier * (boostData and 2 or 1)
end
end
end
Expand Down

0 comments on commit d25e928

Please sign in to comment.