From 52f078849eb72da9d82d613c3e9ef1335e0ed8ad Mon Sep 17 00:00:00 2001 From: elb <51070858+elobo91@users.noreply.github.com> Date: Mon, 16 Dec 2024 09:44:33 -0500 Subject: [PATCH] Allow teleport in duriel room only (#579) --- internal/game/data.go | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/internal/game/data.go b/internal/game/data.go index 3b1289d4..8ca50c3d 100644 --- a/internal/game/data.go +++ b/internal/game/data.go @@ -18,18 +18,26 @@ type Data struct { } func (d Data) CanTeleport() bool { - if !d.CharacterCfg.Character.UseTeleport { - return false - } - - // Duriel's Lair is bugged and teleport doesn't work here - if d.PlayerUnit.Area == area.DurielsLair { - return false - } - - _, isTpBound := d.KeyBindings.KeyBindingForSkill(skill.Teleport) - - return isTpBound && !d.PlayerUnit.Area.IsTown() + if !d.CharacterCfg.Character.UseTeleport { + return false + } +// In Duriel Lair we can teleport only in boss room +// Only enable Teleport in largest room where is Duriel + if d.PlayerUnit.Area == area.DurielsLair { + if len(d.AreaData.Rooms) > 0 { + bossRoom := d.AreaData.Rooms[0] + for _, room := range d.AreaData.Rooms { + if (room.Width * room.Height) > (bossRoom.Width * bossRoom.Height) { + bossRoom = room + } + } + return bossRoom.IsInside(d.PlayerUnit.Position) + } + return false + } + + _, isTpBound := d.KeyBindings.KeyBindingForSkill(skill.Teleport) + return isTpBound && !d.PlayerUnit.Area.IsTown() } func (d Data) PlayerCastDuration() time.Duration {