Skip to content

Commit

Permalink
Only give player rewards if given enough ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
Janiczek committed Nov 3, 2024
1 parent aba3a7f commit 5d53157
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/Backend.elm
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,10 @@ processGameTickForQuests worldName model =
( lastItemId, players )

Player.Player playerData ->
if SeqSet.member completedQuest playerData.questsActive then
if
SeqSet.member completedQuest playerData.questsActive
&& World.enoughTicksGiven completedQuest playerData.name world.questsProgress
then
let
( newLastItemId_, newPlayerData ) =
{ playerData
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Version.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module Data.Version exposing (version)

version : String
version =
"2024.11.02::001"
"2024.11.03::001"
14 changes: 14 additions & 0 deletions src/Data/World.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Data.World exposing
( Name
, World
, codec
, enoughTicksGiven
, init
, isQuestDone
, isQuestDone_
Expand Down Expand Up @@ -161,3 +162,16 @@ isQuestDone_ perPlayer quest =
Dict.values perPlayer
|> List.sum
|> (\sum -> sum >= Quest.ticksNeeded quest)


enoughTicksGiven : Quest.Name -> PlayerName -> SeqDict Quest.Name (Dict PlayerName Int) -> Bool
enoughTicksGiven quest playerName questsProgress =
let
given =
questsProgress
|> SeqDict.get quest
|> Maybe.withDefault Dict.empty
|> Dict.get playerName
|> Maybe.withDefault 0
in
given >= Quest.ticksNeededForPlayerReward quest
7 changes: 5 additions & 2 deletions src/Frontend/News.elm
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ type alias Item =

items : List Item
items =
[ { date = 1730500914
[ { date = 1730653425
, title = "TODOs before release"
, text =
"""
Current:
- quests UX + test them end-to-end
- frontend: topologically sort the quests based on quest dependencies
- quest completion: add a Message to the player: you completed a quest!
- has car -> faster movement
- end of game
Next up:
Expand All @@ -40,7 +43,7 @@ Next up:
- weapons - show strength requirement somewhere (item description)
- tooltips around edge of screen - floating-ui.js?
- HtH Evade perk to only work if hands are empty
- new char / char screen: show Sequence in derived stats
- new char / char screen: show Sequence and other stats in derived stats
- gecko skinning - is it doing anything?
- skynet and k9 - doing anything?
- awareness - info about players' weapon and armor?
Expand Down

0 comments on commit 5d53157

Please sign in to comment.