Skip to content

Commit ab8bc74

Browse files
Implement entities "confused" by SCP-268
1 parent 87c6962 commit ab8bc74

File tree

1 file changed

+13
-1
lines changed
  • src/main/java/dev/enderman/minecraft/plugins/scp/items

1 file changed

+13
-1
lines changed

src/main/java/dev/enderman/minecraft/plugins/scp/items/SCP268Item.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import org.bukkit.potion.PotionEffectType
1515

1616
val unaffectedEntities = listOfNotNull(
1717
EntityType.WARDEN,
18-
EntityType.ZOMBIE,
1918
EntityType.ENDERMAN,
2019
EntityType.GUARDIAN,
2120
EntityType.ELDER_GUARDIAN,
@@ -30,6 +29,14 @@ val lessAffectedEntities = listOfNotNull(
3029
EntityType.SHULKER
3130
)
3231

32+
/**
33+
* These entities have methods of sensing the player other than sight, meaning SCP-268 might confuse them and disorient them, but ultimately they still might be able to sense the player through their other means.
34+
*/
35+
val confusedEntities = listOfNotNull(
36+
EntityType.ZOMBIE,
37+
EntityType.IRON_GOLEM
38+
)
39+
3340
class SCP268Item(plugin: SCPPlugin) : TexturedItem(plugin, "scp_268", Material.LEATHER_HELMET) {
3441
@EventHandler
3542
private fun onEquip(event: PlayerArmorChangeEvent) {
@@ -56,6 +63,9 @@ class SCP268Item(plugin: SCPPlugin) : TexturedItem(plugin, "scp_268", Material.L
5663
for (entity in player.world.livingEntities) {
5764
if (entity !is Mob) continue
5865

66+
67+
if (confusedEntities.contains(entity.type) && Math.random() > 0.75) return
68+
5969
if (unaffectedEntities.contains(entity.type) || lessAffectedEntities.contains(entity.type)) continue
6070

6171
if (entity.target != player) continue
@@ -85,6 +95,8 @@ class SCP268Item(plugin: SCPPlugin) : TexturedItem(plugin, "scp_268", Material.L
8595
private fun onMobTarget(event: EntityTargetLivingEntityEvent) {
8696
val hostile = event.entity
8797

98+
if (confusedEntities.contains(hostile.type) && Math.random() > 0.5) return
99+
88100
if (unaffectedEntities.contains(hostile.type)) return
89101

90102
val target = event.target ?: return

0 commit comments

Comments
 (0)