public void SetTarget(int x, int y, int randomHitRange, LogicGameObject target, bool randomHitPosition) { this.m_target = target; this.m_targetPosition.m_x = target.GetMidX() * 8; this.m_targetPosition.m_y = target.GetMidY() * 8; if (target.GetGameObjectType() == LogicGameObjectType.CHARACTER) { LogicCharacter character = (LogicCharacter)target; if (character.IsFlying()) { LogicCombatComponent combatComponent = target.GetCombatComponent(); this.m_randomHitRange = combatComponent != null && combatComponent.IsHealer() ? 200 : 1000; this.m_flyingTarget = true; } if (randomHitPosition) { LogicVector2 pos = new LogicVector2(this.m_targetPosition.m_x >> 3, this.m_targetPosition.m_y >> 3); int distance = pos.GetDistance(this.GetPosition()); this.m_unk168.m_x = this.m_targetPosition.m_x - 8 * this.GetMidX(); this.m_unk168.m_y = this.m_targetPosition.m_y - 8 * this.GetMidY(); this.m_unk168.Rotate(90); this.m_unk168.Normalize(64); int rnd = ((distance / 10) & this.Rand(randomHitRange)) - distance / 20; this.m_unk168.m_x = this.m_unk168.m_x * rnd / 64; this.m_unk168.m_y = this.m_unk168.m_y * rnd / 64; pos.Destruct(); } } else { int range = target.IsWall() ? 1016 : 2040; this.m_unk168.m_x = 8 * x - this.m_targetPosition.m_x; this.m_unk168.m_y = 8 * y - this.m_targetPosition.m_y; this.m_unk168.Normalize(((target.GetWidthInTiles() - target.PassableSubtilesAtEdge()) << 12) / 3); this.m_unk168.m_x += (range & this.Rand(randomHitRange)) * (2 * (this.Rand(randomHitRange + 1) & 1) - 1); this.m_unk168.m_y += (range & this.Rand(randomHitRange + 2)) * (2 * (this.Rand(randomHitRange + 3) & 1) - 1); this.m_targetPosition.Add(this.m_unk168); this.m_randomHitRange = 150; } }
public void ObjectClose(LogicGameObject gameObject) { LogicHitpointComponent hitpointComponent = gameObject.GetHitpointComponent(); if (hitpointComponent == null || hitpointComponent.GetTeam() != 1) { if (gameObject.GetGameObjectType() == LogicGameObjectType.CHARACTER) { LogicCharacter character = (LogicCharacter)gameObject; LogicCharacterData data = character.GetCharacterData(); if (data.GetHousingSpace() < this.m_minTriggerHousingLimit) { return; } } LogicCombatComponent combatComponent = gameObject.GetCombatComponent(); if (combatComponent == null || combatComponent.GetUndergroundTime() <= 0) { if ((!gameObject.IsFlying() || this.m_airTrigger) && (gameObject.IsFlying() || this.m_groundTrigger)) { if (this.m_healerTrigger || combatComponent == null || !combatComponent.IsHealer()) { int distanceX = gameObject.GetX() - this.m_parent.GetMidX(); int distanceY = gameObject.GetY() - this.m_parent.GetMidY(); if (LogicMath.Abs(distanceX) <= this.m_triggerRadius && LogicMath.Abs(distanceY) <= this.m_triggerRadius && distanceX * distanceX + distanceY * distanceY < (uint)(this.m_triggerRadius * this.m_triggerRadius)) { this.Trigger(); } } } } } }