public static float GetSpeed(Entity entity, float stat)
 {
     var ret = 4 + 5.6f * (stat / 75f);
     if (entity.HasConditionEffect(ConditionEffects.Speedy))
         ret *= 1.5f;
     if (entity.HasConditionEffect(ConditionEffects.Slowed))
         ret = 4;
     if (entity.HasConditionEffect(ConditionEffects.Paralyzed))
         ret = 0;
     return ret;
 }
        public static float GetDefenseDamage(Entity host, int dmg, int def)
        {
            if (host.HasConditionEffect(ConditionEffects.Armored))
                def *= 2;
            if (host.HasConditionEffect(ConditionEffects.ArmorBroken))
                def = 0;

            float limit = dmg * 0.15f;

            float ret;
            if (dmg - def < limit) ret = limit;
            else ret = dmg - def;

            if (host.HasConditionEffect(ConditionEffects.Invulnerable) ||
                host.HasConditionEffect(ConditionEffects.Invincible))
                ret = 0;
            return ret;
        }
Beispiel #3
0
 protected float GetSpeedMultiplier(Entity entity)
 {
     float ret = 1;
     if (entity.HasConditionEffect(ConditionEffects.Slowed))
         ret *= 0.5f;
     if (entity.HasConditionEffect(ConditionEffects.Paralyzed) ||
         entity.HasConditionEffect(ConditionEffects.Stasis))
         ret = 0;
     return ret;
 }
Beispiel #4
0
 public static bool ValidateAndMove(Entity entity, float x, float y)
 {
     if (entity.Owner == null ||
         entity.HasConditionEffect(ConditionEffects.Paralyzed)) return false;
     if (Validate(entity, x, y))
         entity.Move(x, y);
     else if (Validate(entity, entity.X, y))
         entity.Move(entity.X, y);
     else if (Validate(entity, x, entity.Y))
         entity.Move(x, entity.Y);
     else
         return false;
     return true;
 }
Beispiel #5
0
        public static bool Validate(Entity entity, float x, float y)
        {
            if (entity.Owner == null ||
                entity.HasConditionEffect(ConditionEffects.Paralyzed)) return false;
            if (x < 0 || x >= entity.Owner.Map.Width ||
                y < 0 || y >= entity.Owner.Map.Height)
                return false;
            if (entity.ObjectDesc.Flying &&
                entity.Owner.Obstacles[(int)x, (int)y] != 2) return true;

            var objId = entity.Owner.Map[(int)x, (int)y].ObjType;
            if (objId != 0 &&
                XmlDatas.ObjectDescs[objId].OccupySquare)
                return false;

            if (entity.Owner.Obstacles[(int)x, (int)y] != 0)
                return false;
            return true;
        }