Skip to content

Commit 856b156

Browse files
committed
Keep draws from voiding points
Previously points were voided when a draw occured. This commit allows draws to add their match_value into the next match that's started
1 parent 55a09b0 commit 856b156

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# handles arenas with sat_arena_state=2 "running" and 0 players
2+
# @s = arenas with sat_arena_state 2 and 0 players
3+
# at most negative corner of arena walls on arena floor
4+
# called by stack_attack_arena:round/running
5+
6+
# move arena points into fake player score for next game
7+
scoreboard players operation legacy_match_value sat_match_value += @s sat_match_value
8+
9+
# set round ended flag
10+
scoreboard players set @s sat_arena_state 3

data/stack_attack_arena/functions/round/running.mcfunction

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14] run function stack_attack_aren
1212
execute positioned ~ 250 ~ run kill @a[tag=sat_in_game,dx=14,dy=5,dz=14]
1313

1414
# update sat_arena_state to 3 ("ended") in case there is just one player left === WIN CONDITION ===
15-
execute if score players_in_arena sat_match_value matches ..1 run scoreboard players set @s sat_arena_state 3
15+
execute if score players_in_arena sat_match_value matches 1 run scoreboard players set @s sat_arena_state 3
16+
17+
# handle draws
18+
execute if score players_in_arena sat_match_value matches 0 run function stack_attack_arena:round/draw
1619

1720
# reset fake players
1821
scoreboard players reset players_in_arena sat_match_value

data/stack_attack_arena/functions/setup/pay_participation_fee.mcfunction

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ scoreboard players operation participation_fee sat_match_value /= #10 sat_data
88
scoreboard players add participation_fee sat_match_value 1
99

1010
# add participation cost to match value
11-
#scoreboard players add match_value sat_match_value 2
1211
scoreboard players operation match_value sat_match_value += participation_fee sat_match_value
1312

1413
# pay the fee
1514
scoreboard players operation @s sat_leaderboard -= participation_fee sat_match_value
1615

1716
# store value of payed fee
1817
scoreboard players operation @s sat_match_value = participation_fee sat_match_value
18+
19+
# reset fake player
20+
scoreboard players reset participation_fee sat_match_value

data/stack_attack_arena/functions/setup/prepare_entities.mcfunction

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ spreadplayers ~7.5 ~7.5 1 5 false @a[tag=sat_joining_game]
2929

3030
# effect players with buffs, equip jackets, replace sat_joining_game and sat_waiting_for_game with sat_in_game
3131
execute as @a[tag=sat_joining_game] run function stack_attack_arena:setup/prepare_players
32+
# -> match value is now stored in match_value sat_match_value
3233

3334
# store match value onto arena marker AEC
3435
scoreboard players operation @s sat_match_value = match_value sat_match_value
3536
scoreboard players reset match_value sat_match_value
3637

38+
# add legacy_match_value to match value (leftover points from a draw game)
39+
scoreboard players operation @s sat_match_value += legacy_match_value sat_match_value
40+
scoreboard players reset legacy_match_value sat_match_value
41+
3742
#====== Players now just have the sat_in_game tag ======
3843

3944
# set sat_round_timer to -4

pack.mcmeta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"pack_format":0,
44
"description":"Ready, Set, Stack! A fun multiplayer minigame that fits any world!"
55
},
6-
"version":"snp19w45A",
6+
"version":"snp19w46A",
77
"credits":{
88
"creator":[
99
["Bloo","https://www.twitter.com/Bluefire610"]

0 commit comments

Comments
 (0)