public override bool Walk(MirDirection dir) { if (!CanMove) { return(false); } Point location = Functions.PointMove(CurrentLocation, dir, 2); if (!CurrentMap.ValidPoint(location)) { return(false); } Cell cell = CurrentMap.GetCell(location); bool isBreak = false; if (cell.Objects != null) { for (int i = 0; i < cell.Objects.Count; i++) { MapObject ob = cell.Objects[i]; if (!ob.Blocking) { continue; } isBreak = true; break; } } if (isBreak) { location = Functions.PointMove(CurrentLocation, dir, 1); if (!CurrentMap.ValidPoint(location)) { return(false); } cell = CurrentMap.GetCell(location); if (cell.Objects != null) { for (int i = 0; i < cell.Objects.Count; i++) { MapObject ob = cell.Objects[i]; if (!ob.Blocking) { continue; } return(false); } } } CurrentMap.GetCell(CurrentLocation).Remove(this); Direction = dir; RemoveObjects(dir, 1); CurrentLocation = location; CurrentMap.GetCell(CurrentLocation).Add(this); AddObjects(dir, 1); if (Hidden) { Hidden = false; for (int i = 0; i < Buffs.Count; i++) { if (Buffs[i].Type != BuffType.Hiding) { continue; } Buffs[i].ExpireTime = 0; break; } } CellTime = Envir.Time + 500; ActionTime = Envir.Time + 300; MoveTime = Envir.Time + MoveSpeed; if (MoveTime > AttackTime) { AttackTime = MoveTime; } InSafeZone = CurrentMap.GetSafeZone(CurrentLocation) != null; if (isBreak) { Broadcast(new S.ObjectWalk { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); } else { Broadcast(new S.ObjectRun { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); } cell = CurrentMap.GetCell(CurrentLocation); for (int i = 0; i < cell.Objects.Count; i++) { if (cell.Objects[i].Race != ObjectType.Spell) { continue; } SpellObject ob = (SpellObject)cell.Objects[i]; ob.ProcessSpell(this); break; } return(true); }
public override bool Walk(MirDirection dir) { if (!CanMove) { return(false); } Point location = Functions.PointMove(CurrentLocation, dir, 1); if (!CurrentMap.ValidPoint(location)) { return(false); } Cell cell = CurrentMap.GetCell(location); if (cell.Objects != null) { for (int i = 0; i < cell.Objects.Count; i++) { MapObject ob = cell.Objects[i]; if (AvoidFireWall && ob.Race == ObjectType.Spell) { if (((SpellObject)ob).Spell == Spell.FireWall) { return(false); } } if (!ob.Blocking) { continue; } return(false); } } CurrentMap.GetCell(CurrentLocation).Remove(this); Direction = dir; RemoveObjects(dir, 1); CurrentLocation = location; CurrentMap.GetCell(CurrentLocation).Add(this); AddObjects(dir, 1); if (Hidden) { RemoveBuff(BuffType.Hiding); } CellTime = Envir.Time + 500; ActionTime = Envir.Time + 300; MoveTime = Envir.Time + MoveSpeed; if (MoveTime > AttackTime) { AttackTime = MoveTime; } InSafeZone = CurrentMap.GetSafeZone(CurrentLocation) != null; Broadcast(new S.ObjectWalk { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); cell = CurrentMap.GetCell(CurrentLocation); for (int i = 0; i < cell.Objects.Count; i++) { if (cell.Objects[i].Race != ObjectType.Spell) { continue; } SpellObject ob = (SpellObject)cell.Objects[i]; ob.ProcessSpell(this); //break; } return(true); }
public override bool Walk(MirDirection dir) { if (!CanMove) { return(false); } Point location = Functions.PointMove(CurrentLocation, dir, 1); if (!CurrentMap.ValidPoint(location)) { return(false); } //Cell cell = CurrentMap.GetCell(location); if (CurrentMap.Objects[location.X, location.Y] != null) { for (int i = 0; i < CurrentMap.Objects[location.X, location.Y].Count; i++) { MapObject ob = CurrentMap.Objects[location.X, location.Y][i]; if (AvoidFireWall && ob.Race == ObjectType.Spell) { if (((SpellObject)ob).Spell == Spell.FireWall) { return(false); } } if (!ob.Blocking) { continue; } return(false); } } CurrentMap.Remove(CurrentLocation.X, CurrentLocation.Y, this); Direction = dir; RemoveObjects(dir, 1); CurrentLocation = location; CurrentMap.Add(CurrentLocation.X, CurrentLocation.Y, this); AddObjects(dir, 1); if (Hidden) { Hidden = false; for (int i = 0; i < Buffs.Count; i++) { if (Buffs[i].Type != BuffType.Hiding) { continue; } Buffs[i].ExpireTime = 0; break; } } CellTime = Envir.Time + 500; ActionTime = Envir.Time + 300; MoveTime = Envir.Time + MoveSpeed; InSafeZone = CurrentMap.GetSafeZone(CurrentLocation) != null; Broadcast(new S.ObjectWalk { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); //cell = CurrentMap.GetCell(CurrentLocation); for (int i = 0; i < CurrentMap.Objects[CurrentLocation.X, CurrentLocation.Y].Count; i++) { if (CurrentMap.Objects[CurrentLocation.X, CurrentLocation.Y][i].Race != ObjectType.Spell) { continue; } SpellObject ob = (SpellObject)CurrentMap.Objects[CurrentLocation.X, CurrentLocation.Y][i]; ob.ProcessSpell(this); //break; } return(true); }