So one thing I really don't understand is TransformMoveDelay.
The 'slow on damaged' stuff, I get that.
But the first part is full of directly changing the speed from the listed value to something higher.
I don't really understand why having a creature thinking more often than it's moving is really necessary, but okay.
Except that it only targets very specific movement speeds, while all others are unaffected. Well, plus any passive creatures. Or Uncontrolled creatures.
Is it even accurate to the creatures' speeds on OSI? Was it just done to not have to change a bunch of creatures' Speeds or something?
Do OSI creatures react more quickly than they move?

It both confuses and frustrates me.

Here's the code, with commentary:
Code:
    public virtual double TransformMoveDelay(double delay)
     {
       bool isPassive = (delay == m_Mobile.PassiveSpeed);
       bool isControlled = (m_Mobile.Controlled || m_Mobile.Summoned);

Arbitrary delay increases. Why is this necessary? Why not just increase the delays in the creatures themselves? Why these specific seven? What about values in-between these? Why not just a flat doubling?

Code:
       if (delay == 0.2)
       {
         delay = 0.3;
       }
       else if (delay == 0.25)
       {
         delay = 0.45;
       }
       else if (delay == 0.3)
       {
         delay = 0.6;
       }
       else if (delay == 0.4)
       {
         delay = 0.9;
       }
       else if (delay == 0.5)
       {
         delay = 1.05;
       }
       else if (delay == 0.6)
       {
         delay = 1.2;
       }
       else if (delay == 0.8)
       {
         delay = 1.5;
       }

Again, arbitrary delay increase, this time for passives. Wouldn't it make more sense to just have a longer passive speed?

Code:
       if (isPassive)
       {
         delay += 0.2;
       }

And now an arbitrary increase for uncontrolled creatures. Again, wouldn't it make more sense to have only controlled creatures getting the change, and wild creatures being 'normal'?
Code:
       if (!isControlled)
       {
         delay += 0.1;
       }
       else if (m_Mobile.Controlled)
       {

This one makes sense. When your pet is following you he gets a nice reduction so that he moves faster to keep up.

Code:
         if (m_Mobile.ControlOrder == OrderType.Follow && m_Mobile.ControlTarget == m_Mobile.ControlMaster)
         {
           delay *= 0.5;
         }

This one on the other hand is another arbitrary one.

Code:
         delay -= 0.075;
       }

The following stuff is what lowers pet speeds based on health lost. I think it's a bit heavy-handed, but it's how OSI has it.

Code:
       double speedfactor = 0.8;

       XmlValue a = (XmlValue)XmlAttach.FindAttachment(m_Mobile, typeof(XmlValue), "DamagedSpeedFactor");

       if (a != null)
       {
         speedfactor = a.Value / 100.0;
       }

       if (!m_Mobile.IsDeadPet && (m_Mobile.ReduceSpeedWithDamage || m_Mobile.IsSubdued))
       {
         double offset = (double)m_Mobile.Hits / m_Mobile.HitsMax;

         if (offset < 0.0)
         {
           offset = 0.0;
         }
         else if (offset > 1.0)
         {
           offset = 1.0;
         }

         offset = 1.0 - offset;

         delay += (offset * speedfactor);
       }

Having a zero delay sounds like not such a good thing. Shouldn't this be capped higher, at like 0.01, 0.02, or 0.05?

Code:
       if (delay < 0.0)
       {
         delay = 0.0;
       }

       if (double.IsNaN(delay))
       {
         using (StreamWriter op = new StreamWriter("nan_transform.txt", true))
         {
           op.WriteLine(
             String.Format(
               "NaN in TransformMoveDelay: {0}, {1}, {2}, {3}",
               DateTime.UtcNow,
               GetType(),
               m_Mobile == null ? "null" : m_Mobile.GetType().ToString(),
               m_Mobile.HitsMax));
         }

         return 1.0;
       }

       return delay;
     }
 
Back