plum.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. class Plum : Edible_Base
  2. {
  3. override bool CanBeCooked()
  4. {
  5. return true;
  6. }
  7. override bool CanBeCookedOnStick()
  8. {
  9. return true;
  10. }
  11. override bool IsFruit()
  12. {
  13. return true;
  14. }
  15. override bool CanDecay()
  16. {
  17. return true;
  18. }
  19. override void SetActions()
  20. {
  21. super.SetActions();
  22. AddAction(ActionForceFeed);
  23. AddAction(ActionEatFruit);
  24. AddAction(ActionCreateIndoorFireplace);
  25. AddAction(ActionCreateIndoorOven);
  26. }
  27. override void EEOnCECreate()
  28. {
  29. int rand = Math.RandomInt(0,10);
  30. float baseTemp = GetGame().GetMission().GetWorldData().GetBaseEnvTemperature();
  31. if ( baseTemp <= GameConstants.COLD_AREA_TEMPERATURE_THRESHOLD )
  32. {
  33. int randQ = Math.RandomFloat(10,80);
  34. SetQuantity( randQ );
  35. if ( rand >= 9 )
  36. {
  37. ChangeFoodStage( FoodStageType.ROTTEN );
  38. SetHealth( "", "", GetMaxHealth()*0.1 );
  39. }
  40. else
  41. {
  42. ChangeFoodStage( FoodStageType.DRIED );
  43. SetHealth( "", "", GetMaxHealth()*0.4 );
  44. }
  45. }
  46. else
  47. {
  48. if ( rand > 6 )
  49. {
  50. ChangeFoodStage( FoodStageType.ROTTEN );
  51. SetHealth( "", "", GetMaxHealth()*0.1 );
  52. }
  53. else if ( rand > 2 )
  54. {
  55. ChangeFoodStage( FoodStageType.DRIED );
  56. SetHealth( "", "", GetMaxHealth()*0.4 );
  57. }
  58. }
  59. }
  60. }