fix(spells): Fixes an edge case with casters current map (#643)

This commit is contained in:
Kamron Batman 2021-06-04 23:41:43 -07:00 committed by GitHub
parent 7ddf2b1a8f
commit ac4d349caa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -666,8 +666,8 @@ namespace Server.Spells
}
// Always allow monsters to teleport
if (caster is BaseCreature bc && !bc.Controlled && !bc.Summoned &&
(type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
if (caster is BaseCreature { Controlled: false, Summoned: false } &&
type is TravelCheckType.TeleportTo or TravelCheckType.TeleportFrom)
{
return true;
}
@ -681,7 +681,7 @@ namespace Server.Spells
if (caster != null)
{
var destination = Region.Find(loc, map) as BaseRegion;
var current = Region.Find(caster.Location, map) as BaseRegion;
var current = Region.Find(caster.Location, caster.Map) as BaseRegion;
if (destination?.CheckTravel(caster, loc, type) == false || current?.CheckTravel(caster, loc, type) == false)
{