using System;
using System.Collections.Generic;
using MaidStatus;

public static class YotogiPlay
{
	public static Yotogi.ExcitementStatus GetExcitementStatus(int excite)
	{
		if (excite < 0)
		{
			return Yotogi.ExcitementStatus.Minus;
		}
		if (excite < 100)
		{
			return Yotogi.ExcitementStatus.Small;
		}
		if (excite < 200)
		{
			return Yotogi.ExcitementStatus.Medium;
		}
		return Yotogi.ExcitementStatus.Large;
	}

	public static Yotogi.RCType GetRCType(int before_excite, int current_excite)
	{
		if (before_excite <= 199 && 200 <= current_excite)
		{
			return Yotogi.RCType.RC2;
		}
		if (before_excite <= 99 && 100 <= current_excite)
		{
			return Yotogi.RCType.RC1;
		}
		if (before_excite <= -1 && 0 <= current_excite)
		{
			return Yotogi.RCType.RC0;
		}
		return Yotogi.RCType.RCNull;
	}

	public static Yotogi.RRCType GetRRCType(int before_excite, int current_excite)
	{
		if (before_excite == current_excite && current_excite == 300)
		{
			return Yotogi.RRCType.RRC9;
		}
		Func<int, bool> func = delegate(int thresholdNum)
		{
			if (thresholdNum < 0)
			{
				return (before_excite <= thresholdNum && thresholdNum < current_excite) || (before_excite > thresholdNum && thresholdNum >= current_excite);
			}
			return before_excite < thresholdNum && thresholdNum <= current_excite;
		};
		foreach (KeyValuePair<int, Yotogi.RRCType> keyValuePair in new List<KeyValuePair<int, Yotogi.RRCType>>
		{
			new KeyValuePair<int, Yotogi.RRCType>(-50, Yotogi.RRCType.RRC_2),
			new KeyValuePair<int, Yotogi.RRCType>(-25, Yotogi.RRCType.RRC_1),
			new KeyValuePair<int, Yotogi.RRCType>(25, Yotogi.RRCType.RRC1),
			new KeyValuePair<int, Yotogi.RRCType>(50, Yotogi.RRCType.RRC2),
			new KeyValuePair<int, Yotogi.RRCType>(75, Yotogi.RRCType.RRC3),
			new KeyValuePair<int, Yotogi.RRCType>(125, Yotogi.RRCType.RRC4),
			new KeyValuePair<int, Yotogi.RRCType>(150, Yotogi.RRCType.RRC5),
			new KeyValuePair<int, Yotogi.RRCType>(175, Yotogi.RRCType.RRC6),
			new KeyValuePair<int, Yotogi.RRCType>(225, Yotogi.RRCType.RRC7),
			new KeyValuePair<int, Yotogi.RRCType>(250, Yotogi.RRCType.RRC8),
			new KeyValuePair<int, Yotogi.RRCType>(275, Yotogi.RRCType.RRC9),
			new KeyValuePair<int, Yotogi.RRCType>(300, Yotogi.RRCType.RRC9)
		})
		{
			if (func(keyValuePair.Key))
			{
				return keyValuePair.Value;
			}
		}
		return Yotogi.RRCType.RRCNull;
	}

	public static Yotogi.RRType GetRRType(int current_excite)
	{
		int num = Math.Abs(current_excite) / 50;
		if (current_excite < 0)
		{
			num++;
			if (2 < num)
			{
				num = 2;
			}
			num *= -1;
		}
		else if (5 < num)
		{
			num = 5;
		}
		return Yotogi.RRType.RR1 + num;
	}

	public enum PlayerState
	{
		Normal,
		Insert
	}

	public struct Param
	{
		public static YotogiPlay.Param Create(Maid maid)
		{
			Status status = maid.status;
			return new YotogiPlay.Param
			{
				currentExcite = status.currentExcite,
				currentMind = status.currentMind,
				cur_sensory = status.currentSensual,
				inyoku = status.inyoku,
				m_value = status.mvalue,
				hentai = status.hentai,
				housi = status.housi,
				lovely = status.lovely,
				elegance = status.elegance,
				charm = status.charm,
				reception = status.reception,
				teach_rate = status.teachRate,
				yotogi_type_level = status.selectedJobClass.level,
				yotogi_type_total_exp = status.selectedJobClass.expSystem.GetTotalExp()
			};
		}

		public static YotogiPlay.Param operator +(YotogiPlay.Param a, YotogiPlay.Param b)
		{
			return new YotogiPlay.Param
			{
				currentExcite = a.currentExcite + b.currentExcite,
				currentMind = a.currentMind + b.currentMind,
				cur_sensory = a.cur_sensory + b.cur_sensory,
				inyoku = a.inyoku + b.inyoku,
				m_value = a.m_value + b.m_value,
				hentai = a.hentai + b.hentai,
				housi = a.housi + b.housi,
				lovely = a.lovely + b.lovely,
				elegance = a.elegance + b.elegance,
				charm = a.charm + b.charm,
				reception = a.reception + b.reception,
				teach_rate = a.teach_rate + b.teach_rate,
				yotogi_type_level = a.yotogi_type_level + b.yotogi_type_level,
				yotogi_type_total_exp = a.yotogi_type_total_exp + b.yotogi_type_total_exp
			};
		}

		public static YotogiPlay.Param operator -(YotogiPlay.Param a, YotogiPlay.Param b)
		{
			return new YotogiPlay.Param
			{
				currentExcite = a.currentExcite - b.currentExcite,
				currentMind = a.currentMind - b.currentMind,
				cur_sensory = a.cur_sensory - b.cur_sensory,
				inyoku = a.inyoku - b.inyoku,
				m_value = a.m_value - b.m_value,
				hentai = a.hentai - b.hentai,
				housi = a.housi - b.housi,
				lovely = a.lovely - b.lovely,
				elegance = a.elegance - b.elegance,
				charm = a.charm - b.charm,
				reception = a.reception - b.reception,
				teach_rate = a.teach_rate - b.teach_rate,
				yotogi_type_level = a.yotogi_type_level - b.yotogi_type_level,
				yotogi_type_total_exp = a.yotogi_type_total_exp - b.yotogi_type_total_exp
			};
		}

		public int currentExcite;

		public int currentMind;

		public int cur_sensory;

		public int inyoku;

		public int m_value;

		public int hentai;

		public int housi;

		public int lovely;

		public int elegance;

		public int charm;

		public int reception;

		public int teach_rate;

		public int yotogi_type_level;

		public int yotogi_type_total_exp;
	}
}
