private void OnEvaluatePassable(Object p_sender, EventArgs p_args) { Grid grid = LegacyLogic.Instance.MapLoader.Grid; Position position = ((InteractiveObject)MyController).Position; Boolean flag = false; GridSlot slot = grid.GetSlot(position); for (EDirection edirection = EDirection.NORTH; edirection <= EDirection.WEST; edirection++) { GridSlot slot2 = grid.GetSlot(position + edirection); if (slot2 != null) { Single num = Math.Abs(slot2.Height - slot.Height); flag |= (num <= m_allowedHightDelta); if (num <= m_allowedHightDelta) { slot.GetTransition(edirection).Open(); } else { slot.GetTransition(edirection).Close(); } if (edirection == EDirection.NORTH && num <= m_allowedHightDelta) { flag = true; } if (edirection == EDirection.EAST && num <= m_allowedHightDelta) { flag = true; } if (edirection == EDirection.SOUTH && num <= m_allowedHightDelta) { flag = true; } if (edirection == EDirection.WEST && num <= m_allowedHightDelta) { flag = true; } } } if (m_PlateRenderer != null && m_PlateRenderer.material != null) { if (flag) { m_PlateRenderer.material.SetFloat("_GlowMin", 0.5f); m_PlateRenderer.material.SetFloat("_GlowScale", 2f); } else { m_PlateRenderer.material.SetFloat("_GlowMin", 0f); m_PlateRenderer.material.SetFloat("_GlowScale", 0f); } } }
public override Boolean CheckSpellConditions(Character p_sorcerer) { if (SpellType == ECharacterSpell.WARFARE_CRIPPLING_TRAP) { Grid grid = LegacyLogic.Instance.MapLoader.Grid; GridSlot slot = grid.GetSlot(LegacyLogic.Instance.WorldManager.Party.Position); foreach (MovingEntity movingEntity in slot.Entities) { Summon summon = movingEntity as Summon; if (summon != null && summon.StaticID == 6) { return(false); } } return(true); } if (SpellType == ECharacterSpell.SPELL_PRIME_TIME_STOP || SpellType == ECharacterSpell.WARFARE_CRIPPLING_TRAP) { return(true); } Party party = LegacyLogic.Instance.WorldManager.Party; Grid grid2 = LegacyLogic.Instance.MapLoader.Grid; GridSlot slot2 = grid2.GetSlot(party.Position + party.Direction); GridSlot slot3 = grid2.GetSlot(LegacyLogic.Instance.WorldManager.Party.Position); return(slot2 != null && slot2.IsPassable(m_testEntity, false, true) && slot3.GetTransition(party.Direction).NextState != EGridTransitionType.CLOSED); }
public BaseDoorInteraction(SpawnCommand p_command, Int32 p_parentID, Int32 p_commandIndex) : base(p_command, p_parentID, p_commandIndex) { m_parent = Grid.FindInteractiveObject(m_parentID); m_targetDoor = (Door)Grid.FindInteractiveObject(m_targetSpawnID); if (m_targetDoor == null) { m_valid = false; return; } GridSlot slot = Grid.GetSlot(m_targetDoor.Position); m_leaveTransition = slot.GetTransition(m_targetDoor.Location); Position p_pos = m_targetDoor.Position + m_targetDoor.Location; GridSlot slot2 = Grid.GetSlot(p_pos); if (slot2 != null) { m_enterTransition = slot2.GetTransition(EDirectionFunctions.GetOppositeDir(m_targetDoor.Location)); } }
public virtual List <GridSlot> GetMeleeTargets(Grid p_grid, Party p_party) { List <GridSlot> list = new List <GridSlot>(); Int32 num = Math.Min(p_party.Position.X, m_owner.Position.X); Int32 num2 = Math.Min(p_party.Position.Y, m_owner.Position.Y); Int32 num3 = Math.Max(p_party.Position.X, m_owner.Position.X); Int32 num4 = Math.Max(p_party.Position.Y, m_owner.Position.Y); if (num == p_party.Position.X) { num--; num3 = num + 2; } if (num2 == p_party.Position.Y) { num2--; num4 = num2 + 2; } for (Int32 i = num; i <= num3; i++) { for (Int32 j = num2; j <= num4; j++) { Position position = new Position(i, j); if (!(position == p_party.Position) && !(position == m_owner.Position)) { GridSlot slot = p_grid.GetSlot(position); if (slot != null && slot.IsPassable(m_owner, false) && Position.Distance(position, p_party.Position) == 1f) { EDirection lineOfSightDirection = EDirectionFunctions.GetLineOfSightDirection(slot.Position, p_party.Position); if (slot.GetTransition(lineOfSightDirection).TransitionType == EGridTransitionType.OPEN) { list.Add(slot); } } } } } return(list); }
protected virtual void DoMelee(Boolean p_isMelee, Party p_party, Grid p_grid, GridSlot p_startSlot) { if (p_isMelee) { m_decision = EMonsterStrategyDecision.MELEE; if (m_owner.DistanceToParty <= 1f) { EDirection direction = EDirectionFunctions.GetDirection(m_owner.Position, p_party.Position); if (p_startSlot.GetTransition(direction).TransitionType == EGridTransitionType.CLOSED) { if (m_canOpenDoors) { TryOpenDoor(p_startSlot, direction); } return; } m_owner.RangedAttack = false; m_owner.CombatHandler.Attack(); return; } else { if (m_owner.DistanceToParty <= 1.6f) { return; } List <GridSlot> meleeTargets = GetMeleeTargets(p_grid, p_party); meleeTargets.Sort(new Comparison <GridSlot>(DistSortAsc)); if (meleeTargets.Count > 0) { if (TryMove(meleeTargets, p_grid, p_startSlot, p_party)) { return; } } else { Party party = LegacyLogic.Instance.WorldManager.Party; GridSlot slot = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(1, 1)); if (slot != null && slot.IsPassable(m_owner, false)) { meleeTargets.Add(slot); } GridSlot slot2 = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(-1, -1)); if (slot2 != null && slot2.IsPassable(m_owner, false)) { meleeTargets.Add(slot2); } GridSlot slot3 = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(-1, 1)); if (slot3 != null && slot3.IsPassable(m_owner, false)) { meleeTargets.Add(slot3); } GridSlot slot4 = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(1, -1)); if (slot4 != null && slot4.IsPassable(m_owner, false)) { meleeTargets.Add(slot4); } slot = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(0, 2)); if (slot != null && slot.IsPassable(m_owner, false)) { meleeTargets.Add(slot); } slot2 = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(2, 0)); if (slot2 != null && slot2.IsPassable(m_owner, false)) { meleeTargets.Add(slot2); } slot3 = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(-2, 0)); if (slot3 != null && slot3.IsPassable(m_owner, false)) { meleeTargets.Add(slot3); } slot4 = LegacyLogic.Instance.MapLoader.Grid.GetSlot(party.Position + new Position(0, -2)); if (slot4 != null && slot4.IsPassable(m_owner, false)) { meleeTargets.Add(slot4); } meleeTargets.RemoveAll((GridSlot t) => t.Position == m_owner.Position); if (meleeTargets.Count > 0 && TryMove(meleeTargets, p_grid, p_startSlot, p_party)) { return; } } } } }