using UnityEngine;
using System.Collections;

public class Ritual : MonoBehaviour {

	[Range(1,8)]
	public int difficulty;

	[Range(0f,1f)]
	public float probability;

	[Range(0,1f)]
	public float goodWow;

	[Range(-1f,0)]
	public float badWow;

	protected Adept[] selectedAdepts;

	public Light ambientLight;
	public Light fireLight;

	public bool CheckResult(Adept[] selectedAdepts){
		this.selectedAdepts = selectedAdepts;

		float rnd = Random.value;

		Debug.Log ("Thrown " + rnd + " for " + selectedAdepts.Length + " adepts");
		if (rnd < probability) {
			TriggerWon ();
			return true;
		} else {
			TriggerLosing ();
			return false;
		}
	}

	public void TriggerWon(){
		Debug.Log ("WON!");
		GameManager.instance.ModifyWow (goodWow);
	}

	public void TriggerLosing(){
		Debug.Log ("LOSE!");
		GameManager.instance.ModifyWow (badWow);
	}

	// Effect to be played when the effect takes place
	public virtual IEnumerator RitualEffectCO(){
		yield return null;
	}
}