Difference between revisions of "Eating"

From IvanWiki
Jump to navigation Jump to search
(Some of this is probably wrong, I'm trying to get my head around the spoil code and I cannot brain today.)
 
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{Code}}
 
{{spoiler}}
 
{{spoiler}}
  
Eating is the act of (e)ating any kind of [[food]] available in the game. Eating anything provides nourishment, changing your "fullness" status for better or worse. Eating certain types of food can also bestow various effects upon the player.
+
Eating is the act of (e)ating or (D)rinking any kind of [[food]] (or fluid) available in the game. Eating anything provides nourishment, changing your "fullness" status for better or worse. Eating certain types of food can also bestow various effects upon the player.
  
 
For a food item to be edible, it must be tagged with a compatible ConsumeType in materials.dat for whatever is doing the eating (e.g. humans can eat CT_FRUIT, CT_MEAT, CT_PROCESSED and CT_LIQUID but not CT_BONE like canines can.)<br>
 
For a food item to be edible, it must be tagged with a compatible ConsumeType in materials.dat for whatever is doing the eating (e.g. humans can eat CT_FRUIT, CT_MEAT, CT_PROCESSED and CT_LIQUID but not CT_BONE like canines can.)<br>
Line 7: Line 8:
  
 
The amount of nutrition one receives upon eating a food item is determined by the '''item's edible volume''' and its '''nutritional value''' divided by its '''spoil level'''.<br>
 
The amount of nutrition one receives upon eating a food item is determined by the '''item's edible volume''' and its '''nutritional value''' divided by its '''spoil level'''.<br>
That is to say a food item will fill up the player more if it is high is volume and/or nutritional value, and will fill you up less if it is spoiled.
+
That is to say a food item will fill up the player more if it is high in volume and/or nutritional value, and will fill you up less if it is spoiled.
  
 
<pre>material* organic::EatEffect(character* Eater, long Amount)
 
<pre>material* organic::EatEffect(character* Eater, long Amount)
Line 39: Line 40:
 
     return MotherEntity->RemoveMaterial(this);
 
     return MotherEntity->RemoveMaterial(this);
 
}</pre>
 
}</pre>
 +
 +
== Fullness ==
 +
Every character that can eat has a "fullness" value, measured in '''NP''' (Nutrition Points). This is initially set to 50,000 for a hunger state between NOT_HUNGRY and SATIATED.<br>
 +
Eating food directly increases a character's NP by the value found during the "ReceiveNutrition(...)" process detailed above.<br>
 +
A character's hunger level changes once it crosses the threshold into the next fullness level, or drops below its current one. When a character's NP hits zero, the character will die.
 +
 +
The NP thresholds are detailed below as found within ivandef.h:
 +
<pre>
 +
#define OVER_FED_LEVEL 175000
 +
#define BLOATED_LEVEL 150000
 +
#define SATIATED_LEVEL 100000
 +
#define NOT_HUNGER_LEVEL 30000
 +
#define HUNGER_LEVEL 20000
 +
#define VERY_HUNGER_LEVEL 10000
 +
</pre>
 +
 +
A character's fullness also influences its experience gains, with hunger states abusing ASTR and LSTR, and full states abusing AGI.<br>
 +
Once a character reaches STARVING they will begin falling unconscious at random, whereas trying to eat while at maximum NP will induce [[vomiting]] and thus stat abuse.
 +
<pre>  switch(GetHungerState())
 +
  {
 +
  case STARVING:
 +
    EditExperience(ARM_STRENGTH, -75, 1 << 3);
 +
    EditExperience(LEG_STRENGTH, -75, 1 << 3);
 +
    break;
 +
  case VERY_HUNGRY:
 +
    EditExperience(ARM_STRENGTH, -50, 1 << 2);
 +
    EditExperience(LEG_STRENGTH, -50, 1 << 2);
 +
    break;
 +
  case HUNGRY:
 +
    EditExperience(ARM_STRENGTH, -25, 1 << 1);
 +
    EditExperience(LEG_STRENGTH, -25, 1 << 1);
 +
    break;
 +
  case SATIATED:
 +
    EditExperience(AGILITY, -25, 1 << 1);
 +
    break;
 +
  case BLOATED:
 +
    EditExperience(AGILITY, -50, 1 << 2);
 +
    break;
 +
  case OVER_FED:
 +
    EditExperience(AGILITY, -75, 1 << 3);
 +
    break;
 +
  }</pre>
  
 
== Spoiling ==
 
== Spoiling ==
Every organic material in the game rots away at a steady pace influenced by its '''SpoilModifier'''. Initially, every food item has a small grace period before it can start spoiling. After this the game will start checking against its spoil modifier in order to add to the item's spoil level. The higher the item's SpoilModifier, the slower it will rot. When an item reaches the maximum spoil level, it will rot away to nothing.
+
Every organic material in the game rots away at a steady pace influenced by its '''SpoilModifier'''. Initially, every food item has a small grace period before it can start spoiling. After this the game will start checking against its spoil modifier in order to add to the item's spoil level. The higher the item's SpoilModifier, the slower it will rot. When an item reaches the maximum spoil level of 8, it will rot away to nothing. The player can gauge an item's spoil level by the number of flies circling it.
  
 
Eating a spoiled item comes with some risks - particularly with meats. Firstly, spoiled food is less nutritious. Second and much more important is that any food that has even a single level of spoiling can inflict confusion upon the eater for a period influenced by its volume and spoil level divided by its nutritional value. In addition, if the item can contain parasites (e.g. most meats) there is a chance that the eater will also gain a tapeworm or broad tapeworm which will inflict damage over time and can only be removed via vomiting.<br>
 
Eating a spoiled item comes with some risks - particularly with meats. Firstly, spoiled food is less nutritious. Second and much more important is that any food that has even a single level of spoiling can inflict confusion upon the eater for a period influenced by its volume and spoil level divided by its nutritional value. In addition, if the item can contain parasites (e.g. most meats) there is a chance that the eater will also gain a tapeworm or broad tapeworm which will inflict damage over time and can only be removed via vomiting.<br>
Line 81: Line 124:
 
   }
 
   }
 
}</pre>
 
}</pre>
 
  
 
== Special Effects ==
 
== Special Effects ==
Line 87: Line 129:
  
 
Some food items possess special properties and grant various effects when eaten.
 
Some food items possess special properties and grant various effects when eaten.
*The [[Holy Banana of Oily Orpiv]] buffs all of your stats by 1 and maximizes your fullness.
+
 
*Ommel materials will buff stats:
+
'''Meats:'''
** [[Ommel Bone]] and [[Ommel Tooth]] will buff ALL of your stats, with particular focus on AGI, PER and CHA.
+
*All rotten meat can cause parasites, poison, and confusion.
** [[Ommel Cerumen]] will boost your INT and WIS.
+
*Acidic flesh (e.g. dark frogs) will cause internal acid burns.
** [[Ommel Snot]] increases your END.
+
*[[Blink Dog]] flesh will grant [[telecontrol]].
** [[Ommel Sweat]] grants a bonus to your AGI and DEX.
+
*[[Chameleon]] flesh will inflict [[polymorph|polymorphitis]].
** [[Ommel Tears]] raises your PER and CHA.
+
*Leper meat will cause leprosy (e.g. [[Zombie]] flesh.)
** [[Ommel Urine]] improves your ASTR and LSTR.
+
*[[Giant Mushroom|Mushroom]] and Magical Mushroom flesh will grant a random status effect.
 +
*Meat that is the same material as your torso will shift your alignment toward chaotic.
 +
*Mutant flesh (e.g. [[mutant rabbit]], [[Mutant Ass|mutant ass]]) will inflict [[polymorph|polymorphitis]].
 +
*Poisonous flesh (e.g. spiders, [[Snake|snakes]]) will inflict poison.
 +
*Unicorn corpses cause a variety of effects:
 +
**Black unicorn flesh grants ''every single status effect in the game''.
 +
**Gray unicorn flesh removes all non-permanent status effects and grants [[Teleport|teleportitis]].
 +
**White unicorn flesh removes all negative status effects except for [[Teleport|teleportitis]], [[polymorph|polymorphitis]] and confusion.
 +
*Werewolf flesh will cause [[Polymorph#Lycanthropy|lycanthropy]].
 +
 
 +
'''Ommel Materials:'''<br>
 +
* [[Ommel Bone]] and [[Ommel Tooth]] will buff ALL of your stats, with particular focus on AGI, PER and CHA.
 +
* [[Ommel Cerumen]] will boost your INT and WIS.
 +
* [[Ommel Snot]] increases your END.
 +
* [[Ommel Sweat]] grants a bonus to your AGI and DEX.
 +
* [[Ommel Tears]] raises your PER and CHA.
 +
* [[Ommel Urine]] improves your ASTR and LSTR.
 +
 
 +
'''Unique:'''
 +
*[[Carrot|Carrots]] raise your PER.
 +
*The [[Holy Banana of Oily Orpiv]] buffs all of your stats by a large amount of XP and maximizes your fullness.
 +
*[[School food]] has a chance to raise your END at the cost of poisoning you.
 +
 +
'''Liquids:'''
 +
*[[Antidote liquid]] cures poison and parasites.
 +
*[[Healing liquid]] will restore HP and has a chance to re-grow lost limbs.
 
*[[Pea soup]] produces a puff of [[Brown Gas|brown gas]] on the tile where you stand.
 
*[[Pea soup]] produces a puff of [[Brown Gas|brown gas]] on the tile where you stand.
 +
*[[Pepsi]] causes a small amount of damage, but raises PER.
 +
*[[Sulphuric acid]] causes internal acid burns and kills parasites.
 +
*[[Troll blood]] restores HP and has a smaller chance to re-grow limbs.
 +
*[[Water]] relieves exhaustion.
 +
*[[Vodka]] and [[Valdemar]] inflict confusion. Vodka cures [[panicked]].
 +
 +
[[Category:Game Mechanics]]

Latest revision as of 22:57, 2 October 2014

Coding: This article contains code which is for experienced users only, and may reveal game secrets

Spoiler Warning: This page contains spoilers which may affect your IVAN experience negatively


Eating is the act of (e)ating or (D)rinking any kind of food (or fluid) available in the game. Eating anything provides nourishment, changing your "fullness" status for better or worse. Eating certain types of food can also bestow various effects upon the player.

For a food item to be edible, it must be tagged with a compatible ConsumeType in materials.dat for whatever is doing the eating (e.g. humans can eat CT_FRUIT, CT_MEAT, CT_PROCESSED and CT_LIQUID but not CT_BONE like canines can.)
Currently, only liquids and organic materials have a nutrition value that dictates how filling they are.

The amount of nutrition one receives upon eating a food item is determined by the item's edible volume and its nutritional value divided by its spoil level.
That is to say a food item will fill up the player more if it is high in volume and/or nutritional value, and will fill you up less if it is spoiled.

material* organic::EatEffect(character* Eater, long Amount)
{
  Amount = Volume > Amount ? Amount : Volume;
  GetMotherEntity()->SpecialEatEffect(Eater, Amount);
  Effect(Eater, TORSO_INDEX, Amount);
  Eater->ReceiveNutrition(GetNutritionValue() * Amount * 20 / (1000 * (GetSpoilLevel() + 1)));

  if(IsInfectedByLeprosy() && Amount && !RAND_N(25000 / Amount))
    Eater->GainIntrinsic(LEPROSY);

  if(GetSpoilLevel() > 0)
  {
    Eater->BeginTemporaryState(CONFUSED, int(Amount * GetSpoilLevel() * sqrt(GetNutritionValue()) / 1000));

    if(GetBodyFlags() & CAN_HAVE_PARASITE
       && !(RAND() % (250 / GetSpoilLevel())))
      Eater->GainIntrinsic(PARASITIZED);
  }

  if(GetSpoilLevel() > 4)
    Eater->BeginTemporaryState(POISONED, int(Amount * (GetSpoilLevel() - 4) * sqrt(GetNutritionValue()) / 1000));

  if(Volume != Amount)
  {
    EditVolume(-Amount);
    return 0;
  }
  else
    return MotherEntity->RemoveMaterial(this);
}

Fullness

Every character that can eat has a "fullness" value, measured in NP (Nutrition Points). This is initially set to 50,000 for a hunger state between NOT_HUNGRY and SATIATED.
Eating food directly increases a character's NP by the value found during the "ReceiveNutrition(...)" process detailed above.
A character's hunger level changes once it crosses the threshold into the next fullness level, or drops below its current one. When a character's NP hits zero, the character will die.

The NP thresholds are detailed below as found within ivandef.h:

#define OVER_FED_LEVEL 175000
#define BLOATED_LEVEL 150000
#define SATIATED_LEVEL 100000
#define NOT_HUNGER_LEVEL 30000
#define HUNGER_LEVEL 20000
#define VERY_HUNGER_LEVEL 10000

A character's fullness also influences its experience gains, with hunger states abusing ASTR and LSTR, and full states abusing AGI.
Once a character reaches STARVING they will begin falling unconscious at random, whereas trying to eat while at maximum NP will induce vomiting and thus stat abuse.

  switch(GetHungerState())
  {
   case STARVING:
    EditExperience(ARM_STRENGTH, -75, 1 << 3);
    EditExperience(LEG_STRENGTH, -75, 1 << 3);
    break;
   case VERY_HUNGRY:
    EditExperience(ARM_STRENGTH, -50, 1 << 2);
    EditExperience(LEG_STRENGTH, -50, 1 << 2);
    break;
   case HUNGRY:
    EditExperience(ARM_STRENGTH, -25, 1 << 1);
    EditExperience(LEG_STRENGTH, -25, 1 << 1);
    break;
   case SATIATED:
    EditExperience(AGILITY, -25, 1 << 1);
    break;
   case BLOATED:
    EditExperience(AGILITY, -50, 1 << 2);
    break;
   case OVER_FED:
    EditExperience(AGILITY, -75, 1 << 3);
    break;
  }

Spoiling

Every organic material in the game rots away at a steady pace influenced by its SpoilModifier. Initially, every food item has a small grace period before it can start spoiling. After this the game will start checking against its spoil modifier in order to add to the item's spoil level. The higher the item's SpoilModifier, the slower it will rot. When an item reaches the maximum spoil level of 8, it will rot away to nothing. The player can gauge an item's spoil level by the number of flies circling it.

Eating a spoiled item comes with some risks - particularly with meats. Firstly, spoiled food is less nutritious. Second and much more important is that any food that has even a single level of spoiling can inflict confusion upon the eater for a period influenced by its volume and spoil level divided by its nutritional value. In addition, if the item can contain parasites (e.g. most meats) there is a chance that the eater will also gain a tapeworm or broad tapeworm which will inflict damage over time and can only be removed via vomiting.
Finally, if the item's spoil level is beyond 4 it will instantly poison the eater for a period influenced by its volume, spoil level and nutritional value.

void organic::Be(ulong Flags)
{
  if(SpoilCheckCounter++ >= 50)
  {
    if(MotherEntity->AllowSpoil())
    {
      if(Flags & HASTE)
	SpoilCounter += 125;
      else if(Flags & SLOW)
	SpoilCounter += 5;
      else
	SpoilCounter += 25;

      if(SpoilCounter < GetSpoilModifier())
      {
	if(SpoilCounter << 1 >= GetSpoilModifier())
	{
	  int NewSpoilLevel = ((SpoilCounter << 4) / GetSpoilModifier()) - 7;

	  if(NewSpoilLevel != SpoilLevel)
	  {
	    SpoilLevel = NewSpoilLevel;
	    MotherEntity->SignalSpoilLevelChange(this);
	  }
	}
      }
      else
      {
	SpoilLevel = 8;
	MotherEntity->SignalSpoil(this);
      }
    }

    SpoilCheckCounter = 0;
  }
}

Special Effects

//(work in progress)

Some food items possess special properties and grant various effects when eaten.

Meats:

  • All rotten meat can cause parasites, poison, and confusion.
  • Acidic flesh (e.g. dark frogs) will cause internal acid burns.
  • Blink Dog flesh will grant telecontrol.
  • Chameleon flesh will inflict polymorphitis.
  • Leper meat will cause leprosy (e.g. Zombie flesh.)
  • Mushroom and Magical Mushroom flesh will grant a random status effect.
  • Meat that is the same material as your torso will shift your alignment toward chaotic.
  • Mutant flesh (e.g. mutant rabbit, mutant ass) will inflict polymorphitis.
  • Poisonous flesh (e.g. spiders, snakes) will inflict poison.
  • Unicorn corpses cause a variety of effects:
    • Black unicorn flesh grants every single status effect in the game.
    • Gray unicorn flesh removes all non-permanent status effects and grants teleportitis.
    • White unicorn flesh removes all negative status effects except for teleportitis, polymorphitis and confusion.
  • Werewolf flesh will cause lycanthropy.

Ommel Materials:

Unique:

Liquids: