public void EatIt(PlayerStats ps) { if (conditionState == Condition.Regeneration) ps.GoodBerry(amount, duration); else if (conditionState == Condition.Degenration) ps.BadBerry(amount, duration, ps.transform); else //if (conditionState == Condition.Random) RandomCondition(ps); }
/// <summary> /// Receive a psuedo random condition. /// </summary> public void RandomCondition(PlayerStats ps) { System.Array values = Condition.GetValues(typeof(Condition)); System.Random random = new System.Random(); conditionState = (Condition)values.GetValue(random.Next(values.Length)); while (conditionState == Condition.None || conditionState == Condition.Random) { conditionState = (Condition)values.GetValue(random.Next(values.Length)); } if (conditionState == Condition.Regeneration) ps.GoodBerry(amount, duration); if (conditionState == Condition.Degenration) ps.BadBerry(amount, duration, ps.transform); }