using System;
using UnityEngine;

// Token: 0x0200004C RID: 76
public class SelectionCircle : MonoBehaviour
{
	// Token: 0x060008D3 RID: 2259 RVA: 0x000BF4A4 File Offset: 0x000BD6A4
	private void Start()
	{
		if (!this.rbody)
		{
			this.rbody = base.gameObject.GetComponent<Rigidbody>();
			if (!this.rbody)
			{
				this.rbody = base.gameObject.AddComponent<Rigidbody>();
				this.rbody.isKinematic = true;
				this.rbody.useGravity = false;
				base.gameObject.GetComponent<Collider>().isTrigger = true;
			}
		}
	}

	// Token: 0x060008D4 RID: 2260 RVA: 0x000BF518 File Offset: 0x000BD718
	private void OnTriggerEnter(Collider other)
	{
		if (!this.character)
		{
			return;
		}
		if (this.character.isHit && this.character.bouncer)
		{
			return;
		}
		GameObject gameObject = other.gameObject;
		if (gameObject && gameObject.layer == 20)
		{
			Character character = null;
			float num = 0f;
			CollisionListener component = other.gameObject.GetComponent<CollisionListener>();
			if (component)
			{
				if (!this.character.npc)
				{
					return;
				}
				character = component.c;
				num = component.rbody.linearVelocity.sqrMagnitude;
			}
			else
			{
				GoreListen component2 = other.gameObject.GetComponent<GoreListen>();
				if (component2 && component2.gore)
				{
					if (component2.gore.damageNone)
					{
						return;
					}
					if (component2.gore.damageOthers && !component2.gore.damageEveryone && !this.character.npc)
					{
						return;
					}
					character = component2.gore.character;
					if (Links.x.gameplay.seconds < component2.gore.startTime + 5f)
					{
						num = 1f;
					}
				}
			}
			if (num > 0.1f && character != this.character && character)
			{
				bool flag = true;
				Effects existingEffect = this.character.stats.GetExistingEffect("Impact");
				if (existingEffect && existingEffect.source == character)
				{
					flag = false;
				}
				if (this.character.stunned)
				{
					flag = false;
				}
				if (flag)
				{
					Effects effects = this.character.gameObject.AddComponent<Effects>();
					Links.x.cellar.AddEffects(effects);
					effects.source = character;
					effects.target = this.character;
					effects.effectName = "Impact";
					effects.sourceLevel = (float)character.stats.level / 2f;
					effects.Inflicted(true);
					if (Records.x.pocketPause)
					{
						this.character.OverridePocketPause();
					}
				}
			}
		}
	}

	// Token: 0x04000DFE RID: 3582
	public Character character;

	// Token: 0x04000DFF RID: 3583
	public Boat boat;

	// Token: 0x04000E00 RID: 3584
	public Rigidbody rbody;
}
