Difference between revisions of "Eating"

From IvanWiki
Jump to navigation Jump to search
Line 137: Line 137:
 
*Leper meat will cause leprosy (e.g. [[Zombie]] flesh.)
 
*Leper meat will cause leprosy (e.g. [[Zombie]] flesh.)
 
*[[Giant Mushroom|Mushroom]] and Magical Mushroom flesh will grant a random status effect.
 
*[[Giant Mushroom|Mushroom]] and Magical Mushroom flesh will grant a random status effect.
*Meat that is the same material as your torso will shift the player's alignment toward chaotic.
+
*Meat that is the same material as your torso will shift the your alignment toward chaotic.
 
*Mutant flesh (e.g. [[mutant rabbit]], [[Mutant Ass|mutant ass]]) will inflict [[polymorph|polymorphitis]].
 
*Mutant flesh (e.g. [[mutant rabbit]], [[Mutant Ass|mutant ass]]) will inflict [[polymorph|polymorphitis]].
 
*Poisonous flesh (e.g. spiders, [[Snake|snakes]]) will inflict poison.
 
*Poisonous flesh (e.g. spiders, [[Snake|snakes]]) will inflict poison.

Revision as of 04:25, 13 August 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, and trying to eat while at maximum NP will induce vomiting.

  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 the 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: