Pet Training

Pet Training is done in-game by choosing Pet actions to perform with a "frequency slider" (see #Pet Behavior) and a specialized diet. A pet has to initiate an action on their own for their behavior to be adjusted.
__TOC__
== Pet Behavior ==
=== Behavior loop ===
Pets have the following sequence of actions, where any action fulfilling a need is skipped if that need is already metSettings/LingShou/Tree/Tree2.txt [Train] : Sleep > Drink > Shit > Eat > EatHigh (delicacies) > Atk > Learn > Help > HelpInner > Carry > Train > Free (it's how they play). When a sequence ends, another follows immediately. Some actions can interrupt the current sequence, most notably sect attacks. Moreover, actions can have conditions attached to them. In particular, training requires a certain amount of fun (depending on the pet's maturity) to not be skipped, and training depletes the entire fun bar of the pet.
In addition, when an action can be fulfilled in several ways the pet will choose among these depending on the behavior frequency adjustments and the conditions attached to some of those - for example the action to "Sleep in its own bed" is not considered if no bed has been built for the pet.
=== Behavior frequency ===
Behavior frequency can be adjusted between: never > rarely > occasionally > sometimes > often Some actions can't be adjusted and have a fixed chance of happening. Pets have an initial propensity to do certain actions. This matters as it affects their Bless/Curse rating until they are set by the player.
Activity 	Type 	Base 	
LsDog 	
LsFox	
LsPhoenix 	
LsDragon 	DLC
LsPandaXian	DLC
LsXuanWu
Sleep 	Rest 	occasionally	 	 	 	 	 	
Eat according to schedule 	Eat 	occasionally	 	 	 	 	 	
Eat feces 	Fun 	never 	often 	never 	never 	never 	never	never
Eat Precious Materials 	Fun 	never 	rarely 	rarely	often 	often 	 	occasionally
Drink Elixir 	Fun 	 	 	 	 	 	 	
Eat Wheat 	Eat 	 	rarely 	rarely	often 	rarely 	 	never
Eat Dried Meat 	Eat 	 	often 	rarely	rarely 	rarely 	 	rarely
Eat Pear 	Eat 	 	rarely 	rarely	often 	rarely 	 	often
Eat Raw Meat 	Eat 	 	often 	often 	rarely 	rarely 	 	rarely
Eat Cooked Meat 	Eat 	 	 	 	 	 	 	
Attack Building 	Fun 	often 	often 	rarely	occasionally	occasionally	 	rarely
Attack Clothing 	Fun 	often 	occasionally	rarely	often 	occasionally	 	rarely
Attack Outer Disciple 	Attack 	often 	occasionally	rarely	often 	often 	 	rarely
Attack Inner Disciple 	Attack 	occasionally	occasionally	rarely	often 	often 	 	rarely
Attack Visitor 	Attack 	 	occasionally	rarely	often 	rarely 	 	rarely
Attack Guest 	Attack 	 	occasionally	rarely	often 	rarely 	 	rarely
Attack unknown Mortal 	Attack 	 	occasionally	rarely	often 	rarely 	 	rarely
Attack Enemy 	Attack 	 	occasionally	rarely	often 	rarely 	 	rarely
Defecate on the Spot 	Shit 	 	rarely 	often 	often 	often 	 	rarely
Defecate by Plants 	Shit 	 	never 	often 	 	 	 	
Defecate by my bed 	Shit 	 	never 	often 	 	 	 	
Defecate in Storehouse 	Shit 	 	often 	 	 	 	 	
Defecate on Bed 	Shit 	 	often 	 	 	 	 	
Defecate in Field 	Shit 	 	often 	 	 	 	 	
Take care of Disciple 	Carry 	 	often 	often 	never 	never 	 	occasionally
Move Unconscious Outer Disciple 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Unconscious Inner Disciple 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Unconscious Visitor 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Unconscious Enemy 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Unconscious Guest 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move enemy corpse 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move visitor's corpse 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move guest's corpse 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Outer Disciple's corpse 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Inner Disciple's corpse 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Unconscious Mortal 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Move Mortal's corpse 	Carry 	 	often 	often 	rarely 	never 	 	occasionally
Organize items 	Help 	 	often 	often 	rarely 	never 	 	occasionally
Cut wood 	Help 	 	often 	often 	rarely 	never 	 	occasionally
Mine 	Help 	 	often 	often 	rarely 	never 	 	occasionally
Pilfer items 	Help 	 	often 	often 	rarely 	never 	 	occasionally
Butcher 	Help 	 	often 	often 	rarely 	never 	 	occasionally
Irrigate 	Help 	 	 	 	 	 	 	
Cure Frostbite 	Help 	 	 	 	 	 	 	
Cure Heatstroke 	Help 	 	 	 	 	 	 	
Cook 	Help 	 	 	 	 	 	 	
Refresh Spell 	Help 	 	 	 	 	 	 	
Furnace Spell 	Help 	 	 	 	 	 	 	
Join in the fun 	Help 	 	 	 	 	 	 	
Play with things 	Fun 	 	 	 	 	 	 	
Hone Qi 	Train 	 	rarely 	often 	rarely 	rarely 	 	often
Practice Core 	Train 	 	rarely 	often 	often 	rarely 	 	
Hone Protection 	Train 	 	often 	rarely	rarely 	rarely 	 	often
Hone Intellect 	Train 	 	 	 	 	 	 	
Practice Spells 	Train 	 	rarely 	rarely	sometimes 	often 	 	
Attack Unconscious Outer Disciple	Attack 	 	 	 	often 	 	 	
Attack Unconscious Inner Disciple	Attack 	 	 	 	often 	 	 	
Attack Unconscious Guest 	Attack 	 	 	 	often 	 	 	
Attack Unconscious Visitor 	Attack 	 	 	 	often 	 	 	
Attack Unconscious Mortal 	Attack 	 	 	 	often 	 	 	
Feed Laxative 	Help 	 	often 	often 	rarely 	rarely 	 	rarely
Heal Injury 	Help 	 	 	 	 	 	 	
Enjoy the breeze 	Fun 	 	 	 	 	 	 	
Urinate 	Help 	 	 	 	 	 	 	
Cook 	Help 	 	 	 	 	 	 	
Heal Injury 	Help 	 	 	 	 	 	 	
Urinate 	Help 	 	 	 	 	 	 	
Use Spells on Enemy 	Battle 	never 	never 	never 	never 	often 	 	occasionally
Use Spells on Ally 	Battle 	never 	 	 	 	 	 	
Feed Euphoria Pill 	HighHelp	 	 	 	 	 	 	
Feed Sprout Pill 	HighHelp	 	 	 	 	 	 	
Feed Purity Pill 	HighHelp	 	 	 	 	 	 	
Feed Spirit Stone 	HighHelp	 	 	 	 	 	 	
Feed Spirit Crystal 	HighHelp	 	never 	 	 	 	 	
Consume Snake Gall 	Eat 	 	rarely 	rarely	rarely 	often 	 	
Consume Bear Gall 	Eat 	 	rarely 	rarely	rarely 	often 	 	
Consume Red Ginseng 	Eat 	 	never 	never 	rarely 	rarely 	 	occasionally
Consume Purple Ganoderma 	Eat 	 	never 	never 	rarely 	rarely 	 	occasionally
Consume Ochre Essence 	Eat 	 	never 	never 	often 	often 	 	occasionally
Consume Crimson Fruit 	Eat 	 	never 	never 	often 	often 	 	occasionally
Eat Prism Lotus 	Eat 	 	never 	never 	often 	often 	 	occasionally
Consume Sagacity Fruit 	Eat 	 	never 	never 	often 	often 	 	occasionally
Consume Gnarled Vine 	Eat 	 	never 	never 	often 	often 	 	occasionally
Consume Life Spring 	Eat 	 	 	 	 	 	 	
Consume Flood Dragon Egg 	Eat 	 	never 	never 	often 	never 	 	
Consume Phoenix Egg 	Eat 	 	never 	never 	never 	often 	 	
Consume Dragon Feces 	Eat 	 	often 	never 	never 	never 	never	
Consume Dumpling 	Eat 	 	 	 	 	 	 	
Consume Phoenix Flesh 	Eat 	 	never 	never 	never 	often 	 	
Consume Dragon Flesh 	Eat 	 	never 	never 	often 	never 	 	
Consume Primordial Flesh 	Eat 	 	 	 	 	 	 	
Consume Bread 	Eat 	 	often 	rarely	rarely 	rarely 	 	
Consume Beast Blood 	Eat 	 	rarely 	often 	rarely 	rarely 	 	
Consume Earth Flux 	Eat 	 	never 	never 	rarely 	rarely 	 	
Consume Ice Crystal Powder 	Eat 	 	rarely 	rarely	rarely 	often 	 	
Consume Igneocopper Powder 	Eat 	 	rarely 	rarely	often 	rarely 	 	
Consume Cinnabar 	Eat 	 	 	 	 	 	 	
Consume Resin Essence 	Eat 	 	never 	never 	occasionally	occasionally	 	
Consume Holy Essence 	Eat 	 	never 	never 	occasionally	occasionally	 	
Consume Evil Essence 	Eat 	 	never 	never 	occasionally	occasionally	 	
Consume Healing Herb 	Eat 	 	 	 	 	 	 	
Consume Purity Leaf 	Eat 	 	 	 	 	 	 	
Consume Spirit Leaf 	Eat 	 	 	 	 	 	 	
Consume Laxative 	Eat 	 	 	 	 	 	never	often
Eat Bamboo Shoots 	Eat 	 	 	 	 	 	often	
Eat Bamboos 	Eat 	 	 	 	 	 	often	
Eat Something 	Eat 	 	 	 	 	 	 	
Eat Trimerous Essence Pill 	Eat 	 	never 	never 	occasionally	occasionally	 	often
Eat Soil Essence Powder 	Eat 	 	never 	never 	occasionally	occasionally	 	often
Eat Qi Fasting Pill 	Eat 	 	never 	never 	occasionally	occasionally	 	often
==Food Nutrition==
As part of their behavior loop, pets will try to consume two types of food, regular and high quality (rare items like Earth Flux), one after the other.
=== Nutrition value ===
Different types of Food provide different bonuses to Pets, mostly in the form of nutritionXiaWorld.Npc.AddFoodNutir(). Nutrition is a value attached to one of the pet's 5 main stats (INT, Qi, Core, Protect and Spell) and varying between -100 and 100. It drastically increases the efficiency of the related training and is consumed by that training, whereas having negative nutrition will decrease the stat insteadXiaWorld.JobLsTrain.OnToilFinish(). The nutrition value storage for a particular stat can be accessed in-game as the image shows.
It is thus very important to choose food boosting the stats one wishes to train on the pet. For easier management, boosting one stat at a time is also easier.
Food also affects the two secondary stats "Fatness" and "Strength", providing direct bonuses or maluses to those stats each time the pet is fed. If the food is common, the stats are affected by the reducing multiplier explained below in the same way Nutrition values are. 
In addition, the WuDang DLC pet has specific nutrition rules depending on their Bless/Curse attribute.
=== Food extra effects ===
The Food need is filled by the consumed food nutrition value as usualThe game defines a particular Food Nutrition value in Settings/LingShou/FoodNutrition/nutrition.txt but doesn't actually make use of it when eating. The extra Needs provided by the food, like Leisure for or Water for are ignored.
However, the modifiers applied by the food will apply to the pet. This does not necessarily have an effect on them however, as their needs aren't affected by the same properties as non-pet NPCs. For example, the Amber Fruit's hunger immunity is applied by the property Food Consumption Bonus, but the Food need of the pet doesn't make use of it so they'll have the modifier active without it doing anything.
===High Quality food ===
Whenever the pet eats a High Quality food, they'll get a "Medicine Absorbing"Settings/Modifiers/Modifier_System.xml [Modifier_Dan_ColdDown] debuff of 1200s (2 in-game days). Moreover, eating any more food of that type during the debuff won't result in any nutrition gain, and the pet behavior is adjusted not to try againbefore the cooldown expires. 
In compensation, the nutrition value of the high quality food is always at full strengthSpecifically, this isn't because they have that modifier but because they have no nutrition value, which means the check in XiaWorld.Npc.GetNeedV() returns false, and the values are sometimes higher than similar common food. 
Name	Intelligence	Core	Spells	Qi 	Protection	Fat	Strong
 	-1 	0 	0 	50 	0 	0 	0
 	3 	3 	3 	3 	3 	0 	0
 	0 	0 	0 	-5 	50 	0 	0
 	0 	0 	50 	0 	-5 	0 	0
 	50 	-5 	0 	0 	0 	0 	0
 	0 	50 	-5 	0 	0 	0 	0
 	6 	0 	0 	0 	0 	-10	0
 	0 	0 	12 	0 	0 	0 	-5
 	0 	0 	0 	20 	0 	-5 	0
 	-1 	6 	6 	0 	0 	0 	0
 	0 	0 	0 	0 	20 	2 	0
 	0 	0 	0 	0 	20 	5 	0
 	0 	0 	0 	0 	0 	-10	-10
 	0 	0 	0 	0 	0 	0 	0
 	0 	0 	0 	0 	0 	-3 	-3
 	0 	30 	0 	-10	0 	0 	0
 	0 	0 	0 	-8 	40 	0 	-3
 	0 	0 	0 	40 	-8 	-3 	0
 	0 	0 	0 	0 	0 	-1 	0
 	0 	0 	0 	0 	0 	-10	0
 	0 	0 	0 	0 	0 	10 	0
DLC 	0 	0 	0 	12 	0 	0 	0
DLC 	-5 	0 	0 	0 	0 	-5 	0
DLC 	0 	0 	20 	0 	0 	0 	0
=== Common food ===
Common food do not have a cooldown and can always be eaten. If they have no nutrition value, they always give their full nutrition strength. Otherwise, their nutrition strength is reduced by the following ratio : \frac{maxWaterNeed - currentWaterNeed}{foodNutritionValue}, with a maximum of 1 (so no bonus can be acquired that way). The maximum water need of the pet depends on its growth stageXiaWorld.LsNeedBase.MaxValue, it is 50 at the child stage and 100 otherwise. 
Moreover, in the Fat and Physique case, if the bonus is strictly between -1 and 1, it will not apply, which means, as most common food only affect those factors by 1, that you'll only modify those stats when the above factor is at 1. In practice, this means that food's effect on nutrition gets progressively lower as the pet's thirstiness increases, unless the nutrition value of the food is particularly high or 0. 
Name	Type 	Intelligence	Core	Spells	Qi	Protection	Fat	Strong	Nutrition
 	Meat 	0 	12 	0 	0 	0 	1 	2 	70
 	Fruit 	12 	0 	0 	0 	0 	0 	0 	40
 	Fruit 	8 	0 	0 	0 	0 	0 	0 	40
 	Fruit 	9 	0 	0 	0 	0 	0 	0 	40
 	Fruit 	7 	0 	0 	0 	0 	0 	0 	25
 	Meat 	0 	4 	0 	0 	0 	0 	1 	35
DLC 	Meat 	0 	4 	0 	0 	0 	0 	0 	30
 	Meat 	0 	8 	0 	0 	0 	0 	1 	70
DLC 	Meat 	0 	8 	0 	0 	0 	0 	0 	30
 	Meat 	0 	10 	0 	0 	0 	0 	0 	70
 	Meat 	0 	5 	0 	0 	0 	0 	0 	35
 	Other 	0 	0 	0 	0 	2 	1 	0 	25
 	Mushrooms 	0 	0 	0 	3 	0 	-1 	0 	25
 	Tubers 	0 	0 	6 	0 	0 	0 	-1 	55
 	Tubers 	0 	0 	9 	0 	0 	0 	-1 	55
 	Mushrooms 	0 	0 	0 	5 	0 	-1 	0 	25
 	Cooked Food	0 	0 	0 	0 	10 	1 	0 	85
 	Cooked Food	0 	0 	0 	0 	12 	1 	0 	85
 	Cooked Food	0 	0 	0 	0 	15 	1 	0 	85
 	Drug/Other 	0 	0 	0 	0 	0 	0 	0 	
 	Other 	-3 	0 	40 	0 	0 	0 	0 	150
 	Other 	0 	40 	0 	-3	0 	0 	0 	150
 	Other 	0 	25 	-1 	0 	0 	1 	2 	70
 	Other 	0 	-1 	25 	0 	0 	1 	2 	70
DLC 	Tubers 	0 	0 	6 	0 	0 	0 	0 	60
DLC 	Meat 	0 	12 	0 	0 	0 	0 	0 	30
== Stat training ==
Pets will train a stat whenever their Leisure (Fun) is high enough, and as long as their stats are not already maxed. The point where they start to train depends on their maturity :
* Child Stage : 50 fun needed
* Learning Stage : 100 fun needed (yes it's counterintuitive)
* Mature Stage : 75 fun needed
The activity they choose to train is decided by the player's behavior choices, where non-forbidden activities will be weighted depending on the player's encouragement. Note that the stat being maxed does not prevent the pet to try to train it (they'll then cancel the activity, and do another loop before trying to train again).
The stats are gained in full at the end of a successful training session, not progressively during that session. Depending on the nutrition value for that training, the base boost is :
* Nutrition between -1 and 1 : 0.
* Nutrition < -1 : \frac{Nutrition}{100} - 0.1. As Nutrition is negative, this is a decrease in stat.
* Nutrition > 1 : \frac{Cost}{5} + 0.2 where Cost is Max(\frac{Nutrition}{5}, 1), and the division on Nutrition is rounded up. This means a minimum base boost of 0.4.
If Nutrition is >1, the nutrition value is reduced by Cost. A multiplier is then applied to the base boost, equal to \frac{Intelligence}{200}%, for a maximum boost of 50%. The value is finally rounded down to the nearest decimal and added to the stat. Finally, the entire Leisure of the pet is depleted, no matter its starting value.
== Recommendations ==
* A Pet's idle behavior can be interrupted (default: ALT+S) to train them faster.
*Training Intelligence as the first stat is optimal, given it makes training other stats 50% faster
*Training one stat at a time makes food management easier
== References ==
Category:Pet System