Skip to content

Commit

Permalink
Levels 1 & 2 now use the new mob controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frustrated-Programmer committed Jul 13, 2024
1 parent ec75be8 commit 35e2196
Show file tree
Hide file tree
Showing 32 changed files with 381 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ function do2:dungeon_setup/refill/all
execute if score $dungeon do2.config.fr.resetComposters matches 1 run function do2:dungeon_setup/reset_composters
execute if score $dungeon do2.config.fr.cakeGauntlet matches 1 run setblock -618 -47 1988 cake[bites=0]

function do2:level_controller/clone_storages
function do2:level_controller/get_mob_count/count_mobs
function do2:level_controller/get_mob_names/get_mob_names
function do2:dungeon_setup/summon/ravagers

# - Start Log -
execute as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: Testing for required entities. ("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§rIncludes:\n - Teleport Markers\n - Ravagers\n - Wardens\n - §oOne Eyed Willy§r\n - §oDavy Bones§r\n - §oEndermites§r\n - §oEvokers§r"}]}},{"text":")"}]
function do2:dungeon_setup/test_for_ravagers
#execute as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: Testing for required entities. ("},{"text":" ? ","color":"dark_red","hoverEvent":{"action":"show_text","contents":["",{"text":"§rIncludes:\n - Teleport Markers\n - Ravagers\n - Wardens\n - §oOne Eyed Willy§r\n - §oDavy Bones§r\n - §oEndermites§r\n - §oEvokers§r"}]}},{"text":")"}]
#function do2:dungeon_setup/test_for_ravagers
function do2:dungeon_setup/test_for_wardens
function do2:dungeon_setup/test_for_other_killers
function do2:dungeon_setup/test_for_markers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@
execute as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: Summoning Ravagers."}]
# - End Log -


#L1
function do2:level_controller/generate_mobs/l1z1
function do2:level_controller/generate_mobs/l1z2
function do2:level_controller/generate_mobs/l1z3
execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:level_controller/generate_mobs/l1z4
execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:level_controller/generate_mobs/l1z5
#L2
function do2:level_controller/generate_mobs/l2z1
function do2:level_controller/generate_mobs/l2z2
function do2:level_controller/generate_mobs/l2z3
execute if score $dungeon do2.config.mc.level2Zones matches 0 run function do2:level_controller/generate_mobs/l2z4
execute if score $dungeon do2.config.mc.level2Zones matches 0 run function do2:level_controller/generate_mobs/l2z5


#L1
execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:dungeon_setup/summon/no_zones/summon_level_1_killers
execute if score $dungeon do2.config.mc.level1Zones matches 1 run function do2:dungeon_setup/summon/with_zones/summon_level_1_killers
#execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:dungeon_setup/summon/no_zones/summon_level_1_killers
#execute if score $dungeon do2.config.mc.level1Zones matches 1 run function do2:dungeon_setup/summon/with_zones/summon_level_1_killers
#L2
execute if score $dungeon do2.config.mc.level2Zones matches 0 run function do2:dungeon_setup/summon/no_zones/summon_level_2_killers
execute if score $dungeon do2.config.mc.level2Zones matches 1 run function do2:dungeon_setup/summon/with_zones/summon_level_2_killers
#execute if score $dungeon do2.config.mc.level2Zones matches 0 run function do2:dungeon_setup/summon/no_zones/summon_level_2_killers
#execute if score $dungeon do2.config.mc.level2Zones matches 1 run function do2:dungeon_setup/summon/with_zones/summon_level_2_killers

# Death Gauntlet Ravager
summon minecraft:ravager -632 -48 1990 {PersistenceRequired:1b, Tags: ["L0DEATHROOM"], Invulnerable: 1b, Health: 100f, CustomName: '{"text":"nothing, they survived Decked Out"}', Fire: -1s}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ function do2:level_controller/get_mob_count/count_mobs
function do2:level_controller/get_mob_names/get_mob_names


# L1Z1

# L1
function do2:level_controller/generate_mobs/l1z1
function do2:level_controller/generate_mobs/l1z2
function do2:level_controller/generate_mobs/l1z3
execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:level_controller/generate_mobs/l1z4
execute if score $dungeon do2.config.mc.level1Zones matches 0 run function do2:level_controller/generate_mobs/l1z5

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# If no more mobs need to be made, return
execute if score $dungeon do2.utility.mobGeneration matches 0 run return

# Summon a ravager
summon minecraft:ravager -500 70 2000 {PersistenceRequired:1b, Invulnerable: 1b, Tags: ["newly_generated_mob","mob_being_worked_on"], Health: 100f, CustomName: '{"text":"NAME-NOT-INCLUDED"}', Fire: -1s}

# Count how many names are in the list.
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs mobNames

# Generate a random number, Min = 0, Max = Amount of names in the list
scoreboard players operation $dungeon do2.utility.randomNumberRange = $dungeon do2.utility.mobNamesCount
function do2:random_gen/generate_random_number

# Copy both the SCORE and the DATA as we will be making modifications
scoreboard players operation $dungeon_2 do2.utility.mobNamesCount = $dungeon do2.utility.randomNum
data modify storage do2:mobs copy set from storage do2:mobs mobNames
# Remove names until do2:mobs copy[0] becomes the randomly chosen name.
function do2:level_controller/generate_mobs/get_from_random_number

# Merge the randomly chosen name INTO the mob
data modify entity @e[tag=mob_being_worked_on,limit=1] CustomName set from storage do2:mobs copy[0]


# Note a mob has been generated
tag @e[tag=mob_being_worked_on] remove mob_being_worked_on
scoreboard players remove $dungeon do2.utility.mobGeneration 1
# If more mobs need to be summoned, run this function again
execute if score $dungeon do2.utility.mobGeneration matches 1.. run function do2:level_controller/generate_mobs/generate_a_ravager
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# If NO MORE need to be removed, return out of this function.
execute if score $dungeon_2 do2.utility.mobNamesCount matches ..0 run return 0
# Remove ONE from both the SCORE
scoreboard players remove $dungeon_2 do2.utility.mobNamesCount 1
# And remove ONE from the array
data remove storage do2:mobs copy[0]
# If MORE is needed to be remove, repeat this function
execute unless score $dungeon_2 do2.utility.mobNamesCount matches ..0 run function do2:level_controller/generate_mobs/get_from_random_number
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Check for issues
execute if score $l1z1 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z1's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone1
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z1's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level1_zone1 set value ['{"text":""}']


# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $dungeon do2.config.mc.level1Zone1MobCount
scoreboard players operation $dungeon do2.utility.mobGeneration = $l1z1 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level1_zone1

function do2:level_controller/generate_mobs/generate_a_mob
function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L1Z1,limit=1,sort=random]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l1z2 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z2's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone2
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z2's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level1_zone2 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l1z2 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level1_zone2

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L1Z2,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L1Z2
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l1z3 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z3's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone3
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z3's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level1_zone3 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l1z3 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level1_zone3

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L1Z3,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L1Z3
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l1z4 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z4's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone4
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z4's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level1_zone4 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l1z4 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level1_zone4

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L1Z4,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L1Z4
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l1z5 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z5's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level1_zone5
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L1Z5's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level1_zone5 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l1z5 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level1_zone5

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L1Z5,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L1Z5
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l2z1 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z5's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level2_zone1
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z5's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level2_zone1 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l2z1 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level2_zone1

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L2Z1,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L2Z1
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l2z2 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z2's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level2_zone2
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z2's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level2_zone2 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l2z2 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level2_zone2

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L2Z2,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L2Z2
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l2z3 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z3's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level2_zone3
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z3's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level2_zone3 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l2z3 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level2_zone3

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L2Z3,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L2Z3
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l2z4 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z4's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level2_zone4
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z4's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level2_zone4 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l2z4 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level2_zone4

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L2Z4,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L2Z4
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check for issues
execute if score $l2z5 do2.config.mc.levelZoneMobCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z5's mob count is empty. No mobs will generate in this zone."}]
execute store result score $dungeon do2.utility.mobNamesCount run data get storage do2:mobs level2_zone5
execute if score $dungeon do2.utility.mobNamesCount matches 0 as @a[scores={do2.logs.dungeon_setup=3..}] run tellraw @s ["",{"text":"[§9B§r]: L2Z5's mob names are empty. Mob's names will be empty."}]
execute if score $dungeon do2.utility.mobNamesCount matches 0 run data modify storage do2:mobs level2_zone5 set value ['{"text":""}']

# Setup
scoreboard players operation $dungeon do2.utility.mobGeneration = $l2z5 do2.config.mc.levelZoneMobCount
data modify storage do2:mobs mobNames set from storage do2:mobs level2_zone5

function do2:level_controller/generate_mobs/generate_a_ravager

# Finish
execute as @e[tag=newly_generated_mob] run tp @s @e[type=marker,tag=L2Z5,limit=1,sort=random]
execute as @e[tag=newly_generated_mob] run tag @s add L2Z5
execute as @e[tag=newly_generated_mob] run tag @s remove newly_generated_mob
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

scoreboard players set $dungeon do2.utility.mobCountCounterTotal 0

# Count each slot
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
function do2:level_controller/decide_mob_count/l1
function do2:level_controller/get_mob_count/l1
function do2:level_controller/get_mob_count/l2
Loading

0 comments on commit 35e2196

Please sign in to comment.