Skip to content

Commit

Permalink
Add multi-target hunt modes closes GregHib#566
Browse files Browse the repository at this point in the history
  • Loading branch information
GregHib committed Dec 30, 2024
1 parent 801b3ba commit 0712977
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events

data class HuntFloorItem(
val mode: String,
val target: FloorItem
val targets: List<FloorItem>,
val target: FloorItem = targets.random()
) : Event {

override val size = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import world.gregs.voidps.engine.event.Events

data class HuntNPC(
val mode: String,
val target: NPC
val targets: List<NPC>,
val target: NPC = targets.random()
) : Event {

override val size = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events

data class HuntObject(
val mode: String,
val target: GameObject
val targets: List<GameObject>,
val target: GameObject = targets.random()
) : Event {

override val size = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events

data class HuntPlayer(
val mode: String,
val target: Player
val targets: List<Player>,
val target: Player = targets.random()
) : Event {

override val size = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
Expand Down

0 comments on commit 0712977

Please sign in to comment.