Esempio n. 1
0
		Contact? FindReverseHit(Contact attack)
		{
			if (attack.Type != ContactType.Hit) throw new ArgumentOutOfRangeException("attack");

			foreach (Contact iter in m_attacks)
			{
				if (m_killist.Contains(iter) == true) continue;

				if (iter.Target == attack.Attacker && iter.Attacker == attack.Target)
				{
					return iter;
				}
			}

			return null;
		}
Esempio n. 2
0
		void RunAttack(Contact attack)
		{
			if (attack.Type == ContactType.Hit)
			{
				OnAttack(attack.Attacker, attack.Target, attack.HitDef, false);
			}
			else if (attack.Type == ContactType.Block)
			{
				OnAttack(attack.Attacker, attack.Target, attack.HitDef, true);
			}
			else if (attack.Type == ContactType.MissBlock)
			{
				OutOfRangeBlock(attack.Target);
			}
		}
Esempio n. 3
0
		Int32 ContactSort(Contact lhs, Contact rhs)
		{
			if (lhs.Type != rhs.Type) return Comparer<ContactType>.Default.Compare(lhs.Type, rhs.Type);

			if (lhs.Type == ContactType.Hit)
			{
				HitPriority hp_lhs = lhs.HitDef.HitPriority;
				HitPriority hp_rhs = rhs.HitDef.HitPriority;

				if (hp_lhs.Power == hp_rhs.Power) return 0;

				return (hp_lhs.Power < hp_rhs.Power) ? -1 : 1;
			}

			return 0;
		}
Esempio n. 4
0
		void PriorityCheck(Contact lhs, Contact rhs)
		{
			if (lhs.Type != ContactType.Hit) throw new ArgumentException("lhs");
			if (rhs.Type != ContactType.Hit) throw new ArgumentException("rhs");

			HitPriority lhs_hp = lhs.HitDef.HitPriority;
			HitPriority rhs_hp = rhs.HitDef.HitPriority;

			if (lhs_hp.Power > rhs_hp.Power)
			{
				m_killist.Add(rhs);
			}
			else if (lhs_hp.Power < rhs_hp.Power)
			{
				m_killist.Add(lhs);
			}
			else
			{
				if (lhs_hp.Type != PriorityType.Hit && rhs_hp.Type != PriorityType.Hit)
				{
					m_killist.Add(lhs);
					m_killist.Add(rhs);
				}
				else if (lhs_hp.Type == PriorityType.Dodge || rhs_hp.Type == PriorityType.Dodge)
				{
					m_killist.Add(lhs);
					m_killist.Add(rhs);
				}
				else if (lhs_hp.Type == PriorityType.Hit && rhs_hp.Type == PriorityType.Miss)
				{
					m_killist.Add(rhs);
				}
				else if (lhs_hp.Type == PriorityType.Hit && rhs_hp.Type == PriorityType.Miss)
				{
					m_killist.Add(lhs);
				}
			}
		}