Skip to content

Commit 5f72b74

Browse files
committed
Update to the score system
Joining a match now costs `(10% of @s' leaderboard points) + 1`. Effectively making the game more expensive for good players. Technical Changes: - Renamed scoreboard objective `sat_match_size` to `sat_match_value`. **This will require users to re-run init** if stack attack was aready installed.
1 parent bc98602 commit 5f72b74

File tree

11 files changed

+47
-39
lines changed

11 files changed

+47
-39
lines changed

data/stack_attack_arena/functions/players/in_game_player_operations.mcfunction

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ effect give @s[scores={sat_hunger=..10}] saturation 2 0 true
99
effect give @s minecraft:weakness 12 5 true
1010

1111
# count players in arena (executes this for each player in the arena)
12-
scoreboard players add players_in_arena sat_match_size 1
12+
scoreboard players add players_in_arena sat_match_value 1
1313

1414
# check for existence of an off-hand item
1515
execute if entity @s[nbt={Inventory:[{Slot:-106b}]}] run function stack_attack_arena:powerups/check_players

data/stack_attack_arena/functions/players/winner.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
# apply gained points
66
scoreboard players operation @s sat_leaderboard += points_gained sat_data
7-
execute if entity @s[tag=sat_payed_fee] run scoreboard players operation points_gained sat_data -= #1 sat_data
8-
tag @s remove sat_payed_fee
7+
scoreboard players operation points_gained sat_data -= @s sat_match_value
8+
scoreboard players reset @s sat_match_value
99

1010
# announcements
1111
execute if score points_gained sat_data matches 1.. run function stack_attack_arena:players/announcements/winner/gained_points

data/stack_attack_arena/functions/round/clean_up/delayed.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ kill @e[type=item,dx=14,dy=255,dz=14]
1313
# clear blocks ===== THIS IS THE REASON WHY AN ARENA MUST BE ABOVE Y=62
1414
fill ~1 ~ ~1 ~13 255 ~13 air
1515

16-
# reset sat_match_size
17-
scoreboard players reset @s sat_match_size
16+
# reset sat_match_value
17+
scoreboard players reset @s sat_match_value
1818

1919
# reset sat_arena_state
2020
scoreboard players set @s sat_arena_state 0

data/stack_attack_arena/functions/round/clean_up/immediate.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ execute if score @s sat_round_timer matches 350.. run scoreboard players set sum
99
# set round timer to a high value
1010
scoreboard players set @s sat_round_timer 30000
1111

12-
# store score gain into fake player
13-
scoreboard players operation points_gained sat_data = @s sat_match_size
12+
# get initial match value into fake player
13+
scoreboard players operation points_gained sat_data = @s sat_match_value
1414

1515
# handle winner
1616
execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14,limit=1,sort=arbitrary] at @s run function stack_attack_arena:players/winner

data/stack_attack_arena/functions/round/running.mcfunction

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
# called by stack_attack_arena:round/timer
55

66
# grant saturation to hungry players and check for selected off-hand power up. Also counts players in the arena
7-
scoreboard players set players_in_arena sat_match_size 0
7+
scoreboard players set players_in_arena sat_match_value 0
88
execute as @a[tag=sat_in_game,dx=14,dy=255,dz=14] run function stack_attack_arena:players/in_game_player_operations
9-
# -> amount of players in arena is now stored in players_in_arena sat_match_size
9+
# -> amount of players in arena is now stored in players_in_arena sat_match_value
1010

1111
# emergency condition: kill all participating players in the region above y=250
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_size 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
1616

1717
# reset fake players
18-
scoreboard players reset players_in_arena sat_match_size
18+
scoreboard players reset players_in_arena sat_match_value
1919

2020
# control drop timer
2121
execute if score @s sat_drop_timer matches 0 run function stack_attack_arena:blocks/drop_timer_control

data/stack_attack_arena/functions/setup/pay_participation_fee.mcfunction

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
# at the arena marker's location
33
# called by stack_attack_arena:setup/prepare_players
44

5-
# add 1 to total match size
6-
scoreboard players add players_in_arena sat_match_size 1
5+
# calculate participation cost
6+
scoreboard players operation participation_fee sat_match_value = @s sat_leaderboard
7+
scoreboard players operation participation_fee sat_match_value /= #10 sat_data
8+
scoreboard players add participation_fee sat_match_value 1
9+
10+
# add participation cost to match value
11+
#scoreboard players add match_value sat_match_value 2
12+
scoreboard players operation match_value sat_match_value += participation_fee sat_match_value
713

814
# pay the fee
9-
scoreboard players remove @s sat_leaderboard 1
15+
scoreboard players operation @s sat_leaderboard -= participation_fee sat_match_value
1016

11-
# remember this
12-
tag @s add sat_payed_fee
17+
# store value of payed fee
18+
scoreboard players operation @s sat_match_value = participation_fee sat_match_value

data/stack_attack_arena/functions/setup/prepare_entities.mcfunction

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ spreadplayers ~7.5 ~7.5 1 5 false @a[tag=sat_joining_game]
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
3232

33-
# store match size onto arena marker entity
34-
scoreboard players operation @s sat_match_size = players_in_arena sat_match_size
35-
scoreboard players reset players_in_arena sat_match_size
33+
# store match value onto arena marker AEC
34+
scoreboard players operation @s sat_match_value = match_value sat_match_value
35+
scoreboard players reset match_value sat_match_value
3636

3737
#====== Players now just have the sat_in_game tag ======
3838

data/stack_attack_arena/functions/setup/prepare_new_players.mcfunction

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# called by stack_attack_arena:setup/prepare_players
44

55
# hand out initial points
6-
scoreboard players set @s sat_leaderboard 6
6+
scoreboard players set @s sat_leaderboard 8
77

88
# grant advacnement
99
advancement grant @s only stack_attack_arena:root

data/stack_attack_arena/functions/setup/prepare_players.mcfunction

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# at the arena marker's location
33
# called by stack_attack_arena:setup/prepare_entities
44

5-
# remove old tags, replace with sat_in_game
5+
# remove old tags, replace with sat_in_game and reset old participation fee storage for security.
6+
scoreboard players reset @s sat_match_value
67
tag @s remove sat_waiting_for_game
78
tag @s remove sat_joining_game
89
tag @s add sat_in_game
@@ -22,26 +23,26 @@ effect give @s minecraft:resistance 4 12 true
2223
# set gamemode
2324
gamemode adventure
2425

25-
# hand out some point in case the player has never played before and grant advacnement
26-
execute unless score @s sat_leaderboard matches -2147483648..2147483647 run function stack_attack_arena:setup/prepare_new_players
27-
28-
# pay participation fee if player has at least 1 point
29-
execute if score @s sat_leaderboard matches 1.. run function stack_attack_arena:setup/pay_participation_fee
30-
3126
# track games played stat
3227
scoreboard players add @s sat_games_played 1
3328

3429
# playsound
3530
playsound minecraft:entity.player.attack.sweep player @s ~ ~ ~ 0.5 0 0
3631

37-
# equip vests
38-
replaceitem entity @s[scores={sat_leaderboard=7..9}] armor.chest leather_chestplate{display:{color:15468800,Name:"{\"text\":\"Piñiata's Rough Quilt\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
39-
replaceitem entity @s[scores={sat_leaderboard=10..13}] armor.chest leather_chestplate{display:{color:16166926,Name:"{\"text\":\"Piñiata's Coarse Quilt\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
40-
replaceitem entity @s[scores={sat_leaderboard=14..17}] armor.chest leather_chestplate{display:{color:16773687,Name:"{\"text\":\"Piñiata's Wooly Quilt\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
41-
replaceitem entity @s[scores={sat_leaderboard=18..21}] armor.chest leather_chestplate{display:{color:12123959,Name:"{\"text\":\"Piñiata's Warm Mantle\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
42-
replaceitem entity @s[scores={sat_leaderboard=22..25}] armor.chest leather_chestplate{display:{color:2150446,Name:"{\"text\":\"Piñiata's Comfortable Mantle\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
43-
replaceitem entity @s[scores={sat_leaderboard=26..29}] armor.chest leather_chestplate{display:{color:2150562,Name:"{\"text\":\"Piñiata's Beloved Mantle\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
44-
replaceitem entity @s[scores={sat_leaderboard=30..33}] armor.chest leather_chestplate{display:{color:1177343,Name:"{\"text\":\"Piñiata's Simple Jacket\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
45-
replaceitem entity @s[scores={sat_leaderboard=34..37}] armor.chest leather_chestplate{display:{color:1151743,Name:"{\"text\":\"Piñiata's Plush Jacket\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
46-
replaceitem entity @s[scores={sat_leaderboard=38..41}] armor.chest leather_chestplate{display:{color:6955247,Name:"{\"text\":\"Piñiata's Magical Jacket\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
47-
replaceitem entity @s[scores={sat_leaderboard=42..}] armor.chest leather_chestplate{display:{color:8716537,Name:"{\"text\":\"Piñiata's Robe\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
32+
# hand out some point in case the player has never played before and grant advacnement
33+
execute unless score @s sat_leaderboard matches -2147483648..2147483647 run function stack_attack_arena:setup/prepare_new_players
34+
35+
# equip vests before participation fee is payed
36+
replaceitem entity @s[scores={sat_leaderboard=8..11}] armor.chest leather_chestplate{display:{color:15468800,Name:"{\"text\":\"Piñiata's Rough Quilt\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
37+
replaceitem entity @s[scores={sat_leaderboard=11..14}] armor.chest leather_chestplate{display:{color:16166926,Name:"{\"text\":\"Piñiata's Coarse Quilt\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
38+
replaceitem entity @s[scores={sat_leaderboard=15..18}] armor.chest leather_chestplate{display:{color:16773687,Name:"{\"text\":\"Piñiata's Wooly Quilt\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
39+
replaceitem entity @s[scores={sat_leaderboard=19..22}] armor.chest leather_chestplate{display:{color:12123959,Name:"{\"text\":\"Piñiata's Warm Mantle\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
40+
replaceitem entity @s[scores={sat_leaderboard=23..26}] armor.chest leather_chestplate{display:{color:2150446,Name:"{\"text\":\"Piñiata's Comfortable Mantle\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
41+
replaceitem entity @s[scores={sat_leaderboard=27..30}] armor.chest leather_chestplate{display:{color:2150562,Name:"{\"text\":\"Piñiata's Beloved Mantle\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
42+
replaceitem entity @s[scores={sat_leaderboard=31..34}] armor.chest leather_chestplate{display:{color:1177343,Name:"{\"text\":\"Piñiata's Simple Jacket\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
43+
replaceitem entity @s[scores={sat_leaderboard=35..38}] armor.chest leather_chestplate{display:{color:1151743,Name:"{\"text\":\"Piñiata's Plush Jacket\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
44+
replaceitem entity @s[scores={sat_leaderboard=39..42}] armor.chest leather_chestplate{display:{color:6955247,Name:"{\"text\":\"Piñiata's Magical Jacket\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
45+
replaceitem entity @s[scores={sat_leaderboard=43..}] armor.chest leather_chestplate{display:{color:8716537,Name:"{\"text\":\"Piñiata's Robe\",\"italic\":\"false\"}"},Unbreakable:1b,AttributeModifiers:[{AttributeName:"generic.armor",Name:"generic.armor",Slot:"chest",Amount:0,Operation:0,UUIDMost:10513,UUIDLeast:111743}],Enchantments:[{id:"binding_curse",lvl:1},{id:"vanishing_curse",lvl:1}],HideFlags:1} 1
46+
47+
# pay participation fee if player has at least 1 point
48+
execute if score @s sat_leaderboard matches 1.. run function stack_attack_arena:setup/pay_participation_fee

data/stack_attack_mechanics/functions/init.mcfunction

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ scoreboard objectives add sat_arena_state dummy
1313
scoreboard objectives add sat_round_timer dummy
1414
scoreboard objectives add sat_leaderboard dummy [{"text":"S","color":"yellow"},{"text":"tack ","color":"light_purple"},{"text":"A","color":"blue"},{"text":"ttack","color":"green"}]
1515
scoreboard objectives add sat_hunger food
16-
scoreboard objectives add sat_match_size dummy
16+
scoreboard objectives add sat_match_value dummy
1717
scoreboard objectives add sat_deaths deathCount
1818
scoreboard objectives add sat_quit_game minecraft.custom:minecraft.leave_game
1919
scoreboard objectives add sat_totem minecraft.used:minecraft.totem_of_undying

0 commit comments

Comments
 (0)