pear.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. class Pear : 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 void SetActions()
  16. {
  17. super.SetActions();
  18. AddAction(ActionForceFeed);
  19. AddAction(ActionEatFruit);
  20. AddAction(ActionCreateIndoorFireplace);
  21. AddAction(ActionCreateIndoorOven);
  22. }
  23. override bool CanDecay()
  24. {
  25. return true;
  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. }