public static string RestoreToString(PlayerStatusRestore restore) { string result = string.Empty; switch (restore) { case PlayerStatusRestore.A_None: result = "none"; break; case PlayerStatusRestore.B_OneFifth: result = "one fifth"; break; case PlayerStatusRestore.C_TwoFifths: result = "two fifths"; break; case PlayerStatusRestore.D_ThreeFifths: result = "three fifths"; break; case PlayerStatusRestore.E_FourFifths: result = "four fifths"; break; case PlayerStatusRestore.F_Full: result = "all"; break; default: break; } return(result); }
public static float RestoreToFloat(PlayerStatusRestore restore) { float result = 0.0f; switch (restore) { case PlayerStatusRestore.A_None: result = 0.0f; break; case PlayerStatusRestore.B_OneFifth: result = 0.2f; break; case PlayerStatusRestore.C_TwoFifths: result = 0.4f; break; case PlayerStatusRestore.D_ThreeFifths: result = 0.6f; break; case PlayerStatusRestore.E_FourFifths: result = 0.8f; break; case PlayerStatusRestore.F_Full: result = 1.0f; break; default: break; } return(result); }
public static PlayerStatusRestore DoubleRestore(PlayerStatusRestore restore) { PlayerStatusRestore doubled = PlayerStatusRestore.A_None; switch (restore) { case PlayerStatusRestore.A_None: doubled = PlayerStatusRestore.A_None; break; case PlayerStatusRestore.B_OneFifth: doubled = PlayerStatusRestore.C_TwoFifths; break; case PlayerStatusRestore.C_TwoFifths: doubled = PlayerStatusRestore.D_ThreeFifths; break; case PlayerStatusRestore.D_ThreeFifths: doubled = PlayerStatusRestore.E_FourFifths; break; case PlayerStatusRestore.E_FourFifths: doubled = PlayerStatusRestore.F_Full; break; default: doubled = PlayerStatusRestore.F_Full; break; } return(doubled); }
public static void Eat(FoodStuff foodstuff) { if (foodstuff == null) { return; } FoodStuffProps Props = foodstuff.Props; if (!string.IsNullOrEmpty(Props.ConditionName)) { if (UnityEngine.Random.value <= Props.ConditionChance) { Player.Local.Status.AddCondition(Props.ConditionName); } } PlayerStatusRestore hungerRestore = PlayerStatusRestore.A_None; PlayerStatusRestore healthRestore = PlayerStatusRestore.A_None; PlayerStatusRestore healthReduce = PlayerStatusRestore.A_None; HallucinogenicStrength hallucinogen = HallucinogenicStrength.None; bool wellFed = false; if (Flags.Check((uint)Props.Type, (uint)FoodStuffEdibleType.Edible, Flags.CheckType.MatchAny)) { hungerRestore = Props.HungerRestore; } if (Flags.Check((uint)Props.Type, (uint)FoodStuffEdibleType.Hallucinogen, Flags.CheckType.MatchAny)) { hallucinogen = Props.Hallucinogen; } if (Flags.Check((uint)Props.Type, (uint)FoodStuffEdibleType.Medicinal, Flags.CheckType.MatchAny)) { healthRestore = Props.HealthRestore; } if (Flags.Check((uint)Props.Type, (uint)FoodStuffEdibleType.Poisonous, Flags.CheckType.MatchAny)) { healthReduce = Props.HealthReduce; } if (Flags.Check((uint)Props.Type, (uint)FoodStuffEdibleType.WellFed, Flags.CheckType.MatchAny)) { hungerRestore = PlayerStatusRestore.F_Full; wellFed = true; } Player.Local.Status.ReduceStatus(healthReduce, "Health"); if (foodstuff.Props.IsLiquid) { Player.Local.Status.RestoreStatus(hungerRestore, "Thirst"); } else { Player.Local.Status.RestoreStatus(hungerRestore, "Hunger"); } Player.Local.Status.RestoreStatus(healthRestore, "Health"); if (wellFed) { Player.Local.Status.AddCondition("WellFed"); } MasterAudio.PlaySound(MasterAudio.SoundType.PlayerVoiceMale, Props.EatFoodSound); if (!string.IsNullOrEmpty(Props.CustomStatusKeeperRestore)) { Player.Local.Status.RestoreStatus(Props.CustomRestore, Props.CustomStatusKeeperRestore); } if (!string.IsNullOrEmpty(Props.CustomStatusKeeperReduce)) { Player.Local.Status.RestoreStatus(Props.CustomRestore, Props.CustomStatusKeeperReduce); } if (foodstuff.worlditem != null && !foodstuff.worlditem.IsTemplate) { foodstuff.OnEat.SafeInvoke(); if (foodstuff.State.ConsumeOnEat) { //Debug.Log ("FOODSTUFF: Setting mode to RemovedFromGame"); foodstuff.worlditem.SetMode(WIMode.RemovedFromGame); } } }
public void ReduceStatus(PlayerStatusRestore reduce, string type) { ReduceStatus(Frontiers.Status.RestoreToFloat(reduce), type); }
public void ReduceStatus(PlayerStatusRestore reduce, string type, float multiplier) { ReduceStatus(Frontiers.Status.RestoreToFloat(reduce) * multiplier, type); }
public void RestoreStatus(PlayerStatusRestore restore, string type, float multiplier) { float restoreToFloat = Frontiers.Status.RestoreToFloat(restore) * multiplier; RestoreStatus(restoreToFloat, type); }