tags to ease searching: taming, tame'able, tamable.English knowledge of "then" and "than" difference is required to understand this! Otherwise is confusion guaranteed.

If you're reading this then you want to know how hard or easy it is to tame your critter.

To succeed in taming a critter then the critters max HP, current HP and the ratio between the max and the current HP are used. As well as some random numbers. And

*isUncustomizable* in

**cd1.dat****The ratio between max and current HP example:**Consider a critter (Mutant Hare for example) with the max HP of 3500.

You beat this poor thing around and its HP is now 1400

**Code:**HP/maxHP = 1400/3500 = 0.4

This means the ration between its max and current HP is 0.4. You can always use this here. Might make a calculator later, but for now... Onwards!

The source code calculating this is:

**Code:**const bool tSuccess = ((tC->getMaxHP()!=0?Math::UnitRandom()<(10.0f/tC->getMaxHP()):true)

&& Math::UnitRandom()>(float)tC->getHP()*0.01f

&& Math::UnitRandom()>tC->getHPRatio()

&& (!tCritter.isUncustomizable||Math::UnitRandom()<0.001));

Coders tips:

&& means AND. This means you must have this in the end:

**Code:**const bool tSuccess = (true

&& true

&& true

&& true);

If any of them is false, then the tame failed.

|| means OR

The function

**Code:**Math::UnitRandom()

returns a random number between 0 and 1.

So to make this more readable by section:

**Code:**(tC->getMaxHP()!=0?Math::UnitRandom()<(10.0f/tC->getMaxHP()):true)

Into:

**Code:**if maxHP does not equal 0 (protip: it never does) then

if a RandomNumber (between 0 and 1) is smaller than 10/maxHP then this is true

if maxHP does equal 0 then

this is always true

I know it can be hard to understand this, but this part of the code is basically telling "The higher a maxHP a critter has, the harder it is to tame it". This is because of:

**Code:** if a RandomNumber (between 0 and 1) is smaller than 10/maxHP then this is true

As an example of this let's use Hare (maxHP = 65) and Mutant Hare (maxHP = 3500). If we only consider the condition above to tame the critter:

For the Hare

**Code:**10/65 = 0.15385

if a RandomNumber (between 0 and 1) is smaller than 0.15385 then this is true

For the Mutant Hare

**Code:**10/3500 = 0.00286

if a RandomNumber (between 0 and 1) is smaller than 0.00286 then this is true

So you hopefully tell that a RandomNumber below 0.15385 is more likely than a RandomNumber below 0.00286.

Just for fun, consider Haunted Tower. With a maxHP of 10000. That's 0.001.

**Next part of the code:**This should be straightforward:

**Code:**Math::UnitRandom()>(float)tC->getHP()*0.01f

Reads as:

**Code:**if a RandomNumber (between 0 and 1) is bigger than HP*0.01

Again a critter Mutant Hare, you beat it around and its HP is now at 300

**Code:**if a RandomNumber (between 0 and 1) is bigger than 300*0.01=3 then this is true

You're now thinking "Aha! But that will never be possible to tame then?", but wait! There's moar!

To tame then, the HP of the critter must be below 100 (100*0.01=1). So beat the critter some moar! To 20

**Code:**if a RandomNumber (between 0 and 1) is bigger than 20*0.01=0.2 then this is true

This means that

**any tames used on critters above 100 HP ARE WASTED! ****Anyways, onwards! Next part of the code:****Code:**Math::UnitRandom()>tC->getHPRatio()

Reads as:

**Code:**if a RandomNumber (between 0 and 1) is bigger than the HP Ratio then this is true

Look further up in this post for HP ratio explained.

Using the same example as up there:

**Code:**if a RandomNumber (between 0 and 1) is bigger than 0.4 then this is true

Basically means:

*THE MOAR YOU BEAT THAT CRITTER THE EASIER IT IS TO BECOME YOUR FRIEND/SLAVE*. Note: This does not hold true in real life.

**Last part of the code:****Code:**(!tCritter.isUncustomizable||Math::UnitRandom()<0.001)

tCritter.isUncustomizable is taken from cd1.dat and reads as

**Code:**isUncustomizable=true

If isUncustomizable is true, then it depends on RandomNumber to be smaller than 0.001.

isUncustomizable is default false, so in that case, then the RandomNumber doesn't matter.

Let's sum up with some examples**Code:**const bool tSuccess = ((tC->getMaxHP()!=0?Math::UnitRandom()<(10.0f/tC->getMaxHP()):true)

&& Math::UnitRandom()>(float)tC->getHP()*0.01f

&& Math::UnitRandom()>tC->getHPRatio()

&& (!tCritter.isUncustomizable||Math::UnitRandom()<0.001));

**Code:**Success = (RandomNumber < (10/maxHP)

AND RandomNumber > (HP*0.01)

AND RandomNumber > HP_Ratio

AND (!isUncustomizable OR RandomNumber < 0.001));

**Hare**Untouched by player

maxHP=65

HP=65

(isUncustomizable is default false, and !false becomes true)

**Code:**Success = (RandomNumber < 0.1538

AND RandomNumber > 0.65

AND RandomNumber > 1

AND true);

It would never be possible to tame this because the player hasn't smacked it once first and the HP Ratio is left at 1 (line 3 in the code).

Smacked by player

maxHP=65

HP=35

(isUncustomizable is default false, and !false becomes true)

**Code:**Success = (RandomNumber < 0.1538

&& RandomNumber > 0.35

&& RandomNumber > 0.5385

&& true);

It would be possible to tame this Hare.

**Dire Hare**maxHP=150

HP=120

**Code:**Success = (RandomNumber < 0.0666

AND RandomNumber > 1.2

AND RandomNumber > 0.8

AND true);

It would be impossible to tame this since its HP is not below 100 (100*0.01=1 and 120*0.01=1.2)

**Mutant Hare**maxHP=3500

HP=20

isUncustomizable=true

Since isUncustomizable is true, then the last statement isn't automatically true, but instead depends on a RandomNumber to be less than 0.001.

**Code:**Success = (RandomNumber < 0.00286

AND RandomNumber > 0.2

AND RandomNumber > 0.0057

AND RandomNumber < 0.001);

It would be possible to tame this critter.

Hope it helps you all to understand how taming works.