From 0712977c4a6ae535232117178b710c18157dab74 Mon Sep 17 00:00:00 2001 From: GregHib Date: Sun, 22 Dec 2024 15:02:13 +0000 Subject: [PATCH] Add multi-target hunt modes closes #566 --- .../engine/entity/character/npc/hunt/HuntFloorItem.kt | 3 ++- .../voidps/engine/entity/character/npc/hunt/HuntNPC.kt | 3 ++- .../voidps/engine/entity/character/npc/hunt/HuntObject.kt | 3 ++- .../voidps/engine/entity/character/npc/hunt/HuntPlayer.kt | 3 ++- .../voidps/engine/entity/character/npc/hunt/Hunting.kt | 8 ++++---- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntFloorItem.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntFloorItem.kt index 7bbb6fb28f..41550361c0 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntFloorItem.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntFloorItem.kt @@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events data class HuntFloorItem( val mode: String, - val target: FloorItem + val targets: List, + val target: FloorItem = targets.random() ) : Event { override val size = 4 diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntNPC.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntNPC.kt index 7baa7b82f4..78d7fa93c1 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntNPC.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntNPC.kt @@ -7,7 +7,8 @@ import world.gregs.voidps.engine.event.Events data class HuntNPC( val mode: String, - val target: NPC + val targets: List, + val target: NPC = targets.random() ) : Event { override val size = 4 diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntObject.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntObject.kt index abd6e9ad6f..7dbe628a9f 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntObject.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntObject.kt @@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events data class HuntObject( val mode: String, - val target: GameObject + val targets: List, + val target: GameObject = targets.random() ) : Event { override val size = 4 diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntPlayer.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntPlayer.kt index d12f62dc0f..fc4a499352 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntPlayer.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntPlayer.kt @@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events data class HuntPlayer( val mode: String, - val target: Player + val targets: List, + val target: Player = targets.random() ) : Event { override val size = 3 diff --git a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/Hunting.kt b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/Hunting.kt index 0b5f76599d..b24082f840 100644 --- a/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/Hunting.kt +++ b/engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/Hunting.kt @@ -59,22 +59,22 @@ class Hunting( "player" -> { val targets = getCharacters(npc, players, range, definition) val target = targets.randomOrNull(seed) ?: continue - npc.emit(HuntPlayer(mode, target)) + npc.emit(HuntPlayer(mode, targets, target)) } "npc" -> { val targets = getCharacters(npc, npcs, range, definition) val target = targets.randomOrNull(seed) ?: continue - npc.emit(HuntNPC(mode, target)) + npc.emit(HuntNPC(mode, targets, target)) } "object" -> { val targets = getObjects(npc, definition) val target = targets.randomOrNull(seed) ?: continue - npc.emit(HuntObject(mode, target)) + npc.emit(HuntObject(mode, targets, target)) } "floor_item" -> { val targets = getItems(npc, range, definition) val target = targets.randomOrNull(seed) ?: continue - npc.emit(HuntFloorItem(mode, target)) + npc.emit(HuntFloorItem(mode, targets, target)) } } }