Skip to content

Commit

Permalink
Allow teleport in duriel room only (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
elobo91 authored Dec 16, 2024
1 parent 03913d0 commit 52f0788
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions internal/game/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 52f0788

Please sign in to comment.