private void ProcessArmor(GameEntity sourceEntity, GameEntity targetEntity, ref float inputDamageValue)
        {
            var targetArmor = targetEntity.characterCharacterStats.GetStat(CharacterStatId.Armor);

            if (targetArmor == null)
            {
                return;
            }
            //theo dota2
            var damageMultiplier = 1 - ((0.052f * targetArmor.ActiveValue) /
                                        (0.9f + 0.048f * MathFast.Abs(targetArmor.ActiveValue)));

            inputDamageValue = (inputDamageValue * damageMultiplier);


            var targetHpValue = targetEntity.characterCharacterStats.GetStat(CharacterStatId.Hp);

            if (targetHpValue == null)
            {
                //lỗi
                return;
            }

            targetHpValue.ActiveValue -= inputDamageValue;
            //done
        }
Exemplo n.º 2
0
 Float3 GetAccelAgainstWall(float dist, ref Float3 dir, float thresh, float weight)
 {
     if (dist < thresh)
     {
         return(Float3.Scale(ref dir, weight / MathFast.Abs(dist / thresh)));
     }
     return(Float3.Zero);
 }
Exemplo n.º 3
0
        public static int HexDistance(int x1, int y1, int x2, int y2)
        {
            int x = x2 - x1;
            int y = y2 - y1;
            int z = -x - y;

            return(MathFast.Max(MathFast.Abs(x), MathFast.Max(MathFast.Abs(y), MathFast.Abs(z))));
        }
Exemplo n.º 4
0
 //todo hexagonal
 public void Fill(int radius)
 {
     for (int i = -radius; i < radius; i++)
     {
         for (int j = -radius; j < radius; j++)
         {
             if (MathFast.Abs(HexMath.GetZ(i, j)) <= radius)
             {
                 Add(i, j, new T());
             }
         }
     }
 }